[gdal-dev] layer.GetSpatialRef() fails on linux for shapefiles

Even Rouault even.rouault at spatialys.com
Thu Sep 21 05:39:36 PDT 2023


Run ogrinfo on one shapefile to see if some more interesting error 
message is displayed

Also check if the environment isn't messed up regarding PROJ and the 
PROJ_LIB/PROJ_DATA environment variable

Le 21/09/2023 à 14:34, Jonathan Moules via gdal-dev a écrit :
>
> Yeah, I'm afraid the error message is pretty much non-existent:
>
>     Traceback (most recent call last):
>       File
>     "/home/name/Code/DSHub/PoC/Extract-Transform-Load-POC/Metadata/AME/src/info_vector.py",
>     line 119, in get_layer_metadata
>         tmp_projection = layer.GetSpatialRef()
>                          ^^^^^^^^^^^^^^^^^^^^^
>       File
>     "/home/name/anaconda3/envs/AME_env/lib/python3.11/site-packages/osgeo/ogr.py",
>     line 1990, in GetSpatialRef
>         return _ogr.Layer_GetSpatialRef(self, *args)
>                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>     RuntimeError
>
>
> Suggestions welcome.
>
>
> On 18/09/2023 12:51, Javier Jimenez Shaw wrote:
>> Hi Jonathan
>>
>> Which exact RuntimeError are you getting? It can be for several 
>> reasons (probably an installation or configuration issue).
>>
>> Best,
>> Javier
>>
>>
>> On Mon, 18 Sept 2023 at 11:06, Jonathan Moules 
>> <jonathan-lists at lightpear.com> wrote:
>>
>>     Hi List,
>>
>>     I'm trying to get vector layer information via OGR and Python:
>>
>>     ```
>>
>>     layer.GetSpatialRef()
>>
>>     ```
>>
>>     This works fine for me on Windows with GDAL 3.7.1 on various
>>     different
>>     types of files (Shapefile, GPKG, GML, KML, GDB).
>>
>>     But for my colleague on Ubuntu 22.0.4.3, also on GDAL 3.7.1 (via
>>     Conda),
>>     they get a Python RuntimeError for all shapefiles (the exact same
>>     shapefiles that work fine for me). It works for Geopackages for them.
>>
>>     Anyone have any thoughts?
>>     Thanks,
>>     Jonathan
>>
>>     _______________________________________________
>>     gdal-dev mailing list
>>     gdal-dev at lists.osgeo.org
>>     https://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230921/d51c779b/attachment.htm>


More information about the gdal-dev mailing list