Skip to content

Latest commit

 

History

History
127 lines (75 loc) · 5.68 KB

geoJSON_to_3DTiles_example.md

File metadata and controls

127 lines (75 loc) · 5.68 KB

Example of GeoJSON to 3DTiles pipeline

This tutorial is an example of 3DTiles creation and visualisation. The 3DTiles are created with py3dtilers.

In this example, we use the GeoJSON Tiler to create 3DTiles from a GeoJSON file.

Before using the tiler, install py3dtilers.

To create 3DTiles from OBJ, CityGML or IFC files, check the Tilers usage. An example of the CityGML Tiler usage is available in this tutorial

Data

Download the BD Topo data from IGN's BD Topo (ZONE --> D069 Rhône)

In QGIS, open the BDTOPO/1_DONNEES_LIVRAISON/BATI/BATIMENT.shp file.

You can use QGIS to filter buildings or select a smaller area.

Then, save the buildings layer as a GeoJson file:

image

Use the GeojsonTiler

See the GeoJson Tiler usage for more details about this Tiler.

To use the Tiler, target the GeoJSON file containing the buildings:

geojson-tiler --path path/to/buildings.geojson

Reprojection

The Tiler allows to change the CRS of the 3DTiles. By default, the CRS of your 3DTiles will be the same as your data.

In order to change the CRS, you have to specify both input CRS (--crs_in flag) and output CRS (--crs_out flag). For example, to visualise 3DTiles in Cesium ion (EPSG:4978) with IGN's BD Topo (EPSG:2154), you have to produce 3DTiles with:

geojson-tiler --path path/to/buildings.geojson --crs_in EPSG:2154 --crs_out EPSG:4978

Roofprint or footprint

By default, the Tiler considers that the features in the GeoJSON file are footprints. But in BD TOPO data, the features are roofprints, meaning we have to substract the height of the building from the features to find the footprints.

If the features are roofprints, use the flag --is_roof to create the buildings at the right altitude:

geojson-tiler --path path/to/buildings.geojson --is_roof

Altitude and height

You can choose an arbitrary altitude and an arbitrary height for your buildings with the flags --z and --height. For example, to create 6 meters hight buildings at 0 m above the sea level, use:

geojson-tiler --path path/to/buildings.geojson --height 6 --z 0

Color

You can add colors to your buildings with the flag --add_color. The color of the material depends on the value of a selected property for each building.
If the property is numeric, we create a heatmap by interpolating the minimal and the maximal colors.
If the property is semantic, we choose the color depending on the value of the property. The color to use for each value must be specified in the color dictionary.

The flag takes 2 arguments: the name of the property and its type ('numeric' or 'semantic'). If only the name is given, the type will be 'numeric' by default. If no argument is given with the flag, the colors won't be added.

Example for numeric property:

geojson-tiler --path path/to/buildings.geojson --add_color HAUTEUR numeric

image
The color depends on the "HAUTEUR" ("height") of each building. The highter is the building, more the color tends to red

Example for a semantic property arbitrarily added with QGIS:

geojson-tiler --path path/to/buildings.geojson --add_color BOROUGH semantic

image
The color depends on the "BOROUGH" attribute of each building ("2nd" -> red, "3rd" -> green, "7th" -> blue)

The default colors are defined by a JSON file. If you want to change the colors used, update the file with the right color codes. (See Color module for more details)

Visualisation

To visualize your 3DTiles in Cesium ion, iTowns or UD-Viz follow this tutorial.

Cesium ion

Your 3DTiles must be in the EPSG:4978 to be viewed in Cesium ion (see reprojection).

The tileset is created with the command:

geojson-tiler --path ../buildings.geojson --z 0 --crs_in EPSG:2154 --crs_out EPSG:4978

image

iTowns

Your 3DTiles must be in the EPSG:3946 to be viewed in iTowns (see reprojection).

The tileset is created with the command:

geojson-tiler --path ../buildings.geojson --is_roof --crs_in EPSG:2154 --crs_out EPSG:3946

image

UD-Viz

Your 3DTiles must be in the EPSG:3946 to be viewed in UD-Viz (see reprojection).

The tileset is created with the command:

geojson-tiler --path ../buildings.geojson --is_roof --crs_in EPSG:2154 --crs_out EPSG:3946

image