[postgis-users] can't import a shapefile with different SRID in a geometry column
Regina Obe
lr at pcorp.us
Tue May 17 14:11:59 PDT 2022
1) Are you sure QGIS is not setting the SRID to 2154 for some reason
2) Are you sure your QGIS load is not erroring out for some reason, e.g. you file is not multipolygon but instead POINT or POLYGON.
3) Also to allow mixed geometry SRID, you don’t need to pass in the srid.
This is slightly shorter and clearer in purpose:
alter table activite.prescription
alter column geom type geometry(MULTIPOLYGON);
From: postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of mathias cunault
Sent: Friday, May 13, 2022 8:06 AM
To: postgis-users at lists.osgeo.org
Subject: [postgis-users] can't import a shapefile with different SRID in a geometry column
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.prescription
alter 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. Maginot
37000 TOURS
06 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/20220517/07669ecb/attachment.htm>
More information about the postgis-users
mailing list