Skip to content

ElmarJ/GeoJsonCityBuilder

Repository files navigation

GeoJSON City Builder

OpenUPM version GitHub issues

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 3D 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

  1. Click Window -> Package Manager
  2. Click + -> Add Package from git URL
  3. Type https://github.com/ViRGIS-Team/GeoJSON.Net and click Add
  4. 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

  1. Create an empty GameObject
  2. Click Add Component and add Scripts/GeoJsonCityBuilder/Position on World Coordinates
  3. 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).
  4. Click Add Component and add Scripts/GeoJsonCityBuilder/Blocks From Geo Json
  5. Drag your geojson-file into "Geo Json File". Make sure it has a ".json"-extension; ".geojson" will not work.
  6. Set other settings and materials
  7. Click Generate

Prefabs from geojson polygons

  1. Create an empty GameObject
  2. Click Add Component and add Scripts/GeoJsonCityBuilder/Position on World Coordinates
  3. 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).
  4. Click Add Component and add Scripts/GeoJsonCityBuilder/Blocks From Geo Json
  5. Drag your geojson-file into "Geo Json File". Make sure it has a ".json"-extension; ".geojson" will not work)
  6. Drag your prefab into "Prefab"
  7. 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:

About

Unity Package to recreate a 3D-city from a specially crafted geojson file.

Topics

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.meta

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages