diff --git a/src/SpatialReference.cpp b/src/SpatialReference.cpp index 73448c6036..7f9959b92d 100644 --- a/src/SpatialReference.cpp +++ b/src/SpatialReference.cpp @@ -278,11 +278,17 @@ bool SpatialReference::isGeographic() const OGRSpatialReferenceH current = OSRNewSpatialReference(getWKT(eCompoundOK, false).c_str()); - bool geog = static_cast(OSRIsGeographic(current)); + int isGeog = OSRIsGeographic(current); + bool output(false); + + if (isGeog == 0) + output = false; + else + output = true; OSRDestroySpatialReference(current); - return geog; + return output; #else throw std::runtime_error("GDAL is not available, SpatialReference could not determine if isGeographic"); #endif