]> granicus.if.org Git - postgis/commitdiff
Changed adjustment of extent by half-pixel to full-pixel for points and linestrings...
authorBborie Park <bkpark at ucdavis.edu>
Tue, 4 Oct 2011 20:51:10 +0000 (20:51 +0000)
committerBborie Park <bkpark at ucdavis.edu>
Tue, 4 Oct 2011 20:51:10 +0000 (20:51 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@7944 b70326c6-7e19-0410-871a-916f4a2858ee

raster/rt_core/rt_api.c

index 2142fec93e065204aa5da0f3f24024893a8ee34d..886274312996d792fd6b5e87c21c0996bbfe2f71 100644 (file)
@@ -7578,6 +7578,9 @@ rt_raster_gdal_rasterize(const unsigned char *wkb,
        /*
                if geometry is a point, a linestring or set of either and bounds not set,
                increase extent by half-pixel to avoid missing points on border
+
+               a whole pixel is used instead of half-pixel due to backward
+               compatibility with GDAL 1.6, 1.7 and 1.8.  1.9+ works fine with half-pixel.
        */
        wkbtype = wkbFlatten(OGR_G_GetGeometryType(src_geom));
        if ((
@@ -7589,10 +7592,16 @@ rt_raster_gdal_rasterize(const unsigned char *wkb,
                FLT_EQ(_width, 0) &&
                FLT_EQ(_height, 0)
        ) {
+               /*
                src_env.MinX -= (_scale_x / 2.);
                src_env.MaxX += (_scale_x / 2.);
                src_env.MinY -= (_scale_y / 2.);
                src_env.MaxY += (_scale_y / 2.);
+               */
+               src_env.MinX -= _scale_x;
+               src_env.MaxX += _scale_x;
+               src_env.MinY -= _scale_y;
+               src_env.MaxY += _scale_y;
        }
 
        /* user-defined skew */