From 45f46aaec0d04bcaf283b934a401521343174914 Mon Sep 17 00:00:00 2001 From: nls-jajuko Date: Thu, 4 Apr 2024 17:28:38 +0300 Subject: [PATCH] seed geos geometry fix (#331) --- util/mapcache_seed.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/util/mapcache_seed.c b/util/mapcache_seed.c index 7778e15d..ab9da848 100644 --- a/util/mapcache_seed.c +++ b/util/mapcache_seed.c @@ -318,8 +318,9 @@ int ogr_features_intersect_tile(mapcache_context *ctx, mapcache_tile *tile) { mapcache_metatile *mt = mapcache_tileset_metatile_get(ctx,tile); GEOSCoordSequence *mtbboxls = GEOSCoordSeq_create(5,2); - GEOSGeometry *mtbbox = GEOSGeom_createLinearRing(mtbboxls); - GEOSGeometry *mtbboxg = GEOSGeom_createPolygon(mtbbox,NULL,0); + // linearring and polygon creation moved after coords - more recent GEOS seems to assume coordinates are set + GEOSGeometry *mtbbox = NULL; + GEOSGeometry *mtbboxg = NULL; int i; int intersects = 0; GEOSCoordSeq_setX(mtbboxls,0,mt->map.extent.minx); @@ -332,6 +333,10 @@ int ogr_features_intersect_tile(mapcache_context *ctx, mapcache_tile *tile) GEOSCoordSeq_setY(mtbboxls,3,mt->map.extent.maxy); GEOSCoordSeq_setX(mtbboxls,4,mt->map.extent.minx); GEOSCoordSeq_setY(mtbboxls,4,mt->map.extent.miny); + // moved after coords - more recent GEOS seems to assume coordinates are set + mtbbox = GEOSGeom_createLinearRing(mtbboxls); + mtbboxg = GEOSGeom_createPolygon(mtbbox,NULL,0); + for(i=0; i