Odp: SRID lost in ST_UNION

Łukasz Szałek via postgis-users <[email protected]>
Newsgroups gmane.comp.gis.postgis
Message-ID <AS8PR07MB7976DE6A5EE37E7209E425AB8B452@AS8PR07MB7976.eurprd07.prod.outlook.com>
The same situation is in Postgis 3.5.0
@Erik Wienhold – do you know when some fix might appear?


Best regards
Łukasz Szałek


Od: Erik Wienhold <[email protected]>
Data: wtorek, 15 października 2024 o 15:59
Do: Łukasz Szałek <[email protected]>
DW: [email protected] <[email protected]>
Temat: Re: SRID lost in ST_UNION
[Nie otrzymujesz często wiadomości e-mail z [email protected]. Dowiedz się, dlaczego jest to ważne, na stronie https://aka.ms/LearnAboutSenderIdentification ]

On 2024-10-15 12:14 +0200, Łukasz Szałek via postgis-users wrote:
> 1)
> PostgreSQL 15.1 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit
> POSTGIS="3.3.2 4975da8" [EXTENSION] PGSQL="150" GEOS="3.11.1-CAPI-1.17.1" PROJ="7.2.1" LIBXML="2.9.1" LIBJSON="0.11"
>
> Query:
> select ST_SRID(ST_GeomFromText('POLYGON ((4.9882543 50.4415584, 4.9882543 50.4415586, 4.9882545 50.4415586, 4.9882545 50.4415584, 4.9882543 50.4415584))',4326)), st_srid(ST_UNION(ARRAY[ST_GeomFromText('POLYGON ((4.9882543 50.4415584, 4.9882543 50.4415586, 4.9882545 50.4415586, 4.9882545 50.4415584, 4.9882543 50.4415584))',4326)]));
> st_srid | st_srid
> ---------+---------
>     4326 |    4326
> (1 row)
>
>
> 2)
> PostgreSQL 17.0 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 11.4.1 20231218 (Red Hat 11.4.1-3), 64-bit
> POSTGIS="3.3.7 a0c7967" [EXTENSION] PGSQL="170" GEOS="3.13.0-CAPI-1.19.0" PROJ="9.5.0" LIBXML="2.9.13" LIBJSON="0.14" LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)"
>
> Query:
> select ST_SRID(ST_GeomFromText('POLYGON ((4.9882543 50.4415584, 4.9882543 50.4415586, 4.9882545 50.4415586, 4.9882545 50.4415584, 4.9882543 50.4415584))',4326)), st_srid(ST_UNION(ARRAY[ST_GeomFromText('POLYGON ((4.9882543 50.4415584, 4.9882543 50.4415586, 4.9882545 50.4415586, 4.9882545 50.4415584, 4.9882543 50.4415584))',4326)]));
> st_srid | st_srid
> ---------+---------
>     4326 |       0
>
> Is there a regression between those versions?

Yes, I see the same regression in 3.4.3 as well.  This is caused by [1]
which sets SRID=0 [2] because the SRID has not been determined at this
point.

[1] https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftrac.osgeo.org%2Fpostgis%2Fticket%2F5677&data=05%7C02%7CLukasz.Szalek%40tomtom.com%7Ca695afcc41294588cada08dced218a42%7C374f80267b544a3ab87d328fa26ec10d%7C0%7C0%7C638645975535855008%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=oRHG9AeOjggODtwV8AZwG5%2Boq6Wl9%2BcFs%2Fof2jZaMHE%3D&reserved=0<https://trac.osgeo.org/postgis/ticket/5677>
[2] https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftrac.osgeo.org%2Fpostgis%2Fbrowser%2Fgit%2Fpostgis%2Flwgeom_geos.c%3Frev%3Df37390b9cc4b33e8a7ec15e0396112fca19391c9%23L659&data=05%7C02%7CLukasz.Szalek%40tomtom.com%7Ca695afcc41294588cada08dced218a42%7C374f80267b544a3ab87d328fa26ec10d%7C0%7C0%7C638645975535881735%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=SFlNOLYkqr%2FTQNjEzAvH8%2FQHgI7OT2XSqE3e1rcve%2BE%3D&reserved=0<https://trac.osgeo.org/postgis/browser/git/postgis/lwgeom_geos.c?rev=f37390b9cc4b33e8a7ec15e0396112fca19391c9#L659>

--
Erik
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.