Factual / geo

Clojure library for working with geohashes, polygons, and other world geometry
Eclipse Public License 1.0
302 stars 17 forks source link

Extend Point to convert to JTS? #7

Closed willcohen closed 6 years ago

willcohen commented 6 years ago

Since geo.io requires JTS geometries, I don't think it's possible to do things like write a geohash-center's point to wkt or geojson using existing functions, since there's no way to cast it to Geometry without pulling out coordinates manually and making a new point. How do you feel about extending the Point protocol to include (to-jts-point)?

worace commented 6 years ago

@willcohen this is a great point; I added the geo.io stuff recently but didn't fully think through how it would play with converting between some of the other Geo types in the library (like Geohashes as you point out).

I think this would be great to add. I can try to find some time to look at this in the coming days, or would be happy to take a PR if you're interested in taking it on.

It also makes me wonder if there is a cleverer way to do the geojson and wkt serialization in terms of the Shapelike protocol we have already implemented so that more types of things could be automatically serialized. I guess we might need a to-jts method on that protocol to do the conversion, since we're doing the serialization using JTS.

willcohen commented 6 years ago

Okay! Have you given any thought to moving to JTS 1.15 (#6)? I can make a PR for this that either keeps using com.vividsolutions as is or hold off, if the JTS dependency groups might change.

And finally, since we are talking about JTS and not just objects that can only fit on the earth one way, could projections fit within the scope of this library? On our end we're currently just using JTS objects that come out of this library and applying proj4j transformations to them as needed, but I imagine that there's a way to fit this into the protocols more fluidly as well. I can make an issue for this as well.

worace commented 6 years ago

Okay! Have you given any thought to moving to JTS 1.15 (#6)?

Was just looking at that PR now; I am going to run tests and read through the code a bit more but I think it should be good to go....so if you're interested in digging into this I think it would be fine to branch from your willcohen:jts-1.15 branch if that makes things easier for you.

could projections fit within the scope of this library?

I'd definitely be open to including support for this, but it's not an area that I have much experience with so I'd have to do some research to figure out what features are needed and what's the cleanest way to implement it.

willcohen commented 6 years ago

Closing in favor of #8 and #10 -- limiting JTS conversions to happen only in Shapelike.