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)
- Host: GitHub
- URL: https://github.com/bucherfa/triangulate-polygons
- Owner: bucherfa
- License: mit
- Created: 2021-06-02T16:51:12.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-06-03T19:12:57.000Z (almost 4 years ago)
- Last Synced: 2025-01-09T14:55:51.699Z (4 months ago)
- Topics: 2d, converter, generator, geojson, mesh, polygon, triangle, triangulate, triangulate-polygons, triangulator, unity
- Language: JavaScript
- Homepage:
- Size: 4.88 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
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/).