Permalink
Browse files

Fixed GDALOpen call parameter and added an error check for GDALContou…

…rGenerate call
  • Loading branch information...
1 parent 3745e3c commit 5589896ab652b41a6928727322f3dcf3f99ad959 Alan Boudreault committed Jul 4, 2013
Showing with 7 additions and 1 deletion.
  1. +7 −1 mapcontour.c
View
@@ -415,7 +415,7 @@ static int msContourLayerReadRaster(layerObj *layer, rectObj rect)
CPLPrintPointer(pointer, clinfo->buffer, sizeof(pointer));
sprintf(memDSPointer,"MEM:::DATAPOINTER=%s,PIXELS=%d,LINES=%d,BANDS=1,DATATYPE=Float64",
pointer, dst_xsize, dst_ysize);
- clinfo->hDS = GDALOpen(memDSPointer, GF_Read);
+ clinfo->hDS = GDALOpen(memDSPointer, GA_ReadOnly);
if (clinfo->hDS == NULL) {
msSetError(MS_IMGERR,
"Unable to open GDAL Memory dataset.",
@@ -584,6 +584,12 @@ static int msContourLayerGenerateContour(layerObj *layer)
elevItem ),
NULL, NULL );
+ if (eErr != CE_None) {
+ msSetError( MS_IOERR, "GDALContourGenerate() failed: %s",
+ "msContourLayerGenerateContour()", CPLGetLastErrorMsg() );
+ return MS_FAILURE;
+ }
+
msConnPoolRegister(&clinfo->ogrLayer, clinfo->hOGRDS, msContourOGRCloseConnection);
return MS_SUCCESS;

0 comments on commit 5589896

Please sign in to comment.