protomaps / basemaps

Basemap PMTiles generation and cartographic styles for OpenStreetMap data and more
https://maps.protomaps.com/
Other
301 stars 40 forks source link

Landcover #154

Open bdon opened 8 months ago

bdon commented 8 months ago

Description We want a landcover layer at low zooms from https://daylightmap.org/2023/10/11/landcover.html

Screenshots Here are some rough previews:

Screenshot 2023-10-13 at 10 17 34 Screenshot 2023-10-13 at 10 17 19

@nvkelso should we put the 7 daylight landcover classes into https://tilezen.readthedocs.io/en/latest/layers/ or invent new kind values?

Barren / Snow / Crop / Shrub / Grass / Forest / Urban

nvkelso commented 8 months ago

The more OSM-y / Tilezen-y kind values might be (which already in Tilezen have both detailed and generic aggregations and segmentations), where (data value), blog label > proposed Tilezen kind value:

Then on zoom-in, the OSM data can be used instead, with the current OSM derived value moving to kind_detail, and these rollup values used for kind?

In the blog post another class was also mentioned, but the download doesn't have it:

See also:

wipfli commented 8 months ago

@nvkelso desert might be not ideal for esa's "Bare / sparse vegetation" because this landcover type is not only used in real deserts like the Sahara, but also wet mountain areas. For example, the Alps go from "Grass" to "Bare / sparse vegetation" to "Snow and Ice" with increasing altitude...

daniel-j-h commented 8 months ago

Hey folks I gave the Daylight landcover data a try even before we have it integrated properly. If anyone wants to follow along, here's how to get it into a .pmtiles file and the cevtor tiles styled on a Maplibre map.

Download the shapefile

$ aws s3 sync s3://daylight-openstreetmap/landcover/ . --no-sign-request

Convert to GeoJSON to check it out and to convert it to a .pmtiles file later on

$ ogr2ogr -f GeoJSON landcover.geojson low.shp

$ jq '.features[].properties.class' landcover.geojson | sort | uniq
"barren"
"crop"
"grass"
"shrub"
"snow"
"trees"
"urban"

Use tippecanoe to convert the GeoJSON file to a .pmtiles file

$ tippecanoe -o landcover.pmtiles -zg -n "Daylight Landcover" -N "https://daylightmap.org/2023/10/11/landcover.html" landcover.geojson

Host the .pmtiles on a static host; I have S3 + Cloudfront set up but your use-case might differ

aws s3 cp --cache-control 'public, max-age=30758400, immutable' --content-type 'binary/octet-stream' landcover.pmtiles s3://.../20231024/landcover.pmtiles

Add the source to a Maplibre map and style the landcover layer based on the landcover classes from above.

sources: {
  landcover: {
    type: "vector",
    url: "pmtiles://https://example.com/landcover.pmtiles",
    attribution: "<a href='https://daylightmap.org/2023/10/11/landcover.html'>Daylight</a>" },
    maxzoom: 8,
},
map.addLayer({
  id: "landcover",
  type: "fill",
  source: "landcover",
  "source-layer": "landcover",
  maxzoom: 10,
  layout: {},
  paint: {
    "fill-opacity": [
      "interpolate",
      ["linear"],
      ["zoom"],
      0, 0.5,
      10, 0
    ],
    "fill-color": ["case",
      ["==", ["get", "class"], "barren"], "#a48137",
      ["==", ["get", "class"], "crop"], "#efc52e",
      ["==", ["get", "class"], "grass"], "#afe57f",
      ["==", ["get", "class"], "shrub"], "#dbf4c2",
      ["==", ["get", "class"], "snow"], "#f1eff7",
      ["==", ["get", "class"], "trees"], "#1c4321",
      ["==", ["get", "class"], "urban"], "#f1eff7",
      "#ffffff"]
  },
}, "physical_line_waterway_label"); // before first label layer

Results look as follows - I'm not a designer tho, please no hate :stuck_out_tongue:

landcover1 landcover2
nvkelso commented 3 months ago

Our approach here will start small:

Other data reviewed include:

bdon commented 3 months ago

Tileset part merged in tiles 3.5.0; TODO style additions

daniel-j-h commented 2 months ago

Meta is sun-setting the Daylight distribution in favor of Overture Maps

https://daylightmap.org/2024/05/03/sunsetting-daylight.html

If we want to use their landcover data we now need to check out the Overture Maps data.

bdon commented 1 month ago

We have this mirrored at https://r2-public.protomaps.com/datasets/daylight-landcover.gpkg , and don't expect the data to change quickly, so we should be isolated from this deprecation for a while... if/when we need to improve the data we can use a from-scratch ESA generated tileset or Overture.