[postgis-tickets] [PostGIS] #4289: A multipolygon is inverted in ST_AsMVTGeom in some cases

PostGIS trac at osgeo.org
Wed Jan 9 07:20:34 PST 2019


#4289: A multipolygon is inverted in ST_AsMVTGeom in some cases
-------------------------+---------------------
 Reporter:  ajolma       |      Owner:  pramsey
     Type:  defect       |     Status:  new
 Priority:  medium       |  Milestone:
Component:  postgis      |    Version:  trunk
 Keywords:  vector tile  |
-------------------------+---------------------
 A complex multipolygon is inverted (areas in the tile not in the
 multipolygon become multipolygon and vice versa) when preparing a tile.

 The problematic multipolygon is attached.

 I'm using the command
 {{{
 SELECT ST_AsMVTGeom(ST_Transform(problem.geom, 3857), TileBBox(12, 2358,
 1093, 3857), 256, 10, TRUE) geom
 INTO test
 FROM problem
 WHERE ST_Intersects(TileBBox(12, 2358, 1093, 3857), problem.geom)
 }}}
 TileBBox is a function
 {{{
 create or replace function TileBBox (z int, x int, y int, srid int = 3857)
     returns geometry
     language plpgsql immutable as
 $func$
 declare
     max numeric := 20037508.34;
     res numeric := (max*2)/(2^z);
     bbox geometry;
 begin
     bbox := ST_MakeEnvelope(
         -max + (x * res),
         max - (y * res),
         -max + (x * res) + res,
         max - (y * res) - res,
         3857
     );
     if srid = 3857 then
         return bbox;
     else
         return ST_Transform(bbox, srid);
     end if;
 end;
 $func$;
 }}}

 PostGIS is https://postgis.net/stuff/postgis-3.0.0dev.tar.gz downloaded
 today.

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4289>
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