[postgis-tickets] [PostGIS] #4744: St_AsMVT Errors on Some Polygons with Inner Rings

PostGIS trac at osgeo.org
Tue Aug 18 11:17:58 PDT 2020


#4744: St_AsMVT Errors on Some Polygons with Inner Rings
----------------------+---------------------------
  Reporter:  reyemtm  |      Owner:  pramsey
      Type:  defect   |     Status:  new
  Priority:  medium   |  Milestone:  PostGIS 3.1.0
 Component:  postgis  |    Version:  3.0.x
Resolution:           |   Keywords:  vector tiles
----------------------+---------------------------

Comment (by reyemtm):

 I have the same issue from two different servers. I did not write either
 of these queries. Not sure which one is easier to understand out of
 context - the servers are pg_tileserv and dirt-simple-postgis-http-api, so
 they can be looked up GitHub for context. This one is from the latter.
 They seem like pretty straight forward mvt queries.

 I added the ST_MakeValid(), but again it did nothing.

  `WITH mvtgeom as (
       SELECT
         ST_AsMVTGeom (
           ST_MakeValid(ST_Transform(${query.geom_column}, 3857)),
           ST_TileEnvelope(${params.z}, ${params.x}, ${params.y})
         ) as geom
         ${query.columns ? `, ${query.columns}` : ',*'}
         ${query.id_column ? `, ${query.id_column}` : ''}
       FROM
         ${params.table},
         (SELECT ST_SRID(${query.geom_column}) AS srid FROM ${params.table}
   LIMIT 1) a
       WHERE
         ST_Intersects(
           geom,
           ST_Transform(
             ST_TileEnvelope(${params.z}, ${params.x}, ${params.y}),
             srid
           )
         )
         ${query.filter ? ` AND ${query.filter}` : ''}
     )
     SELECT ST_AsMVT(mvtgeom.*, '${params.table}', 4096, 'geom' ${
     query.id_column ? `, '${query.id_column}'` : ''
   }) AS mvt from mvtgeom;
   `

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4744#comment:3>
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