User:Mrwojo/builtup_area.shp

From OpenStreetMap Wiki
Jump to navigation Jump to search
This was mostly written in 2013 and is at least somewhat outdated.

builtup_area.shp is a shapefile used by the main OSM.org style at zooms 8 and 9 to render light gray patches in built-up areas. It was originally added to the main style around 2008, back when it was still using Mapnik XML stylesheets.

The shapefile comes from the public domain VMAP0 dataset, which is urelated to OSM.

There has been a desire to replace this shapefile (see [1] and Github issues #256, #61). Because it's not OSM derived, it sometimes shows data that doesn't reflect what's in OSM. The data is noticeably outdated by 20+ years in some places. Look at Las Vegas, for instance, and compare it to NASA's convenient historical imagery GeoTIFFs for the area. I'm not aware that builtup_area.shp will ever be updated.

What is the need? From a cartographic standpoint this layer fills a niche at zoom 8-9 that would otherwise cause many urbanized areas to look like a hole among major natural features (mainly forests, woods, and deserts that start rendering at zoom 8) rather than an area of interest.

Replacement ideas

How should we replace builtup_area.shp? One (or more) of the following ideas are worth consideration.

Any replacement needs:

  1. precision appropriate for z8-9 (not too high, not too low)
  2. convenient maintenance
  3. and if from a non-OSM source:
    1. up-to-date data
    2. acceptable licensing

Raster-vector idea

Rasterize the gray features that appear at z10 and then convert the resulting raster into a shapefile. The approach I tried created a large 1-bit geotiff, applied a morphological smooth to eliminate small islands and gaps, then polygonized the raster into a vector, and finally used a vector smooth like Chaikin's algorithm to produce "humanized" polygons. This would probably then need large water features to be cut out.

Pros: Uses techniques that are familiar to rendering (e.g., Mapnik could be used to produce the mega-tiff).

Cons: Might not scale well. Someone has to update this shapefile periodically.

Vector idea

Similar to the raster-vector idea except the process is done entirely with vector data that's then placed into a shapefile. Morphological smoothing can be mimicked with vectors by performing a buffer followed by an inverse buffer operation.

Pros: Straightforward approach.

Cons: Vector union/dissolve operations are expensive and scale poorly (a cascaded union on Las Vegas took 18 minutes on my computer). Someone has to update this shapefile periodically.

Baked queries

Query large built-up features from an OSM database, simplify the geometry, save the result as a shapefile. (Large meaning relative to the map, such as >5% the area of a pixel at its latitude at z8.)

Pros: Straightforward to implement and for users to understand. Same basic approach as coastlines (see OSMCoastline).

Cons: May not work well for certain data patterns (e.g., shanty towns culled if all objects are small); someone has to update this shapefile periodically; reduces query time more so than rendering time.

Render more gray things at z9 and reduce the "hole" effect at z8

  1. Start rendering major "built up" landuses at z9 instead of z10. That would be residential, industrial, commercial, and retail.
  2. Tone down the more vibrant landcovers that first appear at z8. That'd be landuse=forest and natural=desert. (Changed in 2015: [2], [3].)

These two changes smooth the progression from z7 to z10. At z8, the toned-down forests and deserts won't create such a strong negative space at built-up areas and major built features pop out more (labels, highways, railways). At z9, urban landuses appear. At z10, minor roads and a slew of other landuses appear.

Zoom Current Proposed
8
  • vibrant forests and deserts appear (woods also appear)
  • builtup_area.shp appears in light gray
  • forests and deserts appear in less vibrant tones (woods also appear)
  • no builtup_area.shp
9
  • largely the same as z8
  • urban landuses appear
10
  • builtup_area.shp stops appearing
  • minor roads appear (changed in 2015)
  • many landuses appear
  • minor roads appear (changed in 2015)
  • several less common landuses appear

Pros: Takes advantage of data and techniques that are already in use. No need for an extra shapefile to be maintained.

Cons: What's the cost of rendering those landuses at z9?

Find a new source

Find a new shapefile to show built-up areas. This is contingent on such a shapefile existing, which may not be the case.

  • Natural Earth has an Urban Areas map "[d]erived from 2002-2003 MODIS satellite data at 1 km resolution". The areas that I examined in it were too "blobby" and imprecise to be a drop in replacement for builtup_area.shp.
  • "A new map of global urban extent from MODIS satellite data" provides an overview of relevant datasets that could be used to construct a new shapefile

Pros: Potential for drop-in replacement

Cons: Continued dependency on non-OSM data

Remove, don't replace with anything

Simply remove builtup_area.shp and replace it with nothing. Major roads and railways combined with place labels will indicate that there's human development at a location.

Pros: Simplest.

Cons: This is a regression for many existing areas.

Further reading

User:Imagico wrote about this issue in 2014 and recommended a procedure based on OSM data.