Repository navigation
Use JTS geometries in vector package - #2932
Conversation
|
In the interest of furthering a new RFP process for major changes or new features that we're trying out, I'd like to post my plans for this work, in case there is useful feedback. This will call out some of the salient features of the experimental code. Proposed deletionsHere is the subset of the vector package that will be removed: The sub-packages to be removed add little if anything in the way of functionality. We will favor using JTS directly for these features. Obviously, the basic geometry types will be removed; however, I have opted to this point to keep the companion objects to aid in object creation. This does create some type weirdness, though, in some cases requiring importing JTS into a Proposed PreservationsNotable here is the maintenance of the |
976b7d2 to
2577afb
Compare
| def withSRID(srid: Int) = Projected(g, srid) | ||
| } | ||
|
|
||
| @typeclass trait MultiGeometry[G] |
There was a problem hiding this comment.
This isn't used anywhere but for an import in ProtobufGeom. Do you think this is something important or just left-over at this point?
There was a problem hiding this comment.
Yeah, I'd agree that it's mostly vestigial. Not entirely clear what its value was in the first place.
57a5cc3 to
5a55294
Compare
Signed-off-by: jpolchlo <[email protected]>
Signed-off-by: jpolchlo <[email protected]>
Signed-off-by: jpolchlo <[email protected]>
Signed-off-by: jpolchlo <[email protected]>
Signed-off-by: jpolchlo <[email protected]>
Signed-off-by: jpolchlo <[email protected]>
Signed-off-by: jpolchlo <[email protected]>
Signed-off-by: jpolchlo <[email protected]>
Signed-off-by: jpolchlo <[email protected]>
Signed-off-by: jpolchlo <[email protected]>
Signed-off-by: jpolchlo <[email protected]>
Signed-off-by: jpolchlo <[email protected]>
Signed-off-by: jpolchlo <[email protected]>
Signed-off-by: jpolchlo <[email protected]>
Signed-off-by: jpolchlo <[email protected]>
Signed-off-by: jpolchlo <[email protected]>
Signed-off-by: jpolchlo <[email protected]>
Signed-off-by: jpolchlo <[email protected]>
0d8efb1 to
08363c4
Compare
|
@jpolchlo |
| def distanceToInfiniteLine(a: Point, b: Point): Double = | ||
| CGAlgorithms.distancePointLinePerpendicular(jtsGeom.getCoordinate, a.toCoordinate, b.toCoordinate) | ||
| } | ||
| object Point extends PointConstructors |
There was a problem hiding this comment.
I think this is actually the last thing we talked about, keeping the geotrellis.vector.jts.Point is the thing that would provide duplicate imports if org.locationtech.jts.geom._ was imported. IIRC our discussion landed on removing these constructors and using only the ones in JTS object.
There was a problem hiding this comment.
We discussed this, and I remember settling on "eh, no, maybe not". The footprint of this "simple" change is wide, necessitating either another import (after we went through the trouble to minimize them), or requiring a clumsy prefix for every geometry creation. It's going to be less common for a user to import org.locationtech.jts.geom._, so I made a note in the docs (https://github.com/locationtech/geotrellis/pull/2932/files#diff-38390c0856b2dfe9eff77f20e8a0d9d1R249) to avoid doing so in a careless fashion. The JTS object feels like a kludge to get around a broken thing, not a thing that I would want to use all the time. I would hope that one day the scala REPL would fix its problems and we can just get rid of it.
There was a problem hiding this comment.
Ok, thats not what I recall ending on, but I accept this argument now. The docs certainly help. 👍
Signed-off-by: jpolchlo <[email protected]>
Signed-off-by: jpolchlo <[email protected]>
Signed-off-by: jpolchlo <[email protected]>
echeipesh
left a comment
There was a problem hiding this comment.
LGTM, will squash-merge on green CI.
Signed-off-by: jpolchlo <[email protected]>
Signed-off-by: jpolchlo <[email protected]>
|
@jpolchlo sweet PR! 🎉 |
Overview
We are now favoring direct use of JTS geometries for improved interoperability with other projects. Scala wrapper classes for Geometry have been snuffed. Many submodules of
geotrellis.vectorhave also been removed in favor of direct usage of the corresponding JTS functionality. Extension methods and companion objects have been added to maintain a crisp, candy shell around JTS to keep most interactions from messing up your fingers. Importgeotrellis.vector._to access these niceties; if it is required,import org.locationtech.jts.{geom => jts}to prevent namespace collisions.Note: In the REPL, geometries will need to be constructed via the duplicate definitions in the
JTSobject to avoid namespace clashes that appear to be buggy behavior on the part of the REPL (that is, useJTS.Point(0,0)to construct a point at the origin in interactive sessions, but in compiled code,Point(0,0)will suffice). See core concepts documentation in the guide for more details.Closes #2930
Closes #2931
Closes #2955
Signed-off-by: jpolchlo [email protected]
Checklist
docs/CHANGELOG.rstupdated, if necessarydocsguides update, if necessary