mp2shp

DESCRIPTION:

A script for converting maps in Polish (.mp) format into ESRI .shp .shx .dbf suitable for Garmin Mapsource Product Creator.

AUTHOR: vasyusya

FEATURES:

What it does and what does not
-- reads lines, poins and areas from 0 level of .mp
-- transforms types of features to GRMN_TYPE text constants according to the external _type table. Currently, the table contains basic mapping from Navitel typeset
-- for areas uses only Label and Data0, dumps them to areas.shp
-- for lines which are not roads (based on GRMN_TYPE) does the same
-- for roads
-- splits a polyline into links at each routing node and nodes with defined z-level
-- recalculates routing restrictions
-- takes name from Label or SreetDescr
-- takes region from RegionIdx or from RegionName
-- takes country from CountryIdx or from CountryName
-- reads RoutingParam (speed_fmt is 1, i.e.km/h, change in the preamble)
-- reads Numbers field (street numbering) and add numbering info
-- converts prefixes and suffixes in name
-- dumps this to roads.shp
-- for poi which are not addressable dumps Label and Data0 to points.shp
-- for addressable poi also adds contact info as in roads
-- all other info is (in the current version) skipped
-- for polygons of addressable types (listed in config) optionally creates address and arrive points with appropriate info
-- road sign info is added.

LIMITATIONS:

Due to the difference in data structures, the script can fail with poorly prepared of too sophisticated Polish input.
In particular, each road is splitted in routing nodes and nodes with defined z-levels. If the road contains street numbering, these split nodes need to have first/last numbers set, because no interpolation is done.
Always check last lines of output and _logfile.txt

INSTALL:

See INSTALL for Linux or README.WINDOWS (in Russian) for Windows

USAGE:

Review and edit _types. You should know how types are mapped. The supplied file contains basic mapping from Navitel typeset which I used for testing.
Also supplied is _types.garmin by hiderMD ([email protected]). You can rename it to _types and use instead.

Put all files in the same directory and run

./_mp2shp1.pl flie.mp

As a result you should obtain files areas.* lines.* poi.* points.* roads.*

If the last line of output was anything else then "Done", the shapes are most likely broken
Always check the last line of the output and the content of _logfile.txt

TYPES MAPPING:

You can edit the _types file to change types transformation from
mp to Garmin types. Format is
<mp_type><TAB><shapetype><TAB><garmin_type>

Here

mp_type is input type as used in .mp file

shapetype is 1 for poi, 3 for polylines, 5 for polygons

garmin_type is a text constant as defined in manual for MPC,
if empty, the script will complain or die
if NONE the object is silently skipped

To get the list of types which are missing, type

./_checktypes.pl file.mp

and look at _missing.txt

TROUBLESHOOTING:

If the script dies, the known reasons are:

Necessary libraries are not installed properly. Read INSTALL

Your .mp file contains areas or lines of types not described in _types. Edit _types. Notice that the delimiters are tabs, not spaces.

Broken system, input file or bug in the script (report if so)

To see the content of the resulting shapes you can use

./_dumpshp

Edit the last lines of the script to uncomment what you want to dump.

DOWNLOAD LINK:

[Only registered and activated users can see links. ]

Haven't tried myself this tool but don't think there is problem with it.