Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jts-dev] split a polygon or line at the antimeridian

Thanks to all for the help and suggestions.  Thanks especially for the pointer to Spatial4J - I haven't used that project before but it seems to do exactly what I needed, e.g.

JtsGeometry jtsGeometry = new JtsGeometry(geometry, JtsSpatialContext.GEO, true, false)

Very cool!

--john


On Tue, Sep 26, 2017 at 12:17 PM, Martin Davis <mtnclimb@xxxxxxxxx> wrote:
Thanks for the link to the Spatial4J code, David.  Looks a bit more complicated than one might initially think!  

And yes, there is the hope that JTS 2 will make it feasible to support both planar and geodetic geometry representations.  Or at least make it seamless to integrate Spatial4J logic into a more general JTS framework.  As your code demonstrates, there is a lot of complexity to supporting geodetic, so it would definitely be nice to allow the reuse of a tested implmentation!

On Mon, Sep 25, 2017 at 7:46 PM, David Smiley <david.w.smiley@xxxxxxxxx> wrote:
I thought I'd mention that Spatial4j, a library I'm involved with that works with JTS, addresses the dateline / antimeridian in the JtsGeometry class:

Perhaps this code might have a home in JTS 2.0.

On Mon, Sep 25, 2017 at 7:56 PM Martin Davis <mtnclimb@xxxxxxxxx> wrote:
And now in the FAQ:  https://locationtech.github.io/jts/jts-faq.html#E3

Further suggestions welcome...

On Mon, Sep 25, 2017 at 4:39 PM, Martin Davis <mtnclimb@xxxxxxxxx> wrote:
John,

JTS doesn't at the moment contain a Split Polygon By Line function, so your approach of constructing clipping polygons is the recommended alternative.  The good news in your case is (a)  you know a priori the maximum extent of the input geometries and (b) the splitting line is vertical.  So you can simply create two fixed orthnormal rectangles and use them as the splitting polygons. 

(Aside - it would be a nice little exercise to create a function which takes a splitting line and turns it into a splitting polygon, and then computes and returns both sides of the split.  Someone may have already done this...)

As for translating to [0 - 360], yes, the AffineTransformation API is designed to do this.  For example code see the unit test file [1] (This would be a nice candidate for some code in the examples module)

HTH


On Mon, Sep 25, 2017 at 4:20 PM, John Cartwright - NOAA Federal <john.c.cartwright@xxxxxxxx> wrote:
Hello All,

I feel like this is a common question but don't seem to find a good answer.  

I'm trying to split a simple shape at the antimeridian to form a multipart geometry.  My general approach was to construct two clipping polygons for the eastern and western hemispheres and intersect them with the target geometry.

Can someone suggest a better approach to doing this with JTS or GeoTools?

Related question - it seems that I need to shift the geometries from a -180 to 180 coordinate space to a 0 to 360 coordinate space in order to perform some of the calculations.  Is AffineTransformation the best way to approach this?  Any examples of using it for this purpose?

Thanks for any help you can provide!

--john


_______________________________________________
jts-dev mailing list
jts-dev@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.locationtech.org/mailman/listinfo/jts-dev



_______________________________________________
jts-dev mailing list
jts-dev@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.locationtech.org/mailman/listinfo/jts-dev
--
Lucene/Solr Search Committer, Consultant, Developer, Author, Speaker

_______________________________________________
jts-dev mailing list
jts-dev@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.locationtech.org/mailman/listinfo/jts-dev



_______________________________________________
jts-dev mailing list
jts-dev@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.locationtech.org/mailman/listinfo/jts-dev



Back to the top