Creating base maps for Weather data visualization
We have some specific needs for when various data sets are shown to users. Those are:
- Roads at a lower zoom (more zoomed out) - Vaisala Xweather provides best in the world road weather modeling and having an overview available in a map is beneficial
- Electrical Infrastructure - We help protect and model various parts of energy infrastructure and we need to show this information in a visual way.
- Provide a way to create high-resolution spatial subsets of data. For example, from zoom 8 to 14 for a specific area.
- Import other data sets with different licensing, like Natural Earth
Following our standard Xweather approach - how can we make data make sense at each processing step?
- Importing data into Postgres
- Prefix data with source ID like
osm_
,natearth_
, etc - Analyze data - use the
THEMEPARK_DEBUG=on
flag to import all properties into the DB into anHSTORE
type hash column (all keys and values are strings! Value can be NULL)- For each database, iterate over each key/value pair in the tags HSTORE column and run stats on it - # of unique values, number of nulls, top 10 frequent values
- Iterate and decide which values to store directly in the DB for this application
- Prefix data with source ID like
- Create QGIS viewing style to view all layers and properties
- Create Tegola views for each use case
- Run pmtiles import to pull from Tegola and create an output pmtiles for the map.
Under the hood, this is a Postgres database. Features with different values we want to keep, need to go into different tables. When querying features back out, we can transform that data further, only selecting what we want at each step.
There are a lot of tools, we have found:
- osm2pgsql - Seemingly recommended by Open Street Maps group, imports data to a postgres database
- planetiler - A large java project that dumps directly to pmtiles. It's fast, goes right into tiles
- pmtiles uses this for their generation https://github.com/protomaps/basemaps
- imposm3 - Dies during large global imports, has Go segfaults
OpenStreetMap data can be presented in any way, it's just polygons, lines, and points with metadata. There are some existing conventions on how to present that data, however:
-
OpenMapTiles Layer Schema (OMT)
- Layer list:
aerodrome_label
aeroway
boundary
building
globallandcover
housenumber
landcover
landuse
mountain_peak
park
place
poi
transportation
transportation_name
water
water_name
waterway
- An example Tegola file: https://github.com/dechristopher/tegola-omt/blob/master/config.toml
- Seth's Opinion
- things they do well:
- Water stuff - putting together oceans + lakes, separating out streams into waterway
- landcover and landuse - see https://oceanservice.noaa.gov/facts/lclu.html
- aeroway is everything airports/heliports
- globallandcover is a nice zoomed out representation of forest, scrub, farmland
- mountainpeak - Ridges and points identifying mountain features
- Names for busy layers, like transportation, are separated into a different layer
- sillythings
- housenumber is a bad name, it's addresses
- aerowaydromes (airport areas) are really landuse aeren't they?
- parks should be landuse
- mountain_peak could be a sub type in poi
- Place vs poi is confusing
- things they do well:
- Layer list:
-
- This is a popular format like on Pmtiles' Demo Page
-
- This is a published spec of how the data is separated and layered, a spec is better than no spec.
- Seth's Opinion - These guys split all sorts of things in kind of weird ways...
-
- Layer List:
- admin
- aeroway
- airport_label
- building
- depth
- hillshade
- housenum_label
- landcover
- landuse
- landuse_overlay - Just national-park
- motorway_junction
- natural_label
- place_label
- poi_label
- road
- structure
- transit_stop_label
- water
- waterway
- Layer List:
- Tegola - Query for layers from a postgis database and organize layers
- Make a gen for larger buildings
- Make a gen for sites
- Move terminal to buildings
- Move aerodrome pavements and stuff to "land", taxiways and stuff