From effe7ac0a490ff55f9e625a44228b93bea1901f4 Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Mon, 16 Nov 2009 00:27:55 +0000 Subject: [PATCH] Cowboy triumphs. (#304) git-svn-id: http://svn.osgeo.org/postgis/trunk@4823 b70326c6-7e19-0410-871a-916f4a2858ee --- postgis/geography_measurement.c | 8 ++++---- postgis/lwgeom_transform.c | 23 +++++++++++++++++++---- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/postgis/geography_measurement.c b/postgis/geography_measurement.c index f4667443d..6178da654 100644 --- a/postgis/geography_measurement.c +++ b/postgis/geography_measurement.c @@ -521,16 +521,16 @@ Datum geography_bestsrid(PG_FUNCTION_ARGS) gbox2 = gbox1; - /* Are these data arctic? Polar stereographic north. */ + /* Are these data arctic? Lambert Azimuthal Equal Area North. */ if( gbox1.ymin > 65.0 && gbox2.ymin > 65.0 ) { - PG_RETURN_INT32(-3995); + PG_RETURN_INT32(-3574); } - /* Are these data antarctic? Polar stereographic south. */ + /* Are these data antarctic? Lambert Azimuthal Equal Area South. */ if( gbox1.ymin < -65.0 && gbox2.ymin < -65.0 ) { - PG_RETURN_INT32(-3031); + PG_RETURN_INT32(-3409); } /* diff --git a/postgis/lwgeom_transform.c b/postgis/lwgeom_transform.c index a8e5a6cbb..85fc733a2 100644 --- a/postgis/lwgeom_transform.c +++ b/postgis/lwgeom_transform.c @@ -415,24 +415,39 @@ static char* GetProj4String(int srid) snprintf(proj_str, maxproj4len, "+proj=utm +zone=%d +ellps=WGS84 +datum=WGS84 +units=m +no_defs", id - 32600); } /* UTM South */ - if( id >= 32701 && id <= 32760 ) + else if( id >= 32701 && id <= 32760 ) { snprintf(proj_str, maxproj4len, "+proj=utm +zone=%d +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs", id - 32700); } + /* Lambert Azimuthal Equal Area South Pole */ + else if( id == 3409 ) + { + strncpy(proj_str, "+proj=laea +lat_0=-90 +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs", maxproj4len ); + } /* Polar Sterographic South */ - if( id == 3031 ) + else if( id == 3031 ) { strncpy(proj_str, "+proj=stere +lat_0=-90 +lat_ts=-71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs", maxproj4len); } + /* Lambert Azimuthal Equal Area North Pole */ + else if( id == 3574 ) + { + strncpy(proj_str, "+proj=laea +lat_0=90 +lon_0=-40 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs", maxproj4len ); + } /* Polar Stereographic North */ - if( id == 3995 ) + else if( id == 3995 ) { strncpy(proj_str, "+proj=stere +lat_0=90 +lat_ts=71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs", maxproj4len ); } /* World Mercator */ - if( id == 3395 ) + else if( id == 3395 ) { strncpy(proj_str, "+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs", maxproj4len ); + } + else + { + elog(ERROR, "Cannot find SRID (%d) in spatial_ref_sys", srid); + return NULL; } POSTGIS_DEBUGF(3, "returning on SRID=%d: %s", srid, proj_str); -- 2.50.1