Skip to content

Commit 45f46aa

Browse files
nls-jajukojmckenna
authored andcommitted
seed geos geometry fix (#331)
1 parent 11175e3 commit 45f46aa

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

util/mapcache_seed.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,9 @@ int ogr_features_intersect_tile(mapcache_context *ctx, mapcache_tile *tile)
318318
{
319319
mapcache_metatile *mt = mapcache_tileset_metatile_get(ctx,tile);
320320
GEOSCoordSequence *mtbboxls = GEOSCoordSeq_create(5,2);
321-
GEOSGeometry *mtbbox = GEOSGeom_createLinearRing(mtbboxls);
322-
GEOSGeometry *mtbboxg = GEOSGeom_createPolygon(mtbbox,NULL,0);
321+
// linearring and polygon creation moved after coords - more recent GEOS seems to assume coordinates are set
322+
GEOSGeometry *mtbbox = NULL;
323+
GEOSGeometry *mtbboxg = NULL;
323324
int i;
324325
int intersects = 0;
325326
GEOSCoordSeq_setX(mtbboxls,0,mt->map.extent.minx);
@@ -332,6 +333,10 @@ int ogr_features_intersect_tile(mapcache_context *ctx, mapcache_tile *tile)
332333
GEOSCoordSeq_setY(mtbboxls,3,mt->map.extent.maxy);
333334
GEOSCoordSeq_setX(mtbboxls,4,mt->map.extent.minx);
334335
GEOSCoordSeq_setY(mtbboxls,4,mt->map.extent.miny);
336+
// moved after coords - more recent GEOS seems to assume coordinates are set
337+
mtbbox = GEOSGeom_createLinearRing(mtbboxls);
338+
mtbboxg = GEOSGeom_createPolygon(mtbbox,NULL,0);
339+
335340
for(i=0; i<nClippers; i++) {
336341
const GEOSPreparedGeometry *clipper = clippers[i];
337342
if(GEOSPreparedIntersects(clipper,mtbboxg)) {

0 commit comments

Comments
 (0)