Skip to content

Latest commit

 

History

History
113 lines (65 loc) · 4.81 KB

README.md

File metadata and controls

113 lines (65 loc) · 4.81 KB

Code to generate the 3D city model of Singapore public housing (HDB) buildings

Urban Analytics Lab, National University of Singapore

Data

The data in CityJSON and OBJ is available on the other Github repository.

Disclaimer

The code is very experimental and in an early stage. There are still many things to improve.

Input data

You need to download the input datasets:

and place them in the _data/ directory.

Method

The method is conceptually straightforward: OSM footprints are extruded to a height estimated from the number of storeys available in the HDB open dataset. However, the implementation is not that straightforward because of the different datasets involved and difficulties in linking them.

OSM does not have addresses for about half of HDB blocks in Singapore, so it is not possible to easily associate the address from the HBD dataset to a corresponding feature in OSM (geocoding fails in half of the cases or it associates a wrong feature).

The open dataset on buildings from the URA Master Plan 2014 could have been used, but it does not contain all buildings and it does not contain addresses.

Therefore it was required to use a geocoder (for each address a point in lat/lon is retrieved and then the corresponding feature in OSM can be found with a point in polygon operation). But this is not without issues either: Google Maps does not have a free API anymore, and OneMap (which was eventually used) sometimes returns a point that is outside the corresponding polygon in OSM (since their footprints don't always perfectly correspond). These discrepancies caused a few errors.

How to run the code

osmtogeojson singapore-latest.osm.pbf > singapore-latest.geojson

  • Geocoding is the first step

python3 gc.py

  • Fetch the OSM polygon (may take some time, 7-8 hours)

python3 hdbosm.py

  • Export 2D polygons into GeoJSON with all the attributes from OSM and HDB

python3 hdb2d.py

  • Reproject to Singapore CRS (EPSG:3414)

ogr2ogr -f "GeoJSON" _data/footprints_r.geojson _data/footprints.geojson -s_srs EPSG:4326 -t_srs EPSG:3414

  • Extrude polygons to 3D (code mostly courtesy of cityjson-software) and output a CityJSON dataset with

python3 hdb3d.py

  • Optional: Upgrade the dataset to CityJSON v 1.0

cjio _data/hdb.json upgrade_version save _data/hdb.json

  • Optional: Export to OBJ

cjio _data/hdb.json export _data/hdb.obj

Output

The workflow produces CityJSON and OBJ files. A byproduct of the process is a GeoJSON 2D dataset of HDB footprints. The files can be downloaded from the data repository.

This is an example of the data rendered in Blender:

It isn't too difficult to also visualise them in Mapbox:

CityJSON and OBJ files are supported by many different software packages.

Citation/credit

If using the code and data, please mention the following data sources: NUS Urban Analytics Lab, HDB Singapore, OpenStreetMap contributors, and OneMap. If you are using it for a nice publication, please cite the following paper:

Biljecki F (2020): Exploration of open data in Southeast Asia to generate 3D building models. ISPRS Annals of Photogrammetry, Remote Sensing and Spatial Information Sciences, VI-4/W1-2020: 37-44. doi:10.5194/isprs-annals-vi-4-w1-2020-37-2020

BibTeX entry:

@article{2020_3dgeoinfo_3d_asean,
 author = {Biljecki, F.},
 doi = {10.5194/isprs-annals-vi-4-w1-2020-37-2020},
 journal = {ISPRS Annals of Photogrammetry, Remote Sensing and Spatial Information Sciences},
 pages = {37--44},
 title = {Exploration of open data in Southeast Asia to generate 3D building models},
 volume = {VI-4/W1-2020},
 year = {2020}
}

More information

Please read more about the data on the other Github repository. You may also want to read the article on our group's website.