User:Kannix/vector-tiles

From OpenStreetMap Wiki
Jump to navigation Jump to search

fetch data

<osm-script timeout="900">
<union>
<union>
 <query type="way">
   <has-kv k="CEMT"/>
   <has-kv k="waterway"/>
   <bbox-query s="26.5" n="64.5" w="-8.7" e="57.5"/>
 </query>
 <query type="way">
   <has-kv k="motorboat" v="yes"/>
   <has-kv k="waterway"/>
   <bbox-query s="26.5" n="64.5" w="-8.7" e="57.5"/>
 </query>
 <query type="way">
   <has-kv k="canoe" v="yes"/>
   <has-kv k="waterway"/>
   <bbox-query s="26.5" n="64.5" w="-8.7" e="57.5"/>
 </query>
</union>
 <recurse type="way-node"/>
</union>
<print  mode="body"/>
</osm-script>
<osm-script timeout="1200">
  <union>
    <union>
      <query type="way">
        <has-kv k="CEMT"/>
        <has-kv k="waterway"/>
        <bbox-query s="26.5" n="64.5" w="-8.7" e="57.5"/>
      </query>
      <query type="way">
        <has-kv k="motorboat" v="yes"/>
        <has-kv k="waterway"/>
        <bbox-query s="26.5" n="64.5" w="-8.7" e="57.5"/>
      </query>
      <query type="way">
        <has-kv k="canoe" v="yes"/>
        <has-kv k="waterway"/>
        <bbox-query s="26.5" n="64.5" w="-8.7" e="57.5"/>
      </query>
      <query type="way">
        <has-kv k="boat"/>
        <has-kv k="waterway"/>
        <bbox-query s="26.5" n="64.5" w="-8.7" e="57.5"/>
      </query>
    </union>
    <recurse type="way-node"/>
    <query type="relation">
      <has-kv k="network" v="e-waterway"/>
    </query>
  </union>
  <print  mode="body"/>
</osm-script>

convert

osmtogeojson cemt_EU_2021.osm > cemt_EU_2021.geojson

set NODE_OPTIONS=--max-old-space-size=8192
osmtogeojson cemt_EU_2022.osm > cemt_EU_2022.geojson

generator

  • https://github.com/mapbox/tippecanoe
    • tippecanoe -o cemt_EU_2021_uc.mbtiles -B10 -xsource --no-tile-compression cemt_EU_2021.geojson
      • -B10 include all features at zomm level 10
      • -xsource drop feature 'source'
    • tippecanoe -o cemt_EU_2021_uc.mbtiles -B10 -xsource --no-tile-compression --drop-densest-as-needed cemt_EU_2021.geojson
    • --drop-densest-as-needed to drop some of the features

server

 "layers": {
   "cemt-vector-2021": {
     "provider": 
     {
       "name": "mbtiles", 
       "tileset": "/var/www/vhosts/grade.de/tiles.grade.de/cemt_EU_2021_uc.mbtiles"
     }
   }
 }

maplibreGL

preview

debugging vetor tiles

toDo

  • automatisation
    • download via overpass
    • conversion osm > geojson
    • mbtiles generation