return ET_INTERSECTION;
}
+/*
+ convert the spatial reference string from a GDAL recognized format to either WKT or Proj4
+*/
char*
rt_util_gdal_convert_sr(const char *srs, int proj4) {
OGRSpatialReferenceH hsrs;
return rtn;
}
+/*
+ is the spatial reference string supported by GDAL
+*/
int
rt_util_gdal_supported_sr(const char *srs) {
OGRSpatialReferenceH hsrs;
return 0;
}
+/*
+ is GDAL configured correctly?
+*/
+int rt_util_gdal_configured(void) {
+
+ /* set of EPSG codes */
+ if (!rt_util_gdal_supported_sr("EPSG:4326"))
+ return 0;
+ if (!rt_util_gdal_supported_sr("EPSG:4269"))
+ return 0;
+ if (!rt_util_gdal_supported_sr("EPSG:4267"))
+ return 0;
+ if (!rt_util_gdal_supported_sr("EPSG:3310"))
+ return 0;
+ if (!rt_util_gdal_supported_sr("EPSG:2163"))
+ return 0;
+
+ return 1;
+}
+
+/*
+ is the driver registered?
+*/
int
rt_util_gdal_driver_registered(const char *drv) {
int count = GDALGetDriverCount();
rt_extenttype
rt_util_extent_type(const char *name);
+/*
+ convert the spatial reference string from a GDAL recognized format to either WKT or Proj4
+*/
char*
rt_util_gdal_convert_sr(const char *srs, int proj4);
+/*
+ is the spatial reference string supported by GDAL
+*/
int
rt_util_gdal_supported_sr(const char *srs);
+/*
+ is GDAL configured correctly?
+*/
+int
+rt_util_gdal_configured(void);
+
+/*
+ is the driver registered?
+*/
int
rt_util_gdal_driver_registered(const char *drv);
Datum RASTER_gdal_version(PG_FUNCTION_ARGS)
{
const char *ver = rt_util_gdal_version("--version");
- text *result = cstring2text(ver);
+ text *result;
+
+ /* add indicator if GDAL isn't configured right */
+ if (!rt_util_gdal_configured()) {
+ char *rtn = NULL;
+ rtn = palloc(strlen(ver) + strlen(" MISSING GDAL DATA") + 1);
+ if (!rtn)
+ result = cstring2text(ver);
+ else {
+ sprintf(rtn, "%s MISSING GDAL DATA", ver);
+ result = cstring2text(rtn);
+ pfree(rtn);
+ }
+ }
+ else
+ result = cstring2text(ver);
+
PG_RETURN_POINTER(result);
}
return raster;
}
+static void testGDALConfigured() {
+ int rtn;
+
+ rtn = rt_util_gdal_configured();
+ CHECK((rtn != 0));
+}
+
static void testGDALPolygonize() {
int i;
rt_raster rt;
rt_raster_set_skews(raster, 0, 0);
}
+ printf("Testing rt_util_gdal_configured... ");
+ testGDALConfigured();
+ printf("OK\n");
+
printf("Testing rt_raster_gdal_polygonize... ");
testGDALPolygonize();
printf("OK\n");
PATH := $(PGSQL_BINDIR):$(PATH)
export PATH
+TEST_FIRST = \
+ check_gdal
+
TEST_METADATA = \
check_raster_columns \
check_raster_overviews
loader/Tiled10x10 \
loader/Tiled10x10Copy
-TESTS = $(TEST_METADATA) $(TEST_IO) $(TEST_FUNC) \
+TESTS = $(TEST_FIRST) $(TEST_METADATA) $(TEST_IO) $(TEST_FUNC) \
$(TEST_PROPS) $(TEST_BANDPROPS) \
$(TEST_UTILITY) $(TEST_GIST) $(TEST_SREL) \
$(TEST_BUGS) \
--- /dev/null
+SELECT
+ CASE
+ WHEN strpos(postgis_gdal_version(), 'MISSING') <> 0
+ THEN false
+ ELSE NULL
+ END;