User Tools

Site Tools


manual:advanced:map_tools:conversion

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
manual:advanced:map_tools:conversion [2015/05/15 06:54] mstupkamanual:advanced:map_tools:conversion [2023/06/27 14:40] (current) – [Convert SHP file to KML] mstupka
Line 1: Line 1:
  
-====== Maps2mapc ======+====== Conversion of Maps ======
  
 ---- ----
-<WRAP todo round center 60%>This page is obsolete and will be reworked soon</WRAP> +===== How to create a sqlitedb file with Mapc2mapc ===== 
-===== How create a sqlitedb file with Maps2mapc ===== +<WRAP center round important > 
 +Mapc2mapc is not a product of Asamm Software so we do not take any responsibility for changes in its usage. This article is for general information only.  
 +</WRAP>
 ==== Basic information ==== ==== Basic information ====
-  * Locus currently support wide range of map formats (more [[manual:maps:map_formats|here]]). But most common formats are not yet covered. If you want convert your maps to some format usable by Locus, you may look on program [[http://www.the-thorns.org.uk/mapping/help/over.html|MAPC2MAPC]].+  * Locus Map currently supports a wide range of map formats (see more [[manual:user_guide:maps_external|here >>]]). But many other formats are not yet covered. If you want to convert your maps to some format usable by Locus Maphave a look at [[http://www.the-thorns.org.uk/mapping/help/over.html|MAPC2MAPC]] software. 
 + 
 +  * Firstly we recommend to test the demo version if this fits your needs. [[http://www.the-thorns.org.uk/mapping/help/locus.html|Here]] are instructions of the MAPC2MAPC author.
  
-  * Firstly, suggest to test working demo version if this fits your needs. [[http://www.the-thorns.org.uk/mapping/help/locus.html|Here]] is description from author of MAPC2MAPC, how to...+  * In case you are satisfied we suggest to buy the full version\\  
 +Locus Map Classic user gets 10% discount of this product. [[http://www.the-thorns.org.uk/mapping/help/locus.html|Read more >>]] 
  
-  * In case you'll be satisfied, I suggest to buy full version by **Buy** button on bottom of manual page. Thanks to this, you'll get 10% discount of this product 
  
   * **MAPC2MAPC:** http://www.the-thorns.org.uk/mapping/   * **MAPC2MAPC:** http://www.the-thorns.org.uk/mapping/
  
-==== Additional knowledge base information ====+==== Additional manual chapters ====
  
-  * [[manual:convert_img_to_sql|Convert IMG maps to a sqlitedb Locus map]] +  * [[manual:advanced:convert_img_to_sql|Converting IMG maps to a Locus supported sqlitedb map]] 
-  * [[manual:convert_images_to_sql|Convert pictures to a sqlitedb Locus map]]+  * [[manual:advanced:convert_images_to_sql|Converting pictures to a Locus supported sqlitedb map]]
  
  
Line 31: Line 34:
  
 ---- ----
-===== How to convert Netherlands TOP25raster =====+===== How to convert Netherlands Top25raster =====
  
-The Netherlands kartographic service PDOK offers topographic map Topo25raster for free.  These map are provided in geoTiff format in local coordinate system. Locus is not able to handle geoTiff format for this reason is needed to convert these data manually.+The Netherlands kartographic service PDOK offers topographic map Top25raster for free.  These maps are provided in geotiff format in local coordinate system. Locus Map is not able to handle geotiff format, therefore it is necessary to convert these data manually.
  
-<wrap info>This tutorial is prepared for Windows system but especially GDAL utilities work little bit better on Linux systems.</wrap>+<WRAP round  info>This tutorial is prepared for Windows system but especially GDAL utilities work little bit better on Linux systems.</WRAP>
  
 ==== Download data ==== ==== Download data ====
  
-  * Whole Netherland is devided into section – download section which is suitable for you +  * Whole Netherland is divided into sections – download section which is suitable for you 
-  * Dowload page: https://www.pdok.nl/nl/producten/pdok-downloads/basis-registratie-topografie/topraster/top25raster-d...+  * Download page: https://www.pdok.nl/nl/producten/pdok-downloads/basis-registratie-topografie/topraster/topraster-actueel/top25raster and other scales
  
 ==== Use GDAL for transformation ==== ==== Use GDAL for transformation ====
Line 47: Line 50:
  
   * For purpose of this tutorial download gdal http://www.gisinternals.com/sdk/PackageList.aspx?file=release-1600-gdal-1-10-0-mapserver-6-2-1.zip   * For purpose of this tutorial download gdal http://www.gisinternals.com/sdk/PackageList.aspx?file=release-1600-gdal-1-10-0-mapserver-6-2-1.zip
-  * Download  gdal-110-1600-core.msi installer+  * Download gdal-110-1600-core.msi installer
  
-=== Transform downloaded geotif ===+=== Transform downloaded geotiff ===
  
-  * Open command line (CMD) and go to the GDAL installation folder  (in our case cd C:\Program Files (x86)\GDAL) +  * Open command line (CMD) and go to the GDAL installation folder  (in our case C:\Program Files (x86)\GDAL) 
-  * Transform downloaded geoTiff into WGS84 system+  * Transform downloaded geotiff into WGS84 system
  
   set GDAL_DATA=.\gdal-data   set GDAL_DATA=.\gdal-data
   gdalwarp -t_srs EPSG:4326 44a-top25raster-2010.tif  44a-top25raster-2010-4326.tif   gdalwarp -t_srs EPSG:4326 44a-top25raster-2010.tif  44a-top25raster-2010-4326.tif
  
-=== Generate map using Mapc2Mapc into Locus format ===+===  Use Mapc2Mapc to generate map in a Locus-supported format ===
  
-  * Download and install SW Mapc2Mapc http://www.the-thorns.org.uk/mapping/down.htm+  * Download and install Mapc2Mapc http://www.the-thorns.org.uk/mapping/down.html
   * Start Mapc2mapc and set the location of gdal_translate   * Start Mapc2mapc and set the location of gdal_translate
     * Edit > Locate > GDAL_translate  (choose path to the installation folder of gdal)     * Edit > Locate > GDAL_translate  (choose path to the installation folder of gdal)
-  * Open transformed geoTiff+  * Open transformed geotiff
     * File > Load Calibrated map     * File > Load Calibrated map
   * Export file for Locus   * Export file for Locus
-    * File > Write map for Mobile  devices+    * File > Write map for Mobile devices
     * Choose Locus/RMAPS sqlitedb     * Choose Locus/RMAPS sqlitedb
     * Set zoom levels     * Set zoom levels
-    * optional: check Make tile  margins transparent +    * optional: check Make tile margins transparent 
-    * Press OK and confirm all zoom levels which will be generated+    * Press OK and confirm all zoom levels that will be generated
  
-=== Import map into Locus ===+=== Import map into Locus Map ===
  
   * Copy generated sqlitedb map into your device folder Locus/maps    * Copy generated sqlitedb map into your device folder Locus/maps 
-  * Start Locus+  * Start Locus Map
  
 === Red crosses === === Red crosses ===
  
-  * The demo version of mapc2mapc will add random red crosses over the map. This is limation of free/demo version+  * The demo version of Mapc2mapc will add random red crosses over the map. This is limitation of free/demo version
  
 {{:manual:advanced:map_tools:44a-top25raster-2010-4326.zip|}} {{:manual:advanced:map_tools:44a-top25raster-2010-4326.zip|}}
 +===== How To Convert Shp File For Locus =====
 +
 +==== Basic information ====
 +
 +Locus Map basically does not support SHP files at this moment. On the other hand there are some possibilities how to convert SHP to a different format that can be imported into Locus Map.
 +
 +==== Convert SHP file to KML ====
 +
 +Probably the easiest way of converting SHP file which is fully supported by Locus. Unfortunately there is a limitation in size of KML file. The **limit** for Locus Map is about **5000 – 10000 points** depending on your device. 
 +
 +  * Download free tool Shp2kml  [[http://www.zonums.com/files/Shp2kml.zip]]
 +  * Unzip and run shp2kml.exe
 +  * Select the file for conversion on the first screen 
 +{{ :manual:advanced:map_tools:shp2kml_select_file_for_convert.png?nolink |}}
 +  * Define color of lines/polygons
 +{{ :manual:advanced:map_tools:shp2kml_define_line_color.png?nolink |}}
 +  * Skip balloon definition screen
 +  * Define name of layers and description on the last screen 
 +{{ :manual:advanced:map_tools:shp2kml_layer_decription.png?nolink |}}
 +
 +  * Create KML file
 +  * Copy created KML file into Locus/mapItems
 +  * Run Locus Map and go to the [[manual:user_guide:items|Map Items]]
 +
 +{{ :manual:advanced:map_tools:shp2kml_kml_in_locus.png?nolink |}}
 +
 +==== Convert SHP to Mapsforge format ====
 +
 +In this example we expect that shp file for converting is very simple. Unfortunately converting is little bit tricky and requires a specific approach for particular SHP files. So it is not possible to say that this example could be used for every SHP file. 
 +
 +For this example we use free shp data (Czech Republic boundaries ) download-able at [[http://gadm.org/data/shp/CZE_adm.zip]]. 
 +
 +=== SHP file to OSM format ===
 +
 +There are lots of possibilities how to do it - see [[http://wiki.openstreetmap.org/wiki/Shapefiles]]. In this example we use [[http://merkaartor.be/|Merkaartor]] SW.
 +
 +  * Download Merkaartor [[http://merkaartor.be/wiki/merkaartor/Download]]
 +  * Run it and open SHP file for converting
 +  * Export OSM: File > Export > OSM (XML)
 +  * Note: Merkaartor place'' <bound>'' tag in the end of osm.xml file. You need to move it and place whole tag before first geometry element
 +
 +<code xml cze_adm.osm>
 +<?xml version="1.0"?>
 +<osm generator="Merkaartor 0.17" version="0.6">
 +   <bound box="48.540841,12.085860,51.054381,18.862533" origin="http://www.openstreetmap.org/api/0.6"/>
 +  <node version="0" lon="14.4138160" lat="49.2553340" timestamp="2013-04-28T10:55:33Z" user="" id="-1" actor="0"/>
 +...
 +...
 +...
 +
 +</code> 
 +
 +=== Mapsforge map writer plugin ===
 +
 +== Osmosis ==
 +  * Download and install osmosis 0.40.1 [[http://bretth.dev.openstreetmap.org/osmosis-build/osmosis-0.41.zip]]  
 +  * Note: there are newer versions of Osmosis but the Map writer plugin does not work properly with them
 +  * More details about Osmosis [[http://wiki.openstreetmap.org/wiki/Osmosis/Installation]]
 +  
 +== Map writer plugin ==
 +  * Download Mapwriter plugin [[http://ci.mapsforge.org/job/release-0.5.0/lastSuccessfulBuild/artifact/mapsforge-map-writer/build/libs/mapsforge-map-writer-0.5.0.jar|mapsforge-map-writer-0.5.0-jar]]
 +  * Copy downloaded plugin into Osmosis folder  //osmosis/plugins//
 +  * More about installing Map writer plugin: [[https://github.com/mapsforge/mapsforge/blob/master/docs/Getting-Started-Map-Writer.md#plugin-installation]] 
 +
 +== Define custom tags for generation of map file ==
 +  * Map writer plugin uses a XML file (tag-mapping.xml) that contains pairs of known tags for generation.  This xml  defines which OSM element will be included in the map file.
 +  * Use Merkaartor or arbitrary GIS/DBF viewer and decide which SHP attributes you want to export to the map file. 
 +  * For this example we create ''tag-mapping-shp.xml'' file based on tag ''_ENGTYPE_2_''
 +{{ :manual:advanced:map_tools:shp2mapsforge_shp_tag_value.png?nolink |}}
 +<code xml tag-mapping-shp.xml> 
 +<?xml version="1.0" encoding="UTF-8"?>
 +<tag-mapping xmlns="http://mapsforge.org/tag-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 + xsi:schemaLocation="http://mapsforge.org/tag-mapping ../resources/tag-mapping.xsd" default-zoom-appear="16"
 + profile-name="default-profile">
 +
 + <!-- CZE_ADM_2 -->
 + <ways>
 +     <osm-tag key="_ENGTYPE_2_" value="District" zoom-appear="4" force-polygon-line="true" />
 +            <osm-tag key="_ENGTYPE_2_" value="Statutory city" zoom-appear="4" force-polygon-line="true"/>
 + </ways>
 +</tag-mapping>
 +</code>
 +
 +== Generate map file ==
 +
 +  * Run generation
 +<code>
 +bin\osmosis.bat --read-xml cze_adm.osm --mapfile-writer file=cze_adm.osm.map type=ram tag-conf-file=tag-mapping-shp.xml bbox-enlargement=0
 +</code>
 +  * More information about generation and Mapwriter plugin [[https://github.com/mapsforge/mapsforge/blob/master/docs/Getting-Started-Map-Writer.md]]
 +
 +== Create vector theme for rendering ==
 +  * We’ve generated vector map and in next step we need to define appearance of geometry. Appearance is defined via theme XML.
 +  * You can edit any free theme for Locus or create new one which will be created especially for your SHP file.
 +  * Create theme xml  (in our case ''cze_adm_theme.xml'')
 + 
 +<code xml cze_adm_theme.xml>
 +<?xml version="1.0" encoding="UTF-8"?>
 +<rendertheme xmlns="http://mapsforge.org/renderTheme" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 + xsi:schemaLocation="http://mapsforge.org/renderTheme ../renderTheme.xsd" 
 + locus-extended="1" fill-sea-areas="0" version="1" map-background="#00FFFFFF">
 +
 + <!-- Render Boundaries -->
 +  <rule e="way" k="*" v="*">
 + <rule e="way" k="_ENGTYPE_2_" v="District" >
 +                        <line stroke="#FF3E96" stroke-width="4" />
 + </rule>
 + <rule e="way" k="_ENGTYPE_2_" v="Statutory city">
 + <line stroke="#B56904" stroke-width="4" />
 + </rule>
 + </rule>
 +</rendertheme>
 +</code>
 +
 +== Copy map and theme to the device ==
 +  * Copy vector map file ''cze_adm.osm.map'' into folder ''Locus/mapsVector''
 +  * Copy theme xml into folder ''Locus/mapsVector/_themes''
 +
 +
 +{{ :manual:advanced:map_tools:shp2mapsforge_converted_map.png?nolink |}}
 +
  
  
manual/advanced/map_tools/conversion.1431665647.txt.gz · Last modified: 2015/05/15 07:54 (external edit)