From OpenStreetMap Wiki
Jump to navigation Jump to search

I'm OSM user avena701. I can read and write German, English and Danish.

Overpass queries

POI overpass extract, new

  • Overpass: XML, Metadata (version etc.) required for osmosis
  • osmosis --read-xml file="export.osm" --sort type="TypeThenId" --write-xml file="campsite.osm" &&
  • osmconvert campsite.osm --all-to-nodes -o=campsitenodes.osm &&
  • osmfilter campsitenodes.osm --keep-nodes="*" -o=campsite.osm &&
  • ./ campsite.osm campsite.gpx


  • campsite
{{tagspec1= "tourism"~"camp_site|caravan_site"}}
  • motelhotelhostlguesthouse
{{tagspec1= "tourism"~"motel|hotel|hostel|guest_house"}}
  • Accomodation other
{{tagspec1= "tourism"~"alpine_hut|apartment|chalet|wilderness_hut"}}

Export raster map with tillmill from command line

Octave-Script to calculate bounding box for tilemill from center (lon,lat), zoomlevel and scalefactor:

lon = 13.74921;
lat = 51.07545;
z = 16; %zoomlevel
sf = 3; %scalefactor
width= 18000  %256*sf;
height= 3200 %256*sf; 

C = 40040;  % the (equatorial) circumference of the Earth

londegree_per_pixel = 360 / 2^(8+z)*cos(lat/180*pi) / sf;
latdegree_per_pixel = 180 / 2^(8+z) / sf;

xmin = lon - width/2  * londegree_per_pixel;
ymin = lat - height/2 * latdegree_per_pixel;
xmax = lon + width/2  * londegree_per_pixel;
ymax = lat + height/2 * latdegree_per_pixel;

% out
outcmd = sprintf('node ~/tilemill/index.js export openstreetmap-carto --format png --bbox="%f,%f,%f,%f" --width %d --height %d  --scale %f bellabike.png\n', xmin,ymin,xmax,ymax,width,height,sf);

biketrekkingmap: Mapnik hill-shading, contours

  • osm2pgsql -s -d gis -U gisuser --style ~/Documents/MapBox/project/osmcarto2_32_0_hill/ ~/Downloads/DD_13.614\,50.971_13.868\,51.134.osm.pbf

( standard style, uncomment line "way network text linear" for route-network)

gdalwarp srtm_42_02.tif srtm_42_03.tif srtm_41_02.tif srtm_41_03.tif ua-srtm.tif
  • Reproject:
gdalwarp -s_srs EPSG:4269 -t_srs EPSG:3785 -r bilinear ua-srtm.tif ua-srtm-3785.tif
  • Hillshade: Change standard sun altitude
gdaldem hillshade -co compress=lzw -alt 25 ua-srtm-3785.tif ua-srtm-3785-hillshade.tif
  • Create overviews to improve performance:
gdaladdo -r average ua-srtm-3785-hillshade.tif 2 4 8 16 32
gdal_contour -a elev -i 25 ua-srtm-3785.tif ua-srtm-3785.shp
  • Beware with Tilemill Geometry Field pre-caching. Set to custom -20037508.34,-20037508.34,20037508.34,20037508.34 (whole world).
mb-util uabike.mbtiles uabike

Dresden tiles

  • Installe node version manager (nvm) and switch to node v6.14.1 (node-mapnik doesn't provide binaries for newest node)
  • Create ~/kosmtik, go there and
npm install kosmtik
cd ~/src/kosmtik
node index.js export ~/Documents/kosmtik/openstreetmap-carto-4.9.0/project.mml --output=/home/nils/Documents/kosmtik/export --format tiles --maxZoom 17 --minZoom 5 --bounds="13.346,50.249,14.872,51.237"
  • Delete empty tiles
find . -name "*.png" -size 857c -delete
  • Compress png
find -type f -name "*.png" -exec optipng {} \

MOBAC / MyTrails

  • edit mapsources/localtiles.xml
  • enter "MyTrails" as name
  • click New, choose a atlas name, Type MGMaps/Mytrails (MGM)
  • Settings, Map Size: increase the map size
  • add a selection (can be larger than area where tiles are available)
  • go

Reprojecting, georeferencing and generating tiles for a slippy map

  • Source: Map of city, PDF, WGS84 Zone 33N
  • Destination: Tiles for standard slippy map, Google Web Mercator