GeoJSON City Builder
Unity Package to recreate a 3D-city from GeoJSON files. Currently allows to create extruded objects (e.g. buildings) from polygons and to place prefabs on points.
See for an example on what can be achieved and how to use it, the Waterlooplein Time Machine project.
Installation
Option 1: Using OpenUPM cli
This package is listed in the OpenUPM repository. Installation:
npm install -g openupm-cli
cd YOUR_UNITY_PROJECT_FOLDER
openupm add com.virgis.geojson.net
openupm add nl.elmarjansen.geojsoncitybuilder
Note that this package depends on the geojson package com.virgis.geojson.net being installed.
Option 2: As a git-link in Unity package manager
- Click Window -> Package Manager
- Click + -> Add Package from git URL
- Type https://github.com/ViRGIS-Team/GeoJSON.Net and click Add
- Type https://github.com/ElmarJ/GeoJsonCityBuilder and click Add
Usage
See https://github.com/ElmarJ/geojsoncitybuilder.devenv for a simple working example in Unity. See https://github.com/ElmarJ/Waterlooplein3D/ for a more advanced example (using the Unity HDRP pipeline).
Blocks from geojson polygons
- Create an empty GameObject
- Click Add Component and add Scripts/GeoJsonCityBuilder/Position on World Coordinates
- Set the desired Lat/Long-coordinates for the Unity world origin in the "Position on World Coordinates" component (choose a location central to the area that you want to reconstruct).
- Click Add Component and add Scripts/GeoJsonCityBuilder/Blocks From Geo Json
- Drag your geojson-file into "Geo Json File". Make sure it has a ".json"-extension; ".geojson" will not work.
- Set other settings and materials
- Click Generate
Prefabs from geojson polygons
- Create an empty GameObject
- Click Add Component and add Scripts/GeoJsonCityBuilder/Position on World Coordinates
- Set the desired Lat/Long-coordinates for the Unity world origin in the "Position on World Coordinates" component (choose a location central to the area that you want to reconstruct).
- Click Add Component and add Scripts/GeoJsonCityBuilder/Blocks From Geo Json
- Drag your geojson-file into "Geo Json File". Make sure it has a ".json"-extension; ".geojson" will not work)
- Drag your prefab into "Prefab"
- Click Generate
Open source credits
This package makes use of the JSONObject library by Matt Schoen
Links
Links kept for reference to similar or otherwise relevant projects: