]> granicus.if.org Git - postgis/commitdiff
Added additional conditions for rt_raster_gdal_rasterize() determining when to expand...
authorBborie Park <bkpark at ucdavis.edu>
Fri, 24 Feb 2012 17:33:48 +0000 (17:33 +0000)
committerBborie Park <bkpark at ucdavis.edu>
Fri, 24 Feb 2012 17:33:48 +0000 (17:33 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@9286 b70326c6-7e19-0410-871a-916f4a2858ee

raster/rt_core/rt_api.c
raster/test/regress/rt_intersects_expected

index d1e32dad23d8da4f97dfa15b86185ccc360a2fcf..ef5d60bc271a8d5599dcca78e529e2411f4e6b1a 100644 (file)
@@ -8915,16 +8915,45 @@ rt_raster_gdal_rasterize(const unsigned char *wkb,
 
 #if POSTGIS_GDAL_VERSION > 18
                RASTER_DEBUG(3, "Adjusting extent for GDAL > 1.8 by half the scale");
-               src_env.MinX -= (_scale[0] / 2.);
-               src_env.MaxX += (_scale[0] / 2.);
-               src_env.MinY -= (_scale[1] / 2.);
-               src_env.MaxY += (_scale[1] / 2.);
+
+               if (
+                       FLT_EQ((src_env.MaxX - src_env.MinX), 0) ||
+                       (wkbtype == wkbMultiPoint) ||
+                       (wkbtype == wkbMultiLineString)
+               ) {
+                       src_env.MinX -= (_scale[0] / 2.);
+                       src_env.MaxX += (_scale[0] / 2.);
+               }
+
+               if (
+                       FLT_EQ((src_env.MaxY - src_env.MinY), 0) ||
+                       (wkbtype == wkbMultiPoint) ||
+                       (wkbtype == wkbMultiLineString)
+               ) {
+                       src_env.MinY -= (_scale[1] / 2.);
+                       src_env.MaxY += (_scale[1] / 2.);
+               }
+
 #else
                RASTER_DEBUG(3, "Adjusting extent for GDAL <= 1.8 by the scale");
-               src_env.MinX -= _scale[0];
-               src_env.MaxX += _scale[0];
-               src_env.MinY -= _scale[1];
-               src_env.MaxY += _scale[1];
+
+               if (
+                       FLT_EQ((src_env.MaxX - src_env.MinX), 0) ||
+                       (wkbtype == wkbMultiPoint) ||
+                       (wkbtype == wkbMultiLineString)
+               ) {
+                       src_env.MinX -= _scale[0];
+                       src_env.MaxX += _scale[0];
+               }
+
+               if (
+                       FLT_EQ((src_env.MaxY - src_env.MinY), 0) ||
+                       (wkbtype == wkbMultiPoint) ||
+                       (wkbtype == wkbMultiLineString)
+               ) {
+                       src_env.MinY -= _scale[1];
+                       src_env.MaxY += _scale[1];
+               }
 #endif
 
        }
index e47990fc3a537eacc874e75849b20c5166f483be..a17cebb1d9401f230df325a98f60fe202cb4ac6b 100644 (file)
@@ -188,7 +188,7 @@ NOTICE:  table "raster_intersects_geom" does not exist, skipping
 2.5|0|25|ST_LineString|f
 2.5|0|26|ST_LineString|t
 2.5|0|27|ST_LineString|t
-2.5|0|28|ST_LineString|t
+2.5|0|28|ST_LineString|f
 2.5|0|29|ST_LineString|f
 2.5|0|31|ST_Polygon|t
 2.5|0|32|ST_Polygon|t
@@ -217,10 +217,10 @@ NOTICE:  table "raster_intersects_geom" does not exist, skipping
 2.6|2|15|ST_MultiPoint|t
 2.6|2|21|ST_LineString|t
 2.6|2|22|ST_LineString|t
-2.6|2|23|ST_LineString|t
-2.6|2|24|ST_LineString|t
+2.6|2|23|ST_LineString|f
+2.6|2|24|ST_LineString|f
 2.6|2|25|ST_LineString|t
-2.6|2|26|ST_LineString|t
+2.6|2|26|ST_LineString|f
 2.6|2|27|ST_LineString|t
 2.6|2|28|ST_LineString|t
 2.6|2|29|ST_LineString|t