#4641 closed enhancement (fixed)
ST_TileEnvelope default geometry precision
Reported by: | Algunenano | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 3.1.0 |
Component: | postgis | Version: | master |
Keywords: | Cc: |
Description
Today I was tinkering with ST_TileEnvelope and projections and notice that things weren't exact.
For example, when transforming 0/0/0 to 4326 I'd expect x to go from -180 to 180; but it is just a tiny bit less:
SELECT ST_AsText( ST_Transform(ST_TileEnvelope(0, 0, 0), 4326)); st_astext ----------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------- POLYGON((-179.999999999998 -85.0511287798064,-179.999999999998 85.0511287798064,179.999999999998 85.0511287798064,179.999999 999998 -85.0511287798064,-179.999999999998 -85.0511287798064))
I'm not sure if this is worth fixing, but changing to a more precise input does return the expected 180:
SELECT ST_AsText(ST_Transform(ST_TileEnvelope(0, 0, 0, ST_SetSRID(ST_MakeBox2D( ST_Point(- 6378137.0 * pi(), - 6378137.0 * pi()), ST_Point(6378137.0 * pi(), 6378137.0 * pi())),3857)), 4326) ); st_astext --------------------------------------------------------------------------------------------------------------------------- POLYGON((-180 -85.0511287798066,-180 85.0511287798066,180 85.0511287798066,180 -85.0511287798066,-180 -85.0511287798066))
Any thoughts?
Change History (3)
comment:1 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 by , 5 years ago
I'm not sure why updating the default value doesn't require dropping the old one, but it works:
# Select postgis_extensions_upgrade(); NOTICE: Updating extension postgis 3.1.0dev NOTICE: Updating extension postgis_raster 3.1.0dev NOTICE: Updating extension postgis_topology 3.1.0dev NOTICE: Extension postgis_tiger_geocoder is not available or not packagable for some reason postgis_extensions_upgrade ------------------------------------------------------------------- Upgrade completed, run SELECT postgis_full_version(); for details (1 row) # \df *st_tileenvelope* List of functions Schema | Name | Result data type | Argument data types | T ype --------+-----------------+------------------+------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------+-- ---- public | st_tileenvelope | geometry | zoom integer, x integer, y integer, bounds geometry DEFAULT '0102000020110F000 00200000093107C45F81B73C193107C45F81B73C193107C45F81B734193107C45F81B7341'::geometry, margin double precision DEFAULT 0.0 | f unc # SELECT ST_AsText( ST_Transform(ST_TileEnvelope(0, 0, 0), 4326)); st_astext st_astext --------------------------------------------------------------------------------------------------------------------------- POLYGON((-180 -85.0511287798066,-180 85.0511287798066,180 85.0511287798066,180 -85.0511287798066,-180 -85.0511287798066)) (1 row)
So LGTM. Thanks for tackling this, Paul.
Note:
See TracTickets
for help on using tickets.
In 57ff7ac/git: