2

I have a DB full of objects that contain a location (usually a polygon). I have a query defined that uses Hibernate Spatial's intersects() method to find all the objects that are with a box that's passed in (using SRID 4326, so it has lat/long coordinates).

The problem I'm having is that if the box contains the antimeridian it returns the objects as though the box was wrapped around the world, not the antimeridian.

For example: if I have a box with the top left (long, lat) coordinate of (170, 50), and a bottom right coordinate of (-170, 30), it treats it as though the top left coordinate is (-170, 50) and the bottom right coordinate is (170, 30).

How can I tell it that it should wrap around the antimeridian so that it returns the correct objects?

  • Construct the polygon from 170,50 to 190,30, clip it with 0,90 180,-90, then union that with the remainder, x-shifted -360 – Vince Jan 18 '18 at 3:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.