[PostGIS] #5799: ST_TileEnvelope with margin is not clipped fully to WM extent

PostGIS trac at osgeo.org
Thu Oct 17 11:43:48 PDT 2024


#5799: ST_TileEnvelope with margin is not clipped fully to WM extent
---------------------+---------------------------
 Reporter:  mdavis   |      Owner:  pramsey
     Type:  defect   |     Status:  new
 Priority:  medium   |  Milestone:  PostGIS 3.5.1
Component:  postgis  |    Version:  3.5.x
 Keywords:           |
---------------------+---------------------------
 When executing [https://postgis.net/docs/manual-3.5/ST_TileEnvelope.html
 ST_TileEnvelope] with a `margin` parameter the resulting polygon is only
 partially clipped to the WebMercator maximum extents.  This causes
 problems in downstream processing (e.g. when converting to geodetic via
 `ST_Transform( env, 4326)`).

 For example, the tile envelope for (z=1, x=0, y=1) is:
 {{{
 SELECT ST_AsText( ST_TileEnvelope(1,0,1));

 POLYGON((-20037508.342789244 -20037508.342789244,-20037508.342789244 0,0
 0,0 -20037508.342789244,-20037508.342789244 -20037508.342789244))
 }}}
 With a margin of 0.1 the result is:
 {{{
 SELECT ST_AsText( ST_TileEnvelope(1,0,1, margin => 0.1));

 POLYGON((-22041259.17706817 -20037508.342789244,-22041259.17706817
 2003750.834278924,2003750.8342789263 2003750.834278924,2003750.8342789263
 -20037508.342789244,-22041259.17706817 -20037508.342789244))
 }}}
 This is clipped in the Y dimension to the WM extents (```-20037508.342789
 -20037508.342789,  20037508.342789 20037508.342789```). But it extends
 beyond the X extent to the left.  It should also be clipped in the X
 dimension, to avoid causing problems with further computation.
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5799>
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