Skip to content

Convert GeoJSON Polygons into Meshes for Unity with Triangle (Delaunay Triangulator)

License

Notifications You must be signed in to change notification settings

bucherfa/triangulate-polygons

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Triangulate Polygons

Convert GeoJSON Polygons into Meshes for Unity with Triangle (Delaunay Triangulator)

Requirements

Usage

  1. Place a file input.geo.json which contains a GeoJSON.
  2. Run the following command:
    ./run.sh
  3. You will find two new files
    • output.unity.json which contains all triangles and vertices ready to be read into unity and
    • output.geo.json which contains all triangles as a GeoJSON.

Example input

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [0, 0],
            [0, 1],
            [1, 1],
            [1, 0],
            [0, 0]
          ]
        ]
      }
    }
  ]
}

Add more features with geometry type "Polygon" into the "features" array.

View the input/output on geojson.io and read your output into any programming language with quicktype.