Ar:Osm2mp

From OpenStreetMap Wiki
Jump to navigation Jump to search

أدة Osm2mp.pl

أداة Osm2mp.pl هي أداة تسمح بتحويل الخرائط من صيغة OSM إلى MP المسماه بالصيغة البولندية (polish format) وهذه الأداة تعتمد على مكتبة perl البرمجية وتم تطويرها بواسطة المطور Liosha وهي تدعم إخراج خرائط تحتوي على توجيه (routing).

وهذا الموضوع الرسمي للأداة على منتدى أوسم للمزيد عن هذه الأداة ولتحميلها:

http://forum.openstreetmap.org/viewtopic.php?id=1162

والكود المصدري للأدة متوفر هنا:

https://github.com/liosha/osm2mp

التثبيت:

على Windows

هناك نسخ للأداة بصيغة تنفيذية exe تتوفر من هنا :osm2mp32.zip osm2mp64.zip (r777), getbound.zip mp-postprocess.zip


بعد تثبيت Strawberry Perl قم بوضع الأوامر التالية في محرر الأوامر لتثبيت عناصر إضافية تعتمد عليها الأداة ولا بد منها:

  cpan -T -i Config::Std 
  cpan -i Template Text::Unidecode List::MoreUtils Encode::Locale Getopt::Long PerlIO::encoding  
  cpan -i YAML  Data::Dump  Geo::Shapefile::Writer Geo::Openstreetmap::Parser Tree::R Math::Polygon
  cpan -i PerlIO::via::Unidecode PerlIO::via::PrepareCP1251 Inline::C Math::Polygon::Tree
  cpan -i Log::Any Log::Any::Adapter

(اذا كنت تستخدم نسخة ActivePerl فتحتاج فقط إلى الأمر cpan -T -i Config::Std وبقية الأدوات تجدها بسهولة في Perl Package Manager مدير الحزم الخاص بـActivePerl ).


على Debian/Ubuntu

You will need the following dependencies:

sudo apt-get install libtemplate-perl libtext-unidecode-perl libyaml-perl
على Ubuntu 12.04

Tested on osm2mp r634: https://code.google.com/p/osm2mp/source/browse/?r=634

# Ubuntu packages
sudo apt-get install libconfig-std-perl libencode-locale-perl liblist-moreutils-perl libmath-polygon-perl libinline-perl libxml-parser-perl libtext-unidecode-perl libtemplate-perl libjson-perl
# CPAN packages
## run cpan for auto-configuration (under normal user, no root here please)
cpan
## restart shell to apply environment changes (close and open terminal again)
## install packages
cpan Math::Geometry::Planar::GPC::Polygon Math::Polygon::Tree Tree::R Geo::Openstreetmap::Parser

على Gentoo

emerge dev-perl/Inline dev-perl/Template-Toolkit dev-perl/Text-Unidecode app-portage/g-cpan

and

g-cpan -i Math::Geometry::Planar::GPC::Polygon Math::Polygon Math::Polygon::Tree

على Fedora

yum install perl-Template-Toolkit

على FreeBSD

make -C /usr/ports/converters/osm2mp install clean

or

portinstall osm2mp

على ArchLinux

Install the following packages (from official repo or build from AUR):

perl-template-toolkit
perl-text-unidecode
perl-math-polygon
perl-math-geometry-planar-gpc-polygon
perl-math-polygon-tree
perl-list-moreutils
perl-data-dump

على OpenSUSE

Open terminal app and enter following commands:

su
zypper in perl-YAML
perl -MCPAN -e "install List::MoreUtils"
perl -MCPAN -e "install Text::Unidecode"
perl -MCPAN -e "install Data::Dump"
perl -MCPAN -e "install Math::Polygon"
perl -MCPAN -e "install Inline::MakeMaker"
perl -MCPAN -e "install Math::Geometry::Planar::GPC::Polygon"
perl -MCPAN -e "install Math::Polygon::Tree"
perl -MCPAN -e "install Tree::R"

مفاتيح البرنامج التي تحدد الخيارات أثناء التحويل:

Key المفتاح Format الصيغة Description الوصف Default value القيمة الافتراضية
--mapid --mapid=<id> يحدد رمز الخريطة الفريد 88888888
--mapname --mapname=<name> اسم الخريطة EIGHT
--cfgpoi --cfgpoi=<file> لملف تعليمات تحويل نقاط الاهتمام poi.cfg
--cfgpoly --cfgpoly=<file> لملف تعليمات تحويل الخطوط poly.cfg
--header --header=<file> The name of the map header template file. Used in version 0.80 (up to revision 182). Not used with the appearance of the --config switch--mapid header.tpl
--config --config=<file> File name of header template and map address configuration ( example file ) garmin.yml
--bbox --bbox=<minlon,minlat,maxlon,maxlat> لقص الخريطة على شكل مربع يحدد فيه خطوط الطول والعرض معطل بشكل افتراضي
--osmbbox --osmbbox لقص الخريطة حسب الحدود معطل بشكل افتراضي
--bpoly --bpoly=<poly-file> poly لقص الخريطة حسب ملف

وهو ملف توضع فيه حدود ما ترغب بقصه ويقصه

معطل بشكل افتراضي
--background --background "0x4b" لإنشاء مضلع كخلفية للخريطة Included
--codepage --codepage=<num> MP ترميز ملف

وإذا رغبت بتحويل خريطة عربية ضع الترميز 65001

1251
--nocodepage --nocodepage بدون ترميز ويصير ترميزه الافتراضي MP لجعل ملف

(utf-8)

Disabled
--upcase --upcase جعل جميع القيم الأعجمية بالحرف الصغيرة Disabled
--translit --translit ترجمة حرفية لجميع كل القيم التي لا تطابق لغة الخريطة Disabled
--ttable --ttable=<file> Additional lookup table file name ( example file ) Key
--namelist --namelist <key>=<list> قائمة العلامات بترتيب الأولوية ، والتي تُستخدم قيمها لملء أسماء الكائنات في ملف .mp label=name loc_name addr:housenumber operator,

house=addr:housenumber addr:housename, place=place_name name, region=addr:region is_in:region addr:state is_in:state, country=addr:country is_in:country_code is_in:country, destination=destination label name

--nametaglist --nametaglist=<list> قائمة العلامات التي تُستخدم قيمها لتعبئة حقل التصنيف في ملف .mp ، بترتيب الأولوية. تم إيقافه مع إدخال مفتاح القائمة . name, ref, int_ref, addr:housenumber, operator
--countrylist --countrylist=<file> لاستبدال قائمة الدول بقائمة من اختيارك Disabled
--defaultcountry --defaultcountry=<name> لتحديد البلد الافتراضي للخريطة Earth
--defaultregion --defaultregion=<name> لتحديد المنطقة الإفتراضي EIGHT
--defaultcity --defaultcity=<name> The default city for those objects for which it is not explicitly set. Required for address search Disabled
--addressing --addressing معالجة مضلعات العناوين... Included
--navitel --navitel توليد بيانات العناوين للمضلعات Disabled
--oneway --oneway Handle the oneway tag Included
--routing --routing لتوليد خريطة توجيه Included
--mergeroads --mergeroads لدمج الطرق التي بنفس السلسلة Included
--mergecos --mergecos=<cosine> الزاوية القصوى المسموح بها بين الطرق (للمفتاح ، مُحددة بواسطة قيمة جيب التمام 0.2
--splitroads --splitroads التفريق بين التقاطعات العالية والتقاطعات للخط مع نفسه Included
--maxroadnodes --maxroadnodes=<dist> لتحديد أعلى عدد من النقاط للطريق الواحد 60
--fixclosenodes --fixclosenodes لإصلاح النقاط المتقاربة Included
--fixclosedist --fixclosedist=<dist> Minimum allowed distance between road junctions, in meters (for --fixclosenodes key) 3.0
--detectdupes --detectdupes Check and include in the list of errors information about the presence of duplicate road segments (see the lines "; ERROR:" in the .mp file) Included
--restrictions --restrictions Convert Turn Inhibitions Included
--barriers --barriers Handle travel bans (barrier tag = *) Included
--disableuturns --disableuturns Prohibit "parasitic" U-turns (for example, at the intersection of a motor road with a pedestrian path) Disabled
--destsigns --destsigns Convert Road Signs Included
--interchange3d --interchange3d Convert 3D levels for Navitel format Included
--transport --transport = <List> Leave in the routing column only those roads on which the vehicles listed in the <List> are allowed to move emergency,police,delivery,car,motorcar,bus,taxi,foot,pedestrian,bike,bicycle,truck
--shorelines --shorelines لإنشاء مضلعات للبحار من خلال خطوط السواحل Disabled
--waterback --waterback لإنشاء خريطة للبحار من خلال حدود الجزر Disabled
--marine --marine Include additional data on marine objects in the map (color of buoys, sectors of lighthouse glow, etc.) Included
--makepoi --makepoi Create POI points according to the data of the corresponding polygon, in its conditional "center of gravity" Included
--poiregion --poiregion Specify region and country for points of settlements Included
--poicontacts --poicontacts Specify contact information for POIs Included




الطريقة مبسطة لعملية التحويل على نظام ويندوز

1- حمل هذه النسخة رقم5.24.1.1 من Strawberry Perl :

https://strawberryperl.com/download/5.24.1.1/strawberry-perl-5.24.1.1-64bit.msi

2- حمل هذه الملفات لجميع الحزم محملة بشكل مسبق:

https://www.dropbox.com/s/e9rz06ne33y6u6w/strawberry-perl-5.24.1.1-64bit.rar

3- قم بفك ضغط الملف وانسخ جميع الملفات إلى المسار التالي:

C:\Strawberry

واضغط استبدال للكل

4- تأكد من وجود هذه المسارات كقيم في المتغير Path الموجود في إعدادات متغيرات النظام:

C:\Strawberry\perl\site\bin

C:\Strawberry\c\bin

C:\Strawberry\perl\bin

لمعرفة كيفية تغيير متغيرات النظام شاهد هذه الصفحة:

https://helpdeskgeek.com/windows-10/add-windows-path-environment-variable/

5- حمل ملفات Osm2mp من هنا:

https://github.com/liosha/osm2mp

6- إذا كنت ترغب بالتحويل إلى NM2 الخاصة بنافيتيل قم بتحميل الملفات الجاهزة له وضعه في نفس المجلد الخاص بـOsm2mp :

https://github.com/phyosithu/osm2navitel

7- إذا كنت ترغب بالتحويل إلى قارمن قم بتحميل الملفات الجاهزة له وضعه في نفس المجلد الخاص بـOsm2mp :

https://github.com/liosha/osm2mp-garmin-open

8- أحضر نسخة لملف بصيغة pbf وضعه في نفس المجلد، وهنا مصادر توفر لك خرائط مقسمة بحسب الدول بصيغة OSM مضغوطة قم بتحويلها إلى OSM بواسطة Osmconvert:

http://download.openstreetmap.fr/extracts

http://download.geofabrik.de/index.html

كما يمكنك تحميل أي محتوى من شبكة OSM عبر وسائل عديدة.

كما يمكنك تقسيم اي ملف OSM وتجزئته عبر أداة splitter التي تعتمد على الجافا.

9- بعد تجهيز ملف OSM المناسب قم بالدخول على المجلد عبر محرر الأوامر CMD عبر كتابة الأمر cd ثم مسار المجلد.

10- قم بكتابة الأمر التنفيذي لعملية التحويل:

perl osm2mp.pl ثم ألحقه بالمفاتيح التي ذكرتها أعلاه حسب رغبتك ثم ضع --output= واذكر بعد علامة = اسم ملف mp الذي ترغب باخراجه ثم اضغط مسافة وضع اسم ملف OSM الخاص بك

مثال لاخراج خريطة للسعودية باللغة العربية ولا تدعم التوجيه :

perl osm2mp.pl --config=cfg/sa.cfg --norouting --codepage=65001 --addrinterpolation --shorelines --disableuturns --water-back --defaultcountry=SA --defaultregion=KSA --rename-table rename-region.yml --mapname=KSA_123 --output=KSA.mp mymap.osm

ما هي الصيغ التي يمكنني تحويل ملف MP إليها:

يمكنك تحويل الملف الناتج بالتنسيق البولندي (.mp) إلى تنسيقات مختلفة للبرامج التي تستعرض الخرائط:

  • بالنسبة لـ Garmin: استخدام cgpsmapper (النسخة المدفوعة التي تدعم التوجيه) أو Mapcenter (وهي برامج منقطعة وغير متوفرة حالياً)
  • لماجلان : تعليمات والبرمجيات من فيكتور Pomortsev و ميخائيل شارونوف
  • بالنسبة لبرنامج Navitel : استخدام المحرر GPSMapEdit . وللمزيد حول تحويل الخريطة لنافيتيل هنا (بالروسية) .
  • لبرنامج سفن ويز 7 Ways . يُنصح بفتح ملف mp وحفظه قبل التحويل باستخدام محرر GPSMapEdit .

كما يتوفر أداة أخرى تقوم بالتحويل إلى MP تدعى Osminog

Osminog هي أداة للتحويل من OSM إلى MP (الصيغة البولندية) قام بتطويرها User:Asdert ولكن هذه الأداة يعيبها وجود الكثير من الأخطاء و لاتدعم التوجيه.