[postgis-tickets] [SCM] PostGIS branch master updated. 3.2.0alpha1-6-gc140fdb

git at osgeo.org git at osgeo.org
Tue Sep 21 07:22:31 PDT 2021


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, master has been updated
       via  c140fdb8ca581d47b9173f3bbef61b75e6c26deb (commit)
      from  97139b6e803b0588b64497cd1c60d47abb30572a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c140fdb8ca581d47b9173f3bbef61b75e6c26deb
Author: Björn Harrtell <bjorn at wololo.org>
Date:   Tue Sep 21 16:21:42 2021 +0200

    Consider empty geometry (fixes #4999)

diff --git a/deps/flatgeobuf/flatgeobuf_c.cpp b/deps/flatgeobuf/flatgeobuf_c.cpp
index 61d9dbc..dd87696 100644
--- a/deps/flatgeobuf/flatgeobuf_c.cpp
+++ b/deps/flatgeobuf/flatgeobuf_c.cpp
@@ -112,7 +112,7 @@ int flatgeobuf_encode_feature(ctx *ctx)
     Offset<Geometry> geometry = 0;
     Offset<Vector<uint8_t>> properties = 0;
 
-    if (ctx->lwgeom != NULL) {
+    if (ctx->lwgeom != NULL && !lwgeom_is_empty(ctx->lwgeom)) {
         LWDEBUGG(3, ctx->lwgeom, "GeometryWriter input LWGEOM");
         GeometryWriter writer(fbb, ctx->lwgeom, (GeometryType) ctx->geometry_type, ctx->has_z, ctx->has_m);
         geometry = writer.write(0);
@@ -142,11 +142,14 @@ int flatgeobuf_encode_feature(ctx *ctx)
 
     if (ctx->create_index) {
         auto item = (flatgeobuf_item *) lwalloc(sizeof(flatgeobuf_item));
-        auto gbox = lwgeom_get_bbox(ctx->lwgeom);
-        item->xmin = gbox->xmin;
-        item->xmax = gbox->xmax;
-        item->ymin = gbox->ymin;
-        item->ymax = gbox->ymax;
+        memset(item, 0, sizeof(flatgeobuf_item));
+        if (ctx->lwgeom != NULL && !lwgeom_is_empty(ctx->lwgeom)) {
+            auto gbox = lwgeom_get_bbox(ctx->lwgeom);
+            item->xmin = gbox->xmin;
+            item->xmax = gbox->xmax;
+            item->ymin = gbox->ymin;
+            item->ymax = gbox->ymax;
+        }
         item->offset = ctx->offset;
         item->size = size;
         ctx->items[ctx->features_count] = item;
diff --git a/regress/core/flatgeobuf.sql b/regress/core/flatgeobuf.sql
index d89875f..e324f80 100644
--- a/regress/core/flatgeobuf.sql
+++ b/regress/core/flatgeobuf.sql
@@ -36,6 +36,10 @@ select 'P4', id, ST_AsEWKT(geom) from ST_FromFlatGeobuf(null::flatgeobuf_t1, (
 select 'P5', id, ST_AsEWKT(geom) from ST_FromFlatGeobuf(null::flatgeobuf_t1, (
     select ST_AsFlatGeobuf(q, true) fgb from (select ST_SetSRID(ST_MakePoint(-71.1043443253471, 42.3150676015829),4326)) q)
 );
+-- Empty Point
+select 'P6', id, ST_AsEWKT(geom) from ST_FromFlatGeobuf(null::flatgeobuf_t1, (
+    select ST_AsFlatGeobuf(q, true) fgb from (select ST_GeomFromText('POINT EMPTY')) q)
+);
 
 -- 2D LineString
 select 'L1', id, ST_AsText(geom) from ST_FromFlatGeobuf(null::flatgeobuf_t1, (
diff --git a/regress/core/flatgeobuf_expected b/regress/core/flatgeobuf_expected
index 0087d1d..4d1b4b3 100644
--- a/regress/core/flatgeobuf_expected
+++ b/regress/core/flatgeobuf_expected
@@ -6,6 +6,7 @@ P2|0|POINT Z (1.1 2.11 3.2)
 P3|0|POINT ZM (1.1 2.12 3.2 4.3)
 P4|0|SRID=4326;POINT(-71.1043443253471 42.3150676015829)
 P5|0|SRID=4326;POINT(-71.1043443253471 42.3150676015829)
+P6|0|
 L1|0|LINESTRING(1 2,3 4)
 L2|0|LINESTRING Z (1 2 3,3 4 5)
 L3|0|LINESTRING ZM (1 2 3 5,3 4 5 6)

-----------------------------------------------------------------------

Summary of changes:
 deps/flatgeobuf/flatgeobuf_c.cpp | 15 +++++++++------
 regress/core/flatgeobuf.sql      |  4 ++++
 regress/core/flatgeobuf_expected |  1 +
 3 files changed, 14 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list