From: Sandro Santilli Date: Mon, 12 Mar 2012 17:45:48 +0000 (+0000) Subject: Fix UTM zone reserved SRID interpretation (#1680) X-Git-Tag: 2.0.0beta3~21 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=03de589457493ca5b34b380cbd212abc718eec2d;p=postgis Fix UTM zone reserved SRID interpretation (#1680) git-svn-id: http://svn.osgeo.org/postgis/trunk@9476 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/libpgcommon/lwgeom_transform.c b/libpgcommon/lwgeom_transform.c index 67953816c..30951b1ac 100644 --- a/libpgcommon/lwgeom_transform.c +++ b/libpgcommon/lwgeom_transform.c @@ -417,16 +417,16 @@ static char* GetProj4String(int srid) else { char *proj_str = palloc(maxproj4len); - int id = abs(srid); + int id = srid; /* UTM North */ if ( id >= SRID_NORTH_UTM_START && id <= SRID_NORTH_UTM_END ) { - snprintf(proj_str, maxproj4len, "+proj=utm +zone=%d +ellps=WGS84 +datum=WGS84 +units=m +no_defs", id - SRID_NORTH_UTM_START); + snprintf(proj_str, maxproj4len, "+proj=utm +zone=%d +ellps=WGS84 +datum=WGS84 +units=m +no_defs", id - SRID_NORTH_UTM_START + 1); } /* UTM South */ else if ( id >= SRID_SOUTH_UTM_START && id <= SRID_SOUTH_UTM_END ) { - snprintf(proj_str, maxproj4len, "+proj=utm +zone=%d +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs", id - SRID_SOUTH_UTM_START); + snprintf(proj_str, maxproj4len, "+proj=utm +zone=%d +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs", id - SRID_SOUTH_UTM_START + 1); } /* Lambert Azimuthal Equal Area South Pole */ else if ( id == SRID_SOUTH_LAMBERT ) diff --git a/regress/tickets.sql b/regress/tickets.sql index ddb162740..4f4c24bbc 100644 --- a/regress/tickets.sql +++ b/regress/tickets.sql @@ -622,5 +622,11 @@ SELECT '#1596.7', srid FROM geometry_columns WHERE f_table_name = 'road_pg' AND f_geometry_column = 'roads_geom'; DROP TABLE road_pg; +-- #1596 +WITH inp AS ( SELECT + 'POLYGON((-176 -22,-176 -21,-175 -21,-175 -22,-176 -22))'::geography as a, + 'POINT(-176 -22)'::geography as p +) SELECT '#1596', ST_Summary(ST_Intersection(a,p)) FROM inp; + -- Clean up DELETE FROM spatial_ref_sys; diff --git a/regress/tickets_expected b/regress/tickets_expected index fc52716c5..4bd17f237 100644 --- a/regress/tickets_expected +++ b/regress/tickets_expected @@ -208,3 +208,4 @@ ERROR: invalid SRID: 999000 not found in spatial_ref_sys NOTICE: SRID value -1 converted to the officially unknown SRID value 0 #1596.6|public.road_pg.roads_geom SRID changed to 0 #1596.7|0 +#1596|Point[BG]