Given a lon/lat range that represents a tile on the Earth's surface, I need a computationally efficient way to figure out if a spherical volume defined by a point (assume ECEF coordinates) and a radius intersect with the tile.

It can be assumed that the maximum tile side length won't exceed 22.5 degrees and that all lon/lat area coordinates are aligned along traditional map tiling schemes (tiles won't cross the antemeridian, etc).

In the following picture, the blue ellipsoid represents Earth and the green sphere represents a volume of interest.

enter image description here

Given a lon/lat area, you can generate ECEF coordinates for the 4 extreme points and check whether any of these points lie within the sphere through a simple distance calculation. However, this method doesn't always work since you're ignoring curvature. The following picture shows this, with the tile shown in black and a possible sphere of interest in green.

enter image description here

You can add more points to test with the lon/lat tile (ie. check the center of the tile along with the 4 corners) but you're just trying to improve an approximation, and this will fail based on the position and size of the sphere, so I want a more analytical solution. I'm looking for a solution I can implement myself in code and not for an application or library.

I'd like to use an ellipsoid representation of Earth if possible, but if that ends up being too complex, representing the Earth as a sphere is okay too.

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.