Skip to content

Commit f5cd0f2

Browse files
committed
osm2pgsql: Tweak geos includes to work with geos-3. Hopefully this should continue to work with geos-2.2 as well
1 parent 5526470 commit f5cd0f2

1 file changed

Lines changed: 10 additions & 16 deletions

File tree

build_geometry.cpp

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,11 @@
2424
#include <cstring>
2525
#include <cstdlib>
2626

27-
/*
28-
# the only reason we include this C header is to obtain the GEOS_VERSION_MAJOR
29-
# definition to work out which headers we _really_ want. This version
30-
# number is not present in any of the C++ headers (or at least it wasn't
31-
# when I originally added those lines, probably 12+ months ago). This
32-
# seemed the only easy way to support both geos versions.
33-
*/
34-
#include <geos_c.h>
27+
/* Need to know which geos version we have to work out which headers to include */
28+
#include <geos/version.h>
3529

3630
#if (GEOS_VERSION_MAJOR==3)
37-
/* geos trunk (3.0.0rc) */
31+
/* geos trunk (3.0.0+) */
3832
#include <geos/geom/GeometryFactory.h>
3933
#include <geos/geom/CoordinateSequenceFactory.h>
4034
#include <geos/geom/Geometry.h>
@@ -208,14 +202,14 @@ int parse_wkt(const char * wkt, struct osmNode *** xnodes, int ** xcount, int *
208202
geometry = reader.read(wkt_string);
209203
switch (geometry->getGeometryTypeId()) {
210204
// Single geometries
211-
case geos::GEOS_POLYGON:
205+
case GEOS_POLYGON:
212206
// Drop through
213-
case geos::GEOS_LINEARRING:
207+
case GEOS_LINEARRING:
214208
*polygon = 1;
215209
// Drop through
216-
case geos::GEOS_POINT:
210+
case GEOS_POINT:
217211
// Drop through
218-
case geos::GEOS_LINESTRING:
212+
case GEOS_LINESTRING:
219213
*xnodes = (struct osmNode **) malloc(2 * sizeof(struct osmNode *));
220214
*xcount = (int *) malloc(sizeof(int));
221215
coords = geometry->getCoordinates();
@@ -224,12 +218,12 @@ int parse_wkt(const char * wkt, struct osmNode *** xnodes, int ** xcount, int *
224218
delete coords;
225219
break;
226220
// Geometry collections
227-
case geos::GEOS_MULTIPOLYGON:
221+
case GEOS_MULTIPOLYGON:
228222
*polygon = 1;
229223
// Drop through
230-
case geos::GEOS_MULTIPOINT:
224+
case GEOS_MULTIPOINT:
231225
// Drop through
232-
case geos::GEOS_MULTILINESTRING:
226+
case GEOS_MULTILINESTRING:
233227
gc = (GeometryCollection *) geometry;
234228
num_geometries = gc->getNumGeometries();
235229
*xnodes = (struct osmNode **) malloc((num_geometries + 1) * sizeof(struct osmNode *));

0 commit comments

Comments
 (0)