jarpineh
jarpineh

Reputation: 81

Get projection limits from Postgis

I receive spatial queries to my API in lat/lon coordinate pairs. My spatial data is in projections that don't cover the entire globe, which follows that some queries are out of bounds.

I'd like to respond to wrong queries with helpful error message. Rather than try to find out some in GIS specifications or standards what boundaries each projection has (and getting correct lat/lon pairs from those), I'd like to know wether I could either ask the limits from Postgis or ask if specific point is within limits and in what way it's wrong. This way I could support many projections easily.

It looks like Postgis has this information because for wrong query it answers thus:

transform: couldn't project point (-77.0331 -12.1251 0):
    latitude or longitude exceeded limits (-14)

I'm using Postgis through Geodjango distance query (django.contrib.gis.geos.geometry.GEOSGeometry.distance function).

Upvotes: 2

Views: 557

Answers (1)

Mike T
Mike T

Reputation: 43702

PostGIS or PROJ.4 (follow this thread) don't have these bounds. Each projection's bounds are unique, and are traditionally published by the authority that designed the projection.

One of the primary sources for this data is from https://www.epsg-registry.org click "retrieve by code" and (e.g.) 27200, and view the "Area of Use" fields.

Much of the same information is repeated at (e.g.) http://epsg.io/27200 and look for "bounds".

If you need this data, I suggest you make a new table to collect it.

Upvotes: 2

Related Questions