Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kpouer/wktparser
A parser for WKT geometry files (Well Know Text)
https://github.com/kpouer/wktparser
geometry polygon wellknowntext wkt
Last synced: about 1 month ago
JSON representation
A parser for WKT geometry files (Well Know Text)
- Host: GitHub
- URL: https://github.com/kpouer/wktparser
- Owner: kpouer
- License: mit
- Created: 2020-04-04T17:51:29.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-11-07T21:41:20.000Z (about 1 year ago)
- Last Synced: 2023-11-08T06:33:56.178Z (about 1 year ago)
- Topics: geometry, polygon, wellknowntext, wkt
- Language: Java
- Size: 96.7 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WKTParser
![Java CI with Maven](https://github.com/kpouer/WKTParser/workflows/Java%20CI%20with%20Maven/badge.svg)
![CodeQL](https://github.com/kpouer/WKTParser/workflows/CodeQL/badge.svg)
[![Maven Central](https://img.shields.io/maven-central/v/com.kpouer/wktparser)](https://central.sonatype.com/artifact/com.kpouer/wktparser/1.1.1/versions)A simple WKT (Well Know Text) parser grammar written for JavaCC.
The goal was to use it in a jEdit plugin, but you can use it for any other purpose
It does not support all WKT syntax but might be extended in the future.
## Dependency
Available through Maven central
```xml
com.kpouer
wktparser
1.1.1```
## Supported structures
* POINT
* LINESTRING
* POLYGON
* MULTIPOINT
* MULTIPOLYGON
* MULTILINESTRING
* GEOMETRYCOLLECTION## Example
```java
Start start = new WKT(new StringReader("LINESTRING(30 10,-3.2011243453 -101.12124240)"))
.Start();
LineString linestring = (LineString) start.jjtGetChild(0);
Point point1 = (Point) linestring.jjtGetChild(0);
Point point2 = (Point) linestring.jjtGetChild(1);
```
By default the parser will use JJT tree classes. But you could also use the shapes from
com.kpouer.wkt.shape package that implements shapes using double values.```java
Polygon polygon = WKT.parseShape("POLYGON((40 40, 20 45, 45 30, 40 40))");
```## Licence
WKT Parser is open source and licensed under the MIT License.