From b5c044ab3db04451f1705e3c308b060b2da50281 Mon Sep 17 00:00:00 2001 From: Bborie Park Date: Wed, 5 Oct 2011 04:54:00 +0000 Subject: [PATCH] Removed hackish use of POSTGIS_GDAL_VERSION in postgis/sqldefines.h.in and postgis/postgis.sql.in.c. Added conditional compilation of extent resizing based upon GDAL version in rt_api.c git-svn-id: http://svn.osgeo.org/postgis/trunk@7948 b70326c6-7e19-0410-871a-916f4a2858ee --- postgis/postgis.sql.in.c | 6 +++--- postgis/sqldefines.h.in | 8 ++++++-- raster/rt_core/rt_api.c | 11 ++++++++--- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/postgis/postgis.sql.in.c b/postgis/postgis.sql.in.c index c2162856e..07403fe5d 100644 --- a/postgis/postgis.sql.in.c +++ b/postgis/postgis.sql.in.c @@ -2205,7 +2205,7 @@ DECLARE libver text; projver text; geosver text; -#if POSTGIS_GDAL_VERSION > 0 +#ifdef POSTGIS_GDAL_VERSION gdalver text; #endif libxmlver text; @@ -2217,7 +2217,7 @@ BEGIN SELECT postgis_lib_version() INTO libver; SELECT postgis_proj_version() INTO projver; SELECT postgis_geos_version() INTO geosver; -#if POSTGIS_GDAL_VERSION > 0 +#ifdef POSTGIS_GDAL_VERSION SELECT postgis_gdal_version() INTO gdalver; #endif SELECT postgis_libxml_version() INTO libxmlver; @@ -2235,7 +2235,7 @@ BEGIN fullver = fullver || ' PROJ="' || projver || '"'; END IF; -#if POSTGIS_GDAL_VERSION > 0 +#ifdef POSTGIS_GDAL_VERSION IF gdalver IS NOT NULL THEN fullver = fullver || ' GDAL="' || gdalver || '"'; END IF; diff --git a/postgis/sqldefines.h.in b/postgis/sqldefines.h.in index c14fde6fb..20df2c399 100644 --- a/postgis/sqldefines.h.in +++ b/postgis/sqldefines.h.in @@ -11,9 +11,13 @@ #define POSTGIS_LIBXML2_VERSION @POSTGIS_LIBXML2_VERSION@ /* - * The trailing zero is needed in case POSTGIS_GDAL_VERSION does not exist or has no value + * POSTGIS_GDAL_VERSION may not be defined or have a value */ -#define POSTGIS_GDAL_VERSION @POSTGIS_GDAL_VERSION@0 +#if @POSTGIS_GDAL_VERSION@0 != 0 +#define POSTGIS_GDAL_VERSION @POSTGIS_GDAL_VERSION@ +#else +#undef POSTGIS_GDAL_VERSION +#endif /* * Define the build date and the version number diff --git a/raster/rt_core/rt_api.c b/raster/rt_core/rt_api.c index b30695039..3341ee4c3 100644 --- a/raster/rt_core/rt_api.c +++ b/raster/rt_core/rt_api.c @@ -7594,7 +7594,7 @@ 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 + increase extent by a 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. @@ -7609,16 +7609,21 @@ rt_raster_gdal_rasterize(const unsigned char *wkb, FLT_EQ(_width, 0) && FLT_EQ(_height, 0) ) { - /* + +#if POSTGIS_GDAL_VERSION > 18 + RASTER_DEBUG(3, "Adjusting extent for GDAL > 1.8 by half the scale"); src_env.MinX -= (_scale_x / 2.); src_env.MaxX += (_scale_x / 2.); src_env.MinY -= (_scale_y / 2.); src_env.MaxY += (_scale_y / 2.); - */ +#else + RASTER_DEBUG(3, "Adjusting extent for GDAL <= 1.8 by the scale"); src_env.MinX -= _scale_x; src_env.MaxX += _scale_x; src_env.MinY -= _scale_y; src_env.MaxY += _scale_y; +#endif + } /* user-defined skew */ -- 2.50.0