osmcode / osmcoastline

Extracts coastline data from OpenStreetMap planet file.
https://osmcode.org/osmcoastline/
GNU General Public License v3.0
108 stars 14 forks source link

osmcoastline does not compile with GDAL 1.11.0 #10

Closed Feufochmar closed 10 years ago

Feufochmar commented 10 years ago

While compiling osmcoastline with GDAL 1.11.0, I went into a compilation error in the file output_layers.cpp at line 227 because of a signature change in the undocumented method OGRGeometry:: exportToGEOS. This method now needs a parameter.

The patch to apply to compile osmcoastline with GDAL 1.11.0 is :

--- a/output_layers.cpp
+++ b/output_layers.cpp
@@ -224,7 +224,9 @@ void LayerRings::add(OGRPolygon* polygon, int osm_id, int nways, int npoints, bo
            function from the GEOS C interface to get to the reason.
         */

-        std::string reason = GEOSisValidReason(polygon->exportToGEOS());
+        GEOSContextHandle_t contextHandle = OGRGeometry::createGEOSContext();
+        std::string reason = GEOSisValidReason(polygon->exportToGEOS(contextHandle));
+        OGRGeometry::freeGEOSContext(contextHandle);
         size_t left_bracket = reason.find('[');
         size_t right_bracket = reason.find(']');
joto commented 10 years ago

@Feufochmar: Can you verify this works now?

Feufochmar commented 10 years ago

I confirm. This compiles and works with GDAL 1.11.0.