User:Kannix/seamark-vector-tiles

From OpenStreetMap Wiki
Jump to navigation Jump to search

preview

aim

  • cheap production of OSM seamark-vector-tiles

download data

https://overpass-turbo.eu

  • run query
[out:json][timeout:25];
// gather results
nw["seamark:type"](54.63728692308161,9.953441619873049,54.70786281130243,10.096263885498049);
// print results
out geom;
  • save as .geoJSON and process with tippecanoe ...

https://josm.openstreetmap.de/

[out:xml][timeout:90][bbox:(bbox={{{minlon}}},{{{minlat}}},{{{maxlon}}},{{{maxlat}}})];
(
 nwr["seamark:type"];
);
(._;>;);
out meta;
  • save as .osm.pbf and process with tilemaker

make vector-tiles

https://github.com/mapbox/tippecanoe

CMD
tippecanoe -o schleimuendung_uc.mbtiles -B10 -xsource --no-tile-compression --drop-densest-as-needed schleimuendung.geojson

https://github.com/systemed/tilemaker

CMD
tilemaker --config config-seamarks.json --process process-seamarks.lua --input schleimuendung.osm.pbf --output schleimuendung_tilemaker.mbtiles
config-seamarks.json
{
 "layers": {
   "anchorage":{ "minzoom":  0, "maxzoom": 14 },
   "anchor_berth":{ "minzoom":  0, "maxzoom": 14 },
   "beacon_cardinal":{ "minzoom":  0, "maxzoom": 14 },
   "beacon_isolated_danger":{ "minzoom":  0, "maxzoom": 14 },
   "beacon_lateral":{ "minzoom":  0, "maxzoom": 14 },
   "beacon_safe_water":{ "minzoom":  0, "maxzoom": 14 },
   "beacon_special_purpose":{ "minzoom":  0, "maxzoom": 14 },
   "berth":{ "minzoom":  0, "maxzoom": 14 },
   "bridge":{ "minzoom":  0, "maxzoom": 14 },
   "bunker_station":{ "minzoom":  0, "maxzoom": 14 },
   "building":{ "minzoom":  0, "maxzoom": 14 },
   "buoy_cardinal":{ "minzoom":  0, "maxzoom": 14 },
   "buoy_installation":{ "minzoom":  0, "maxzoom": 14 },
   "buoy_isolated_danger":{ "minzoom":  0, "maxzoom": 14 },
   "buoy_lateral":{ "minzoom":  0, "maxzoom": 14 },
   "buoy_safe_water":{ "minzoom":  0, "maxzoom": 14 },
   "buoy_special_purpose":{ "minzoom":  0, "maxzoom": 14 },
   "cable_area":{ "minzoom":  0, "maxzoom": 14 },
   "cable_overhead":{ "minzoom":  0, "maxzoom": 14 },
   "cable_submarine":{ "minzoom":  0, "maxzoom": 14 },
   "causeway":{ "minzoom":  0, "maxzoom": 14 },
   "checkpoint":{ "minzoom":  0, "maxzoom": 14 },
   "coastguard_station":{ "minzoom":  0, "maxzoom": 14 },
   "communication_area":{ "minzoom":  0, "maxzoom": 14 },
   "crane":{ "minzoom":  0, "maxzoom": 14 },
   "control_point":{ "minzoom":  0, "maxzoom": 14 },
   "daymark":{ "minzoom":  0, "maxzoom": 14 },
   "distance_mark":{ "minzoom":  0, "maxzoom": 14 },
   "dredged_area":{ "minzoom":  0, "maxzoom": 14 },
   "dumping_ground":{ "minzoom":  0, "maxzoom": 14 },
   "exceptional_structure":{ "minzoom":  0, "maxzoom": 14 },
   "fairway":{ "minzoom":  0, "maxzoom": 14 },
   "ferry_route":{ "minzoom":  0, "maxzoom": 14 },
   "wall":{ "minzoom":  0, "maxzoom": 14 },
   "fog_signal":{ "minzoom":  0, "maxzoom": 14 },
   "fortified_structure":{ "minzoom":  0, "maxzoom": 14 },
   "fishing_facility":{ "minzoom":  0, "maxzoom": 14 },
   "gate":{ "minzoom":  0, "maxzoom": 14 },
   "gridiron":{ "minzoom":  0, "maxzoom": 14 },
   "harbour_basin":{ "minzoom":  0, "maxzoom": 14 },
   "harbour":{ "minzoom":  0, "maxzoom": 14 },
   "hulk":{ "minzoom":  0, "maxzoom": 14 },
   "inshore_traffic_zone":{ "minzoom":  0, "maxzoom": 14 },
   "landmark":{ "minzoom":  0, "maxzoom": 14 },
   "light":{ "minzoom":  0, "maxzoom": 14 },
   "light_major":{ "minzoom":  0, "maxzoom": 14 },
   "light_minor":{ "minzoom":  0, "maxzoom": 14 },
   "light_float":{ "minzoom":  0, "maxzoom": 14 },
   "light_vessel":{ "minzoom":  0, "maxzoom": 14 },
   "lock_basin":{ "minzoom":  0, "maxzoom": 14 },
   "marine_farm":{ "minzoom":  0, "maxzoom": 14 },
   "military_area":{ "minzoom":  0, "maxzoom": 14 },
   "mooring":{ "minzoom":  0, "maxzoom": 14 },
   "navigation_line":{ "minzoom":  0, "maxzoom": 14 },
   "notice":{ "minzoom":  0, "maxzoom": 14 },
   "obstruction":{ "minzoom":  0, "maxzoom": 14 },
   "oil_barrier":{ "minzoom":  0, "maxzoom": 14 },
   "platform":{ "minzoom":  0, "maxzoom": 14 },
   "production_area":{ "minzoom":  0, "maxzoom": 14 },
   "pilot_boarding":{ "minzoom":  0, "maxzoom": 14 },
   "pile":{ "minzoom":  0, "maxzoom": 14 },
   "pipeline_area":{ "minzoom":  0, "maxzoom": 14 },
   "pipeline_overhead":{ "minzoom":  0, "maxzoom": 14 },
   "pipeline_submarine":{ "minzoom":  0, "maxzoom": 14 },
   "pontoon":{ "minzoom":  0, "maxzoom": 14 },
   "precautionary_area":{ "minzoom":  0, "maxzoom": 14 },
   "pylon":{ "minzoom":  0, "maxzoom": 14 },
   "radar_line":{ "minzoom":  0, "maxzoom": 14 },
   "radar_range":{ "minzoom":  0, "maxzoom": 14 },
   "radar_reflector":{ "minzoom":  0, "maxzoom": 14 },
   "radar_transponder":{ "minzoom":  0, "maxzoom": 14 },
   "radar_station":{ "minzoom":  0, "maxzoom": 14 },
   "calling-in_point":{ "minzoom":  0, "maxzoom": 14 },
   "radio_station":{ "minzoom":  0, "maxzoom": 14 },
   "recommended_route_centreline":{ "minzoom":  0, "maxzoom": 14 },
   "recommended_track":{ "minzoom":  0, "maxzoom": 14 },
   "recommended_traffic_lane":{ "minzoom":  0, "maxzoom": 14 },
   "rescue_station":{ "minzoom":  0, "maxzoom": 14 },
   "restricted_area":{ "minzoom":  0, "maxzoom": 14 },
   "retro_reflector":{ "minzoom":  0, "maxzoom": 14 },
   "sand_waves":{ "minzoom":  0, "maxzoom": 14 },
   "seabed_area":{ "minzoom":  0, "maxzoom": 14 },
   "sea_area":{ "minzoom":  0, "maxzoom": 14 },
   "seagrass":{ "minzoom":  0, "maxzoom": 14 },
   "seaplane_landing_area":{ "minzoom":  0, "maxzoom": 14 },
   "tank":{ "minzoom":  0, "maxzoom": 14 },
   "shoreline_construction":{ "minzoom":  0, "maxzoom": 14 },
   "signal_station_traffic":{ "minzoom":  0, "maxzoom": 14 },
   "signal_station_warning":{ "minzoom":  0, "maxzoom": 14 },
   "small_craft_facility":{ "minzoom":  0, "maxzoom": 14 },
   "spring":{ "minzoom":  0, "maxzoom": 14 },
   "submarine_transit_lane":{ "minzoom":  0, "maxzoom": 14 },
   "topmark":{ "minzoom":  0, "maxzoom": 14 },
   "separation_boundary":{ "minzoom":  0, "maxzoom": 14 },
   "separation_crossing":{ "minzoom":  0, "maxzoom": 14 },
   "separation_lane":{ "minzoom":  0, "maxzoom": 14 },
   "separation_line":{ "minzoom":  0, "maxzoom": 14 },
   "separation_roundabout":{ "minzoom":  0, "maxzoom": 14 },
   "separation_zone":{ "minzoom":  0, "maxzoom": 14 },
   "turning_basin":{ "minzoom":  0, "maxzoom": 14 },
   "two-way_route":{ "minzoom":  0, "maxzoom": 14 },
   "rock":{ "minzoom":  0, "maxzoom": 14 },
   "vegetation":{ "minzoom":  0, "maxzoom": 14 },
   "virtual_aton":{ "minzoom":  0, "maxzoom": 14 },
   "vehicle_transfer":{ "minzoom":  0, "maxzoom": 14 },
   "water_turbulence":{ "minzoom":  0, "maxzoom": 14 },
   "waterway_gauge":{ "minzoom":  0, "maxzoom": 14 },
   "weed":{ "minzoom":  0, "maxzoom": 14 },
   "wreck":{ "minzoom":  0, "maxzoom": 14 },
   "zzzz":{ "minzoom":  0, "maxzoom": 14 }
 },
   "settings": {
       "minzoom": 4,
       "maxzoom": 14,
       "basezoom": 14,
       "include_ids": true,
       "name": "Tilemaker Seamaks",
       "version": "0.1",
       "description": "Sample vector tiles by Kannix",
       "compress": "none"
   }
}
process-seamarks.lua
-- Nodes will only be processed if one of these keys is present
node_keys = { "seamark:type" }

-- enter/exit Tilemaker ---------
function init_function()
end

function exit_function()
end

-- https://github.com/systemed/tilemaker/discussions/376 --
function TrySetAttribute(obj, name)
 local value = Find(name)
 if value~="" then
   Attribute(name, value)
   print(name)
   print(value)
 end
end

function FindTag(obj, tags)
 for _,tag in pairs(tags) do
   local value = Find(tag)
   if value~="" then
     return tag, value
   end
 end
 return nil, nil
end

-- Assign nodes to a layer, and set attributes, based on OSM tags
function node_function(node)
 local obj_type, obj = FindTag(node, {"seamark:type"})
 if obj~="" then 
   -- set layer --
   Layer(obj)
   -- copy attributes --
   for _,attr in pairs(AllKeys()) do
     TrySetAttribute(node, attr)
   end
 end
end

serve vector-tiles

style vector-tiles

inspiration

discussion