]> granicus.if.org Git - postgis/commitdiff
Fix UTM zone reserved SRID interpretation (#1680)
authorSandro Santilli <strk@keybit.net>
Mon, 12 Mar 2012 17:45:48 +0000 (17:45 +0000)
committerSandro Santilli <strk@keybit.net>
Mon, 12 Mar 2012 17:45:48 +0000 (17:45 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@9476 b70326c6-7e19-0410-871a-916f4a2858ee

libpgcommon/lwgeom_transform.c
regress/tickets.sql
regress/tickets_expected

index 67953816ce6e4e0f1782ad0d74294c1ea8da45e7..30951b1ac5e81a1683a0e3b2d87f48ab8accefbf 100644 (file)
@@ -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 )
index ddb1627400ef9c55d645a3f8a64a6cb28ae0c116..4f4c24bbc4a1a34318e84e98ce8fe93b112dce25 100644 (file)
@@ -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;
index fc52716c5f326f001c23894de54adb1cbb775604..4bd17f2372e2187760b42aa9284edf836355bfab 100644 (file)
@@ -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]