wipfli / blur-buildings

Blur building footprints to create landcover polygons for built-up areas
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Median blur #6

Open wipfli opened 1 year ago

wipfli commented 1 year ago

buildings-14-47-8-blur- png

image

wipfli commented 1 year ago
{
    "version": 8,
    "name": "SwissMap style",
    "sources": {
        "swissmap": {
            "type": "vector",
            "url": "https://wipfli.github.io/swiss-map/tilejson-swissmap.json"
        }
    },
    "layers": [
        {
            "id": "building",
            "type": "fill",
            "source": "swissmap",
            "minzoom": 14,
            "source-layer": "building"
        }
    ],
    "id": "swissmap-style"
}
# maplibre gl native
./build/bin/mbgl-render --style style.json --output out.png --zoom 14 --lat 47.36811 --lon 8.54936 --width 6000 --height 6000

out

out-median-blur

roughly with

image

wipfli commented 1 year ago

With a little bit of Douglas Peucker looks like this:

image

wipfli commented 1 year ago

Oberhof with 3 different tolerances (5, ?, 100) in Douglas Peucker simplification:

wipfli commented 1 year ago

Strategy for landcover polygons from building footprints could be:

  1. render buildings at z14 to raster tile
  2. blur raster tile with median blur
  3. threshold raster tile
  4. polygonize raster tile
  5. simplify polygons with a low Douglas Peucker tolerance
  6. store polygons
  7. repeat for a different tile

Questions:

wipfli commented 1 year ago

Tile edge effect: looks like median blur can handle edges fine...

Probably just make sure that tiles overlap sufficiently.