An open API service indexing awesome lists of open source software.

https://github.com/bucherfa/triangulate-polygons

Convert GeoJSON Polygons into Meshes for Unity with Triangle (Delaunay Triangulator)
https://github.com/bucherfa/triangulate-polygons

2d converter generator geojson mesh polygon triangle triangulate triangulate-polygons triangulator unity

Last synced: 2 months ago
JSON representation

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

Awesome Lists containing this project

README

        

# Triangulate Polygons

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

## Requirements

* [Triangle](https://www.cs.cmu.edu/~quake/triangle.html)
* node
* bash

## Usage

1. Place a file `input.geo.json` which contains a GeoJSON.
2. Run the following command:
```bash
./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

```json
{
"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](https://geojson.io/) and read your output into any programming language with [quicktype](https://app.quicktype.io/).