Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Landcover #154

Open
bdon opened this issue Oct 16, 2023 · 5 comments
Open

Landcover #154

bdon opened this issue Oct 16, 2023 · 5 comments
Assignees

Comments

@bdon
Copy link
Member

bdon commented Oct 16, 2023

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
Copy link
Collaborator

nvkelso commented Oct 16, 2023

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:

  • (urban) Urban > urban_area
  • (crop) Crop > farmland
  • (grass) Grass > grassland
  • (shrub) Shrub > scrub
    • note this is is slightly different than the remapping in queries.yaml, but is a good enhancement based on my experience the last 3 years
  • (barren) Barren > barren (was initially desert, updated based on comments and further research)
    • based on the viewer link below, this is desert. An alternative value is barren
    • Tilezen already uses barren for low zoom consolidation of detailed classes, so fair game
  • (trees) Forest > forest
  • (snow) Snow > glacier (these are glaciers and permanent snow fields)

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:

  • Water > ¿¿¿ wetland or water ???
    • based on the viewer link below, could be either...
    • based on the download and closer reading of blog post, this was either NE or OSM water used as a masking knockout, so we ignore it.
    • So if there isn't a polygon in the data layer, it's assumed to be water

See also:

@wipfli
Copy link
Sponsor

wipfli commented Oct 16, 2023

@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
Copy link

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 😛

landcover1 landcover2

@nvkelso
Copy link
Collaborator

nvkelso commented Mar 28, 2024

Our approach here will start small:

  • Add a new layer called landcover (that will complement the existing landuse layer).
  • We'll use this data from Daylight here
    • Because this Daylight data doesn't change with each release
    • We'll converted to GeoPackage format, and
    • Posted to a public Protomaps web assets location to make use of that format's spatial indexing in Planetiler
  • We'll do light mapping of the raw Daylight data values into the Tilezen values mentioned above.
    • This will also make it more future proof if new data is sourced later and that new source has slightly different value conventions.
  • This will yield low zoom coverage only (eg to zoom 6/7/8 before it looks chunky / pixelated.
    • Styling should fade the layer out over those zooms.
    • Styling should also consider the z-order of these new landcover feature versus landuse.
  • At this time we won't be moving any existing OSM related features in the landuse layer to the new landcover layer as that would be a breaking change.

Other data reviewed include:

  • @wipfli's ESA worldcover polygons which goes to a higher zoom detail, but at cost of much larger data size.
  • Esri/NationalGeographic/Microsoft's Sentinel-2 10m Land Use/Land Cover Time Series which has better classification algo (like for for shrubland in US desert south-west) and goes to 10 meters, but would require a similar rasterization approach that @wipfli took and have large data size.
  • If Planetiler adds GeoParque support, that could unblock this. Otherwise the build data dependencies would overwhelm making some cuts of say Monaco or Switzerland.

bdon added a commit that referenced this issue Mar 28, 2024
* Use geopackage mirror of daylight dataset from https://daylightmap.org/2023/10/11/landcover.html
* remap daylight classes to tilezen-like kinds
bdon added a commit that referenced this issue Apr 6, 2024
* Use geopackage mirror of daylight dataset from https://daylightmap.org/2023/10/11/landcover.html
* remap daylight classes to tilezen-like kinds
bdon added a commit that referenced this issue Apr 6, 2024
* add daylight landcover to tileset [#154]
* Use geopackage mirror of daylight dataset from https://daylightmap.org/2023/10/11/landcover.html
* remap daylight classes to tilezen-like kinds
* tiles 3.5.0, changelog
@bdon
Copy link
Member Author

bdon commented Apr 6, 2024

Tileset part merged in tiles 3.5.0; TODO style additions

bdon added a commit that referenced this issue Apr 6, 2024
* order landcover by kind consistently in tileset [#154]
bdon added a commit that referenced this issue Apr 6, 2024
* bump pmtiles version

* tiles 3.5.1

* order landcover by kind consistently in tileset [#154]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants