georust / wkt

Rust read/write support for well-known text (WKT)
https://crates.io/crates/wkt
Apache License 2.0
50 stars 25 forks source link

Output `TRIANGLE` type? #97

Open michaelkirk opened 2 years ago

michaelkirk commented 2 years ago

I'm not sure if we should support this, but I wanted to at least gather some facts for documentation.

postgis supports it:

SELECT ST_AsText('TRIANGLE((0 0,0 1,1 1,0 0 ))');
          st_astext          
-----------------------------
 TRIANGLE((0 0,0 1,1 1,0 0))
(1 row)

JTS does not support it

reader.read("TRIANGLE((0 0,0 1,1 1,0 0 ))");
> org.locationtech.jts.io.ParseException: Unknown geometry type: TRIANGLE (line 1)

Nor does GEOS

     message: `ParseException: Unknown type: 'TRIANGLE'`
urschrei commented 2 years ago

It's part of the spec (OpenGIS Implementation Specification for Geographic information - Simple feature access - Part 1: Common architecture, p14, p26), and also part of WKB, so I'm not against it, but I wonder why JTS and GEOS don't support it.

GEOS usually follows JTS, and it's curious that PostGIS uses GEOS, but supports TRIANGLE.

We could just ask JTS?