OsmAnd/config/basemap
2011-06-20 23:14:01 +02:00
..
ogr2osm Second attempt of base map 2011-06-20 01:41:56 +02:00
README Fix issue 313, basemap 2011-06-20 23:14:01 +02:00
shp2osm.pl Implement base map layer. Fix some bugs 2011-06-20 01:41:56 +02:00

1. Find and install perl Geo-ShapeFile-2.52 
  cd Geo-ShapeFile-2.52/
  sudo perl Makefile.PL 
  make
  make test
USE smothness = 2

I. Make all 5  files
II. Merge them
III. Run Index Creator

I
-------------
Coastlines
1. Locate and run shp2osm.pl.
Example (replacing tags): perl ./shp2osm.pl 10m-coastline/10m_coastline.shp | sed 's/FeatureCla/natural/g;s/Coastline/coastline/g' > 10m_coastline.osm 
2. Fix manually all 180 degrees breaks (simply divide islands into 2 islands and add connect line on 180 degree) and make Antarctica cycled.
3. Run net.osmand.osm.util.FixLinkedCoastline from DataExtractionosm.jar with arg0=filename.
- Open JOSM -
4. !Fix manually Caspey Sea !
5. ! Check 2 ShriLanka islands (2 coastlines on one place)
6. ! Check North America for bug!
// 7. Run Index Creator.

-------------------------
admin level
Example (replacing tags): 
1. perl ./shp2osm.pl 10m-admin-0-countries/10m_admin_0_countries.shp |  sed 's/FeatureCla/admin_level/g;s/Adm-0 country/0/g;s/NAME/name/g'  > 10m_admin_level.osm
2. Open in JOSM and remove or fix antarctica
3. Run net.osmand.osm.util.FixAdminLevel0 from DataExtractionosm.jar with arg0=filename.
   To create country tag="place" value="country"
4. Open in Josm and simply save
// 5. Run Index Creator

-------------------------
cities/towns
Example (replacing tags): 
1. python ogr2osm/ogr2osm.py 10m-populated-places/10m_populated_places.shp
Creates 10m_populated_places.osm
2. less 10m_populated_places.osm | sed 's/MEGACITY/place/g;s/v="1"/v="city"/g;s/v="0"/v="town"/g;s/NAME/name/g'  > 10m_populated_places_out.osm
// 3. Run IndexCreator

-------------------------
lakes
Example (replacing tags): 
1. perl ./shp2osm.pl 10m-lakes/10m_lakes.shp  |  sed 's/FeatureCla/natural/g;s/Lake/lake/g;s/Reservoir/water/g;s/Name1/name/g'  > 10m_lakes.osm
Creates 10m_lakes.osm
2. Run net.osmand.osm.util.FixLinkedCoastline from DataExtractionosm.jar with arg0=filename.
3. Open in Josm and simply save
// 4. Run IndexCreator

-------------------------
rivers
Example (replacing tags): 
1. perl ./shp2osm.pl 10m-rivers-lake-centerlines/10m_rivers_lake_centerlines.shp  |  sed 's/FeatureCla/waterway/g;s/River/river/g;s/Name/name/g' > 10m_rivers.osm
Creates 10m_lakes.osm
2. Run net.osmand.osm.util.FixLinkedCoastline from DataExtractionosm.jar with arg0=filename.
3. Open in Josm and simply save
// 4. Run IndexCreator


--------------------------------------------------------------------------------
II Merging
BASH : 
  echo "<?xml version='1.0' encoding='UTF-8'?>" > basemap_1.osm;
  echo "<osm version='0.6' generator='JOSM'>" >> basemap_1.osm;

  cat 10m_coastline_out.osm   | sed -r "s/'-([0-9]*)'/'-\11'/" | tail -n+3 | sed 's/<\/osm>//' >> basemap_1.osm;
  cat 10m_admin_level_out.osm | sed -r "s/'-([0-9]*)'/'-\12'/" | tail -n+3 | sed 's/<\/osm>//' >> basemap_1.osm;
  cat 10m_populated_places_out.osm | xmllint --format - | sed -r 's/"-([0-9]*)"/"-\13"/' | tail -n+3 | sed 's/<\/osm>//' >> basemap_1.osm;
  cat 10m_rivers.osm          | sed -r "s/'-([0-9]*)'/'-\14'/" | tail -n+3 | sed 's/<\/osm>//' >> basemap_1.osm;
  cat 10m_lakes_out.osm       | sed -r "s/'-([0-9]*)'/'-\15'/" | tail -n+3 | sed 's/<\/osm>//' >> basemap_1.osm;
  echo '</osm>' >> basemap_1.osm;

TEST : 
  echo "<?xml version='1.0' encoding='UTF-8'?>" > basemap_1.osm;
  echo "<osm version='0.6' generator='JOSM'>" >> basemap_1.osm;


  echo '</osm>' >> basemap_1.osm;
  cat 10m_rivers.osm          | sed -r "s/'-([0-9]*)'/'-\14'/" | tail -n+3 | sed 's/<\/osm>//' >> basemap_1.osm;

READY : basemap_1.osm [1-3, 4-5,6-7].