[postgis-users] can't import a shapefile with different SRID in a geometry column

mathias cunault mathias.cunault at inrap.fr
Fri May 13 05:06:24 PDT 2022


*PostgreSQL 13, PostGIS 3, QGIS 3.22*

In a table, I had a geometry column geom with a SRID 2154.
Now I have to store geometries with different SRIDs in geom. So I did :

alter table activite.prescriptionalter column geom type
geometry(MULTIPOLYGON, 0),

to be able to store different SRIDs, replacing 2154 with 0.

SELECT Find_SRID('activite', 'prescription', 'geom')

returns 0 as expected.

Now I try to upload a shapefile with a SRID 5490 using QGIS and the
plugin export
to PostgreSQL. (The shapefile has the correct .prj file)

If the shp is imported correctly, even the geometry, its SRID is
"converted" in 2154. It is not a reprojection but just a ununderstandable
change. No trigger is activated.

select distinct st_srid(geom) from activite.prescription

returns just *one* SRID 2154!

When I load the layer in QGIS choosing 5490 to display the feature, the
layer is indeed empty.

When I run a query like select st_setsrid(geom)... applied to the feature
imported, it returns 2154 so to speak the SRID initially existing.

Why can't I keep the different SRIDs ?

*----------*
*Mathias Cunault*

*référent SIG / Admin Caviar*

*Inrap Tours - 148 av. Maginot37000 TOURS06 32 05 98 96*
abonnez-vous à la lettre d'information de l'Inrap : http://ww
<http://www.inrap.fr/newsletter.php>w.inrap.fr/newsletter.php
<http://www.inrap.fr/newsletter.php>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20220513/5852b952/attachment.htm>


More information about the postgis-users mailing list