[Tile-serving] [osm2pgsql-dev/osm2pgsql] Transform all estimated extents to EPSG:3857 (PR #2498)
Nakaner
notifications at github.com
Fri Jul 31 14:15:14 UTC 2026
Nakaner left a comment (osm2pgsql-dev/osm2pgsql#2498)
> Haven't look at it in detail yet, but ST_SRID(way) is definitely wrong, because it hardcodes the geometry column.
Oh, sorry, that `way` should not have made it into the pull request. I pushed a new commit.
> What happens if table is empty?
If the table is empty, `NULL` are returned by both the old and the new query. However, if geometries have no SRID set, the `ST_Transform` throws an error: "ST_Transform: Input geometry has unknown (0) SRID". I pushed a new commit fixing this.
Old implementation (for empty tables, it does not matter if the geometry column has an SRID set or not):
```sql
CREATE TABLE test (osm_id BIGINT NOT NULL, geom geometry(Point, 3857));
ANALYZE test;
SELECT ST_XMin(e), ST_YMin(e), ST_XMax(e), ST_YMax(e) FROM ST_EstimatedExtent('public', 'test', 'geom') AS e; -- NULLs returned
SELECT ST_XMin(e), ST_YMin(e), ST_XMax(e), ST_YMax(e)
FROM ST_Transform(
ST_SetSRID(
ST_EstimatedExtent('public', 'test', 'geom'),
(SELECT ST_SRID(geom) FROM public.test LIMIT 1)
),
3857) e; -- NULLs returned
```
If the SQL query returns `NULL`s, an invalid extent will be returned (and logged as "Source table empty, nothing to do.").
By looking on the code a second time, I found that an unset SRID will cause an error. I fixed this in a new commit.
--
Reply to this email directly or view it on GitHub:
https://github.com/osm2pgsql-dev/osm2pgsql/pull/2498#issuecomment-5143838252
You are receiving this because you are subscribed to this thread.
Message ID: <osm2pgsql-dev/osm2pgsql/pull/2498/c5143838252 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20260731/4ca74e05/attachment.htm>
More information about the Tile-serving
mailing list