Skip to content

Commit

Permalink
seed geos geometry fix (#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
nls-jajuko committed Apr 4, 2024
1 parent 7104eca commit 4be395e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions util/mapcache_seed.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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<nClippers; i++) {
const GEOSPreparedGeometry *clipper = clippers[i];
if(GEOSPreparedIntersects(clipper,mtbboxg)) {
Expand Down

0 comments on commit 4be395e

Please sign in to comment.