Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find if a lat long coordinate is valid in a coordinate system?

If I have a point in latitude/longitude and I want to find out if it is a valid for use within a particular coordinate system, how can I do it?

As an example. Say I am working in Swiss Grid (CH 1903, EPSG 21781) and have a point representing something in London in the UK, I want to know if that point is valid in the Swiss Grid coordinate system.

Typically the conversion will work, but it may be so far outside the area that Swiss grid is good for that it is not really valid.

The context for this is that users will be importing points in latitude longitude into an application that works in a projected coordinate systme and they want to be warned when the points they are importing fall outside the projected coordinate system bounds.

But as far as I can tell, a projected coordinate system does not have any bounds.

like image 403
Nick Randell Avatar asked Jul 21 '09 16:07

Nick Randell


2 Answers

Although the answers listed are correct - there is no concept of "bounds" in a coordinate system, there are still approaches you can use.

The EPSG database provides a latitude/longitude bounding box for each coordinate system defined. This is listed in the "Area" table, and provides a (albeit rough) bounding box in which the coordinate system is reasonable. This alone might be enough to help you determine a reasonable extent.

By checking the coordinate of your point, and the four corners in the EPSG DB, you should be able to tell whether the coordinate is (potentially) reasonable for a given projection.

like image 144
Reed Copsey Avatar answered Oct 14 '22 10:10

Reed Copsey


You're imposing an artificial bounds upon the coordinate system by stating that there is a limit to the system itself (i.e. a point is "outside" the bounds because it falls out of the area I care about).

In that case, find the "corners" of the area you're interested in. If a point falls outside of those bounds, then you can flag the point as being outside your area of interest.

like image 25
Michael Todd Avatar answered Oct 14 '22 10:10

Michael Todd