Giter VIP home page Giter VIP logo

hdb3d-code's Introduction

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:

@article{ceus_inferring_heights,
    author = {Biljecki, Filip and Ledoux, Hugo and Stoter, Jantien},
    title = {{Generating 3D city models without elevation data}},
    journal = {Computers, Environment and Urban Systems},
    year = {2017},
    volume = {64},
    pages = {1--18},
    month = jul
}

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.

hdb3d-code's People

Contributors

fbiljecki avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.