[postgis-tickets] [PostGIS] #4690: Line Clipping MVT failure?

PostGIS trac at osgeo.org
Fri May 15 15:59:21 PDT 2020


#4690: Line Clipping MVT failure?
---------------------+---------------------------
 Reporter:  pramsey  |      Owner:  Algunenano
     Type:  defect   |     Status:  assigned
 Priority:  medium   |  Milestone:  PostGIS 3.0.2
Component:  postgis  |    Version:  3.0.x
 Keywords:           |
---------------------+---------------------------
 This has been reported by numerous users of pg_tileserv, which is odd,
 because it seems very specific.

 * Download the data file attached.
 * Load it
 {{{
 ogr2ogr  \
   -f PostgreSQL "PG:dbname=postgis30" \
   test_mvt2.gpkg \
   -lco SCHEMA=temp \
   -lco GEOMETRY_NAME=geom \
   -nln test_streams_mvt_2 \
   test_streams_mvt
 }}}
 * Run this tile generation SQL on it
 {{{
 SELECT ST_AsMVT(mvtgeom, 'temp.test_streams_mvt_2', 4096, 'geom', 'id')
 FROM ( SELECT ST_AsMVTGeom(  ST_Transform(t."geom", 3857),
 bounds.geom_clip,  4096,  256   ) AS "geom"      , "feature_code",
 "downstream_route_measure", "length_metre", "watershed_key_50k",
 "watershed_group_code_50k", "gradient", "stream_magnitude",
 "blue_line_key_50k", "linear_feature_id", "watershed_group_id",
 "fwa_watershed_code", "local_watershed_code", "watershed_group_code",
 "id", "edge_type", "feature_source", "left_right_tributary",
 "waterbody_key", "watershed_code_50k", "blue_line_key", "watershed_key",
 "gnis_id", "gnis_name", "stream_order", "id"    FROM
 "temp"."test_streams_mvt_2" t, (  SELECT
 ST_MakeEnvelope(-1.375621910642657e+07, 6.183449840157604e+06,
 -1.3736651227185564e+07, 6.20301771939861e+06, 3857)  AS geom_clip,
 ST_MakeEnvelope(-1.3757442098879134e+07, 6.182226847705041e+06,
 -1.3735428234733e+07, 6.204240711851173e+06, 3857) AS geom_query  ) bounds
 WHERE ST_Intersects(t."geom",    ST_Transform(bounds.geom_query, 3005))
 LIMIT 10000  ) mvtgeom;
 }}}
 The error we are seeing is
 {{{
 ERROR:  lwcollection_construct: mixed dimension geometries: 2/0
 }}}
 This is percolating up from GEOS2LWGEOM
 {{{
 #0  lwcollection_construct (type=<optimized out>, srid=3857,
 bbox=bbox at entry=0x0, ngeoms=2, geoms=geoms at entry=0x2523988)
     at lwcollection.c:60
 #1  0x00007f01db7d7003 in GEOS2LWGEOM (geom=geom at entry=0x234a5b0,
 want3d=<optimized out>, want3d at entry=1 '\001') at lwgeom_geos.c:237
 #2  0x00007f01db7d97c8 in lwgeom_clip_by_rect
 (geom1=geom1 at entry=0x202da90, x1=-256, y1=-256, x2=4352, y2=4352) at
 lwgeom_geos.c:958
 #3  0x00007f01db73f9e6 in mvt_unsafe_clip_by_box (clip_box=0x7ffe652ed650,
 lwg_in=0x202da90) at mvt.c:869
 #4  mvt_iterate_clip_by_box_geos (basic_type=2 '\002',
 clip_gbox=0x7ffe652ed650, lwgeom=0x202da90) at mvt.c:966
 #5  mvt_clip_and_validate_geos (clip_geom=<optimized out>, buffer=256,
 extent=33741456, basic_type=2 '\002', lwgeom=0x202da90)
     at mvt.c:1105
 #6  mvt_clip_and_validate (clip_geom=<optimized out>, buffer=256,
 extent=33741456, basic_type=2 '\002', lwgeom=<optimized out>)
     at mvt.c:1140
 #7  mvt_geom (lwgeom=<optimized out>, gbox=gbox at entry=0x1feca68,
 extent=extent at entry=4096, buffer=buffer at entry=256,
     clip_geom=clip_geom at entry=true) at mvt.c:1223
 #8  0x00007f01db74634d in ST_AsMVTGeom (fcinfo=0x1fdfcc8) at
 lwgeom_out_mvt.c:111
 }}}
 It has been observed back to 2.4.

 On my home system, I cannot reproduce it. On a Centos7 system it
 reproduces (postgis 3.0.1, geos 3.8.1).
 }}}

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4690>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list