paulmach / orb

Types and utilities for working with 2d geometry in Golang
MIT License
910 stars 103 forks source link

Add support for EWKB/EWKT #68

Closed asmeikal closed 2 years ago

asmeikal commented 3 years ago

Hi! We're relying a lot at work on this package to handle geometries, and it works like a charm, but we have an issue when storing geometries inside postgis. We need to specify an SRID for the geometry, to obtain meaningful results with certain database operations, and we are currently converting back and forth between the geometries defined in go-geom and the geometries of orb, which is not ideal performance-wise. We still want to rely on orb for in-memory management of geometries, since it has lots of useful in-memory operations implemented.

If it's ok with you I'd like to try and submit a PR to add support for EWKB/EWKT serialization. I'm just not sure on how to structure it, and how to share code between the current WKB/WKT implementation, so I'm open to suggestions on this topic.

paulmach commented 3 years ago

Hi, I'm glad you find the package useful.

I think this is a great idea. I'm mostly concerned about the api being pleasant to use since I have very little experience with go<->db but know it can be a bit weird.

As for code structure, maybe move some of those methods to an internal package under encoding?

ivalkenburg commented 3 years ago

Would love ewkb support. Would make this alot easier to work with postgis.

paulmach commented 2 years ago

Hi, I have a "finished" PR to add EWKB support, please provide feedback on API/interface https://github.com/paulmach/orb/pull/88

asmeikal commented 2 years ago

Hi @paulmach! I've integrated your branch in our codebase and it works without problems, and we also got to remove a lot of code used for back-and-forth conversions to go-geom.

paulmach commented 2 years ago

@asmeikal thank you for testing. I merged and tagged v0.6.0 https://github.com/paulmach/orb/releases/tag/v0.6.0