locationtech / jts

The JTS Topology Suite is a Java library for creating and manipulating vector geometry.
Other
1.99k stars 443 forks source link

Support for TWKB #246

Closed mojodna closed 2 years ago

mojodna commented 6 years ago

From https://github.com/TWKB/Specification/blob/master/twkb.md:

TWKB is a multi-purpose format for serializing vector geometry data into a byte buffer, with an emphasis on minimizing size of the buffer.

Why not WKB?

The original OGC "well-known binary" format is a simple format, and is capable of easily representing complex OGC geometries like nested collections, but it has two important drawbacks for use as a production serialization:

it is not aligned, so it doesn't support efficient direct memory access; and, it uses IEEE doubles as the coordinate storage format, so for data with lots of spatially adjacent coordinates (basically, all GIS data) it wastes a lot of space on redundant specification of coordinate information. A new serialization format can address the problem of alignment, or the problem of size, but not both. Given that most current client/server performance issues are bottlenecked on network transport times, TWKB concentrates on solving the problem of serialization size.

Implemented in PostGIS as https://postgis.net/docs/ST_AsTWKB.html (et al) and written up by CARTO at https://carto.com/blog/smaller-faster/

lossyrob commented 6 years ago

Redirected from a feature request for GeoTrellis - we'd be interested in exposing this functionality through GeoTrellis as we do with WKT

mojodna commented 6 years ago

JavaScript implementations: https://github.com/cschwarz/wkx and https://github.com/TWKB/twkb.js

jnh5y commented 6 years ago

@mojodna @lossyrob sounds like a good idea! Looks like we'd just need to find someone to sort out a Java implementation!

jnh5y commented 6 years ago

@mojodna @lossyrob, @jodygarnett and I were chatting today, and we were discussing this as a project for the FOSS4G NA 2018 code sprint in St. Louis. Thoughts?

aaime commented 5 years ago

I see there is a branch here, wondering what its status is? https://github.com/locationtech/jts/commits/twkb

jnh5y commented 5 years ago

@aaime I ran out of time to push it over the edge.

As a note, @elahrvivaz implemented TWKB in Scala for GeoMesa. As you move things forward with TWKB, we should get him to weigh in and review!

murdos commented 2 years ago

There's an implementation in geowave: https://github.com/locationtech/geowave/blob/master/core/geotime/src/main/java/org/locationtech/geowave/core/geotime/util/TWKBReader.java Could it be reported in JTS?

jnh5y commented 2 years ago

There's an implementation in geowave: https://github.com/locationtech/geowave/blob/master/core/geotime/src/main/java/org/locationtech/geowave/core/geotime/util/TWKBReader.java Could it be reported in JTS?

Generally, yes. I do believe that the ASL 2.0 is compatible with the licenses for JTS. @jodygarnett may be able to make any notes about that.

That said, I'd feel best about it if @rfecher or @jdgarrett contributed the code. Also, a PR ought to have the unit tests with it, etc.

jodygarnett commented 2 years ago

I can see twb included in release here https://locationtech.github.io/jts/javadoc-io/index.html