Re: [gdal-dev] layer.GetSpatialRef() fails on linux for shapefiles
Hi Javier, I've come across some other bugs that are specific to Conda running in Pycharm only this morning. Up to and including getting different projection strings back for the exact same file, depending on whether the `GetProjectionRef` is called via Pycharm or the terminal (using the exact same conda environment). `osr.SpatialReference().ImportFromEPSG(4326)` returns a RuntimeError in Pycharm but works in the terminal: PROJ: proj_create_from_database: Open of /some/path/anaconda3/envs/abc/share/proj failed So there's something weird going on with environment's that's Posix specific. Thanks, Jonathan On 2023-10-12 09:10, Javier Jimenez Shaw wrote: Are you running pycharm under the conda environment? If you lose any setting while combining both it can be a problem. Have you tried setting PROJ_DEBUG=3 ? It will show some traces from PROJ, like the location of proj.db used. The point is if you can see the std out. On Wed, 11 Oct 2023, 15:18 Jonathan Moules via gdal-dev, wrote: Hi List, So, after more investigation: * Using Python Anaconda on either Mac or Linux for GDAL (3.7.1), `GetSpatialRef` triggers a RunTime Error for all shapefiles (but only shapefiles). * This happens on Ubuntu (two machines), and a Mac, but only under PyCharm. * Using the exact same `conda` environment as triggers the above: running it directly from the terminal works fine. So there's something about the combination of conda and Pycharm that breaks this aspect of GDAL shapefile handling on *nix and Mac. Any thoughts? Also, who do I actually report this bug to? Is it GDAL, Conda, Pycharm, something else? Cheers, Jonathan On 2023-09-28 14:58, Jonathan Moules via gdal-dev wrote: > Well, it seems that PROJ_DATA isn't set in their environment. But it's > not set in mine either (`print(os.environ['PROJ_DATA']`)! So no idea > why mine works just fine without it (Windows 11 thing?). > > Creating a PROJ_DATA env var didn't fix anything. Even adding it > explicitly in Python. > > Their log file does have this in at a WARNING level: > > `PROJ: proj_create_from_database: Open of > /home/user/anaconda3/envs/env1/share/proj failed` > > That path has: `drwxrwxr-x` permissions. > > To answer Even's earlier question: > > `ogrinfo /path/to/shape.shp` works fine on their system. > > > > On 2023-09-28 12:37, Rahkonen Jukka wrote: >> Hi, >> >> Then they should add that environment if they do not know that they >> do not belong to "most users" >> https://proj.org/en/9.3/usage/environmentvars.html >> >> -Jukka Rahkonen- >> >> -Alkuperäinen viesti- >> Lähettäjä: gdal-dev Puolesta >> Jonathan Moules via gdal-dev >> Lähetetty: torstai 28. syyskuuta 2023 14.10 >> Vastaanottaja: gdal-dev@lists.osgeo.org; Even Rouault >> >> Aihe: Re: [gdal-dev] layer.GetSpatialRef() fails on linux for shapefiles >> >> Hi Even, >> >> The colleague doesn't have either a PROJ_LIB or a PROJ_DATA >> environment variable. >> >> I asked another colleague to try it; they're on Ubuntu 20.04, and it >> worked for them. I believe using the same setup instructions. >> >> Cheers, >> >> Jonathan >> >> On 2023-09-24 22:37, Jonathan Moules via gdal-dev wrote: >>> Thanks Even. I don't have access to the machine either as the >>> colleague is moving to another project. I'll have to see if it fails >>> for another *nix user. >>> >>> On 2023-09-24 22:35, Even Rouault wrote: >>>> Le 24/09/2023 à 23:22, Jonathan Moules via gdal-dev a écrit : >>>>>> Also check if the environment isn't messed up regarding PROJ and >>>>> the PROJ_LIB/PROJ_DATA environment variable >>>>> >>>>> Thanks Even; sorry, what does this line mean? I'm guessing you're >>>>> referring to: >>>>> https://proj.org/en/9.3/usage/environmentvars.html - what would a >>>>> "messed up" one look like? >>>>> >>>> Hard to say without access to the machine. Perhaps just try to >>>> recreate a new Conda env from scratch >>>> >>>> >>> ___ >>> gdal-dev mailing list >>> gdal-dev@lists.osgeo.org >>> https://list/ >>> s.osgeo.org <http://s.osg
Re: [gdal-dev] layer.GetSpatialRef() fails on linux for shapefiles
Are you running pycharm under the conda environment? If you lose any setting while combining both it can be a problem. Have you tried setting PROJ_DEBUG=3 ? It will show some traces from PROJ, like the location of proj.db used. The point is if you can see the std out. On Wed, 11 Oct 2023, 15:18 Jonathan Moules via gdal-dev, < gdal-dev@lists.osgeo.org> wrote: > Hi List, > > So, after more investigation: > > * Using Python Anaconda on either Mac or Linux for GDAL (3.7.1), > `GetSpatialRef` triggers a RunTime Error for all shapefiles (but only > shapefiles). > > * This happens on Ubuntu (two machines), and a Mac, but only under PyCharm. > > * Using the exact same `conda` environment as triggers the above: > running it directly from the terminal works fine. > > So there's something about the combination of conda and Pycharm that > breaks this aspect of GDAL shapefile handling on *nix and Mac. > > Any thoughts? Also, who do I actually report this bug to? Is it GDAL, > Conda, Pycharm, something else? > > Cheers, > > Jonathan > > > On 2023-09-28 14:58, Jonathan Moules via gdal-dev wrote: > > Well, it seems that PROJ_DATA isn't set in their environment. But it's > > not set in mine either (`print(os.environ['PROJ_DATA']`)! So no idea > > why mine works just fine without it (Windows 11 thing?). > > > > Creating a PROJ_DATA env var didn't fix anything. Even adding it > > explicitly in Python. > > > > Their log file does have this in at a WARNING level: > > > > `PROJ: proj_create_from_database: Open of > > /home/user/anaconda3/envs/env1/share/proj failed` > > > > That path has: `drwxrwxr-x` permissions. > > > > To answer Even's earlier question: > > > > `ogrinfo /path/to/shape.shp` works fine on their system. > > > > > > > > On 2023-09-28 12:37, Rahkonen Jukka wrote: > >> Hi, > >> > >> Then they should add that environment if they do not know that they > >> do not belong to "most users" > >> https://proj.org/en/9.3/usage/environmentvars.html > >> > >> -Jukka Rahkonen- > >> > >> -Alkuperäinen viesti- > >> Lähettäjä: gdal-dev Puolesta > >> Jonathan Moules via gdal-dev > >> Lähetetty: torstai 28. syyskuuta 2023 14.10 > >> Vastaanottaja: gdal-dev@lists.osgeo.org; Even Rouault > >> > >> Aihe: Re: [gdal-dev] layer.GetSpatialRef() fails on linux for shapefiles > >> > >> Hi Even, > >> > >> The colleague doesn't have either a PROJ_LIB or a PROJ_DATA > >> environment variable. > >> > >> I asked another colleague to try it; they're on Ubuntu 20.04, and it > >> worked for them. I believe using the same setup instructions. > >> > >> Cheers, > >> > >> Jonathan > >> > >> On 2023-09-24 22:37, Jonathan Moules via gdal-dev wrote: > >>> Thanks Even. I don't have access to the machine either as the > >>> colleague is moving to another project. I'll have to see if it fails > >>> for another *nix user. > >>> > >>> On 2023-09-24 22:35, Even Rouault wrote: > >>>> Le 24/09/2023 à 23:22, Jonathan Moules via gdal-dev a écrit : > >>>>>> Also check if the environment isn't messed up regarding PROJ and > >>>>> the PROJ_LIB/PROJ_DATA environment variable > >>>>> > >>>>> Thanks Even; sorry, what does this line mean? I'm guessing you're > >>>>> referring to: > >>>>> https://proj.org/en/9.3/usage/environmentvars.html - what would a > >>>>> "messed up" one look like? > >>>>> > >>>> Hard to say without access to the machine. Perhaps just try to > >>>> recreate a new Conda env from scratch > >>>> > >>>> > >>> ___ > >>> gdal-dev mailing list > >>> gdal-dev@lists.osgeo.org > >>> https://list/ > >>> s.osgeo.org%2Fmailman%2Flistinfo%2Fgdal-dev=05%7C01%7Cjukka.rahko > >>> nen%40maanmittauslaitos.fi%7C1f6517888cb34fa40aed08dbc01389dd%7Cc4f8a6 > >>> 3255804a1c92371d5a571b71fa%7C0%7C0%7C638314962370381350%7CUnknown%7CTW > >>> FpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6 > >>> Mn0%3D%7C3000%7C%7C%7C=3fVru6K6Ndpkv35FnAbMOlT%2BM96USO7wywqx550 > >>> uRUs%3D=0 > >> ___ > >> gdal-dev mailing list > >> gdal-dev@lists.osgeo.org > >> https://lists.osgeo.org/mailman/listinfo/gdal-dev > > > > ___ > > gdal-dev mailing list > > gdal-dev@lists.osgeo.org > > https://lists.osgeo.org/mailman/listinfo/gdal-dev > ___ > gdal-dev mailing list > gdal-dev@lists.osgeo.org > https://lists.osgeo.org/mailman/listinfo/gdal-dev > ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] layer.GetSpatialRef() fails on linux for shapefiles
Hi List, So, after more investigation: * Using Python Anaconda on either Mac or Linux for GDAL (3.7.1), `GetSpatialRef` triggers a RunTime Error for all shapefiles (but only shapefiles). * This happens on Ubuntu (two machines), and a Mac, but only under PyCharm. * Using the exact same `conda` environment as triggers the above: running it directly from the terminal works fine. So there's something about the combination of conda and Pycharm that breaks this aspect of GDAL shapefile handling on *nix and Mac. Any thoughts? Also, who do I actually report this bug to? Is it GDAL, Conda, Pycharm, something else? Cheers, Jonathan On 2023-09-28 14:58, Jonathan Moules via gdal-dev wrote: Well, it seems that PROJ_DATA isn't set in their environment. But it's not set in mine either (`print(os.environ['PROJ_DATA']`)! So no idea why mine works just fine without it (Windows 11 thing?). Creating a PROJ_DATA env var didn't fix anything. Even adding it explicitly in Python. Their log file does have this in at a WARNING level: `PROJ: proj_create_from_database: Open of /home/user/anaconda3/envs/env1/share/proj failed` That path has: `drwxrwxr-x` permissions. To answer Even's earlier question: `ogrinfo /path/to/shape.shp` works fine on their system. On 2023-09-28 12:37, Rahkonen Jukka wrote: Hi, Then they should add that environment if they do not know that they do not belong to "most users" https://proj.org/en/9.3/usage/environmentvars.html -Jukka Rahkonen- -Alkuperäinen viesti- Lähettäjä: gdal-dev Puolesta Jonathan Moules via gdal-dev Lähetetty: torstai 28. syyskuuta 2023 14.10 Vastaanottaja: gdal-dev@lists.osgeo.org; Even Rouault Aihe: Re: [gdal-dev] layer.GetSpatialRef() fails on linux for shapefiles Hi Even, The colleague doesn't have either a PROJ_LIB or a PROJ_DATA environment variable. I asked another colleague to try it; they're on Ubuntu 20.04, and it worked for them. I believe using the same setup instructions. Cheers, Jonathan On 2023-09-24 22:37, Jonathan Moules via gdal-dev wrote: Thanks Even. I don't have access to the machine either as the colleague is moving to another project. I'll have to see if it fails for another *nix user. On 2023-09-24 22:35, Even Rouault wrote: Le 24/09/2023 à 23:22, Jonathan Moules via gdal-dev a écrit : Also check if the environment isn't messed up regarding PROJ and the PROJ_LIB/PROJ_DATA environment variable Thanks Even; sorry, what does this line mean? I'm guessing you're referring to: https://proj.org/en/9.3/usage/environmentvars.html - what would a "messed up" one look like? Hard to say without access to the machine. Perhaps just try to recreate a new Conda env from scratch ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://list/ s.osgeo.org%2Fmailman%2Flistinfo%2Fgdal-dev=05%7C01%7Cjukka.rahko nen%40maanmittauslaitos.fi%7C1f6517888cb34fa40aed08dbc01389dd%7Cc4f8a6 3255804a1c92371d5a571b71fa%7C0%7C0%7C638314962370381350%7CUnknown%7CTW FpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6 Mn0%3D%7C3000%7C%7C%7C=3fVru6K6Ndpkv35FnAbMOlT%2BM96USO7wywqx550 uRUs%3D=0 ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] layer.GetSpatialRef() fails on linux for shapefiles
Well, it seems that PROJ_DATA isn't set in their environment. But it's not set in mine either (`print(os.environ['PROJ_DATA']`)! So no idea why mine works just fine without it (Windows 11 thing?). Creating a PROJ_DATA env var didn't fix anything. Even adding it explicitly in Python. Their log file does have this in at a WARNING level: `PROJ: proj_create_from_database: Open of /home/user/anaconda3/envs/env1/share/proj failed` That path has: `drwxrwxr-x` permissions. To answer Even's earlier question: `ogrinfo /path/to/shape.shp` works fine on their system. On 2023-09-28 12:37, Rahkonen Jukka wrote: Hi, Then they should add that environment if they do not know that they do not belong to "most users" https://proj.org/en/9.3/usage/environmentvars.html -Jukka Rahkonen- -Alkuperäinen viesti- Lähettäjä: gdal-dev Puolesta Jonathan Moules via gdal-dev Lähetetty: torstai 28. syyskuuta 2023 14.10 Vastaanottaja: gdal-dev@lists.osgeo.org; Even Rouault Aihe: Re: [gdal-dev] layer.GetSpatialRef() fails on linux for shapefiles Hi Even, The colleague doesn't have either a PROJ_LIB or a PROJ_DATA environment variable. I asked another colleague to try it; they're on Ubuntu 20.04, and it worked for them. I believe using the same setup instructions. Cheers, Jonathan On 2023-09-24 22:37, Jonathan Moules via gdal-dev wrote: Thanks Even. I don't have access to the machine either as the colleague is moving to another project. I'll have to see if it fails for another *nix user. On 2023-09-24 22:35, Even Rouault wrote: Le 24/09/2023 à 23:22, Jonathan Moules via gdal-dev a écrit : Also check if the environment isn't messed up regarding PROJ and the PROJ_LIB/PROJ_DATA environment variable Thanks Even; sorry, what does this line mean? I'm guessing you're referring to: https://proj.org/en/9.3/usage/environmentvars.html - what would a "messed up" one look like? Hard to say without access to the machine. Perhaps just try to recreate a new Conda env from scratch ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://list/ s.osgeo.org%2Fmailman%2Flistinfo%2Fgdal-dev=05%7C01%7Cjukka.rahko nen%40maanmittauslaitos.fi%7C1f6517888cb34fa40aed08dbc01389dd%7Cc4f8a6 3255804a1c92371d5a571b71fa%7C0%7C0%7C638314962370381350%7CUnknown%7CTW FpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6 Mn0%3D%7C3000%7C%7C%7C=3fVru6K6Ndpkv35FnAbMOlT%2BM96USO7wywqx550 uRUs%3D=0 ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] layer.GetSpatialRef() fails on linux for shapefiles
Hi, Then they should add that environment if they do not know that they do not belong to "most users" https://proj.org/en/9.3/usage/environmentvars.html -Jukka Rahkonen- -Alkuperäinen viesti- Lähettäjä: gdal-dev Puolesta Jonathan Moules via gdal-dev Lähetetty: torstai 28. syyskuuta 2023 14.10 Vastaanottaja: gdal-dev@lists.osgeo.org; Even Rouault Aihe: Re: [gdal-dev] layer.GetSpatialRef() fails on linux for shapefiles Hi Even, The colleague doesn't have either a PROJ_LIB or a PROJ_DATA environment variable. I asked another colleague to try it; they're on Ubuntu 20.04, and it worked for them. I believe using the same setup instructions. Cheers, Jonathan On 2023-09-24 22:37, Jonathan Moules via gdal-dev wrote: > Thanks Even. I don't have access to the machine either as the > colleague is moving to another project. I'll have to see if it fails > for another *nix user. > > On 2023-09-24 22:35, Even Rouault wrote: >> >> Le 24/09/2023 à 23:22, Jonathan Moules via gdal-dev a écrit : >>> >>> > Also check if the environment isn't messed up regarding PROJ and >>> the PROJ_LIB/PROJ_DATA environment variable >>> >>> Thanks Even; sorry, what does this line mean? I'm guessing you're >>> referring to: >>> https://proj.org/en/9.3/usage/environmentvars.html - what would a "messed >>> up" one look like? >>> >> Hard to say without access to the machine. Perhaps just try to >> recreate a new Conda env from scratch >> >> > > ___ > gdal-dev mailing list > gdal-dev@lists.osgeo.org > https://list/ > s.osgeo.org%2Fmailman%2Flistinfo%2Fgdal-dev=05%7C01%7Cjukka.rahko > nen%40maanmittauslaitos.fi%7C1f6517888cb34fa40aed08dbc01389dd%7Cc4f8a6 > 3255804a1c92371d5a571b71fa%7C0%7C0%7C638314962370381350%7CUnknown%7CTW > FpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6 > Mn0%3D%7C3000%7C%7C%7C=3fVru6K6Ndpkv35FnAbMOlT%2BM96USO7wywqx550 > uRUs%3D=0 ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] layer.GetSpatialRef() fails on linux for shapefiles
Hi Even, The colleague doesn't have either a PROJ_LIB or a PROJ_DATA environment variable. I asked another colleague to try it; they're on Ubuntu 20.04, and it worked for them. I believe using the same setup instructions. Cheers, Jonathan On 2023-09-24 22:37, Jonathan Moules via gdal-dev wrote: Thanks Even. I don't have access to the machine either as the colleague is moving to another project. I'll have to see if it fails for another *nix user. On 2023-09-24 22:35, Even Rouault wrote: Le 24/09/2023 à 23:22, Jonathan Moules via gdal-dev a écrit : > Also check if the environment isn't messed up regarding PROJ and the PROJ_LIB/PROJ_DATA environment variable Thanks Even; sorry, what does this line mean? I'm guessing you're referring to: https://proj.org/en/9.3/usage/environmentvars.html - what would a "messed up" one look like? Hard to say without access to the machine. Perhaps just try to recreate a new Conda env from scratch ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] layer.GetSpatialRef() fails on linux for shapefiles
That's clear. However, environmental means SET in one environment, and EXPORT in the other. Sorry for the pun, but I expect Windows and Linux settings/exports for GDAL should be fairly similar. So the environments might be the next step to communicate, if I'm not mistaken at root. On Sun, Sep 24, 2023 at 11:58 PM Jonathan Moules < jonathan-li...@lightpear.com> wrote: > This applies to *all* shapefiles for that user. There are about 10 in the > sample and they're from a diverse range of UK organisations. Mostly 27700 > (British National Grid), but likely one or two WGS84. Hence thinking it may > be environmental, but I don't have any real *nix knowledge to use to > diagnose the issue. > > > On 2023-09-24 22:52, Jan Heckman wrote: > > Sorry to break in, but surely, we would like to see the .prj file in > question for a simple try at reproducing? > > On Sun, Sep 24, 2023 at 11:37 PM Jonathan Moules via gdal-dev < > gdal-dev@lists.osgeo.org> wrote: > >> Thanks Even. I don't have access to the machine either as the colleague >> is moving to another project. I'll have to see if it fails for another >> *nix user. >> >> On 2023-09-24 22:35, Even Rouault wrote: >> > >> > Le 24/09/2023 à 23:22, Jonathan Moules via gdal-dev a écrit : >> >> >> >> > Also check if the environment isn't messed up regarding PROJ and >> >> the PROJ_LIB/PROJ_DATA environment variable >> >> >> >> Thanks Even; sorry, what does this line mean? I'm guessing you're >> >> referring to: https://proj.org/en/9.3/usage/environmentvars.html - >> >> what would a "messed up" one look like? >> >> >> > Hard to say without access to the machine. Perhaps just try to >> > recreate a new Conda env from scratch >> > >> > >> >> ___ >> gdal-dev mailing list >> gdal-dev@lists.osgeo.org >> https://lists.osgeo.org/mailman/listinfo/gdal-dev >> > ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] layer.GetSpatialRef() fails on linux for shapefiles
This applies to *all* shapefiles for that user. There are about 10 in the sample and they're from a diverse range of UK organisations. Mostly 27700 (British National Grid), but likely one or two WGS84. Hence thinking it may be environmental, but I don't have any real *nix knowledge to use to diagnose the issue. On 2023-09-24 22:52, Jan Heckman wrote: Sorry to break in, but surely, we would like to see the .prj file in question for a simple try at reproducing? On Sun, Sep 24, 2023 at 11:37 PM Jonathan Moules via gdal-dev wrote: Thanks Even. I don't have access to the machine either as the colleague is moving to another project. I'll have to see if it fails for another *nix user. On 2023-09-24 22:35, Even Rouault wrote: > > Le 24/09/2023 à 23:22, Jonathan Moules via gdal-dev a écrit : >> >> > Also check if the environment isn't messed up regarding PROJ and >> the PROJ_LIB/PROJ_DATA environment variable >> >> Thanks Even; sorry, what does this line mean? I'm guessing you're >> referring to: https://proj.org/en/9.3/usage/environmentvars.html - >> what would a "messed up" one look like? >> > Hard to say without access to the machine. Perhaps just try to > recreate a new Conda env from scratch > > ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] layer.GetSpatialRef() fails on linux for shapefiles
Sorry to break in, but surely, we would like to see the .prj file in question for a simple try at reproducing? On Sun, Sep 24, 2023 at 11:37 PM Jonathan Moules via gdal-dev < gdal-dev@lists.osgeo.org> wrote: > Thanks Even. I don't have access to the machine either as the colleague > is moving to another project. I'll have to see if it fails for another > *nix user. > > On 2023-09-24 22:35, Even Rouault wrote: > > > > Le 24/09/2023 à 23:22, Jonathan Moules via gdal-dev a écrit : > >> > >> > Also check if the environment isn't messed up regarding PROJ and > >> the PROJ_LIB/PROJ_DATA environment variable > >> > >> Thanks Even; sorry, what does this line mean? I'm guessing you're > >> referring to: https://proj.org/en/9.3/usage/environmentvars.html - > >> what would a "messed up" one look like? > >> > > Hard to say without access to the machine. Perhaps just try to > > recreate a new Conda env from scratch > > > > > > ___ > gdal-dev mailing list > gdal-dev@lists.osgeo.org > https://lists.osgeo.org/mailman/listinfo/gdal-dev > ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] layer.GetSpatialRef() fails on linux for shapefiles
Thanks Even. I don't have access to the machine either as the colleague is moving to another project. I'll have to see if it fails for another *nix user. On 2023-09-24 22:35, Even Rouault wrote: Le 24/09/2023 à 23:22, Jonathan Moules via gdal-dev a écrit : > Also check if the environment isn't messed up regarding PROJ and the PROJ_LIB/PROJ_DATA environment variable Thanks Even; sorry, what does this line mean? I'm guessing you're referring to: https://proj.org/en/9.3/usage/environmentvars.html - what would a "messed up" one look like? Hard to say without access to the machine. Perhaps just try to recreate a new Conda env from scratch ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] layer.GetSpatialRef() fails on linux for shapefiles
Le 24/09/2023 à 23:22, Jonathan Moules via gdal-dev a écrit : > Also check if the environment isn't messed up regarding PROJ and the PROJ_LIB/PROJ_DATA environment variable Thanks Even; sorry, what does this line mean? I'm guessing you're referring to: https://proj.org/en/9.3/usage/environmentvars.html - what would a "messed up" one look like? Hard to say without access to the machine. Perhaps just try to recreate a new Conda env from scratch -- http://www.spatialys.com My software is free, but my time generally not. ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] layer.GetSpatialRef() fails on linux for shapefiles
> Also check if the environment isn't messed up regarding PROJ and the PROJ_LIB/PROJ_DATA environment variable Thanks Even; sorry, what does this line mean? I'm guessing you're referring to: https://proj.org/en/9.3/usage/environmentvars.html - what would a "messed up" one look like? Thanks, Jonathan On 2023-09-21 13:39, Even Rouault via gdal-dev wrote: 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 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@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev -- http://www.spatialys.com My software is free, but my time generally not. ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] layer.GetSpatialRef() fails on linux for shapefiles
Tested against the following data types (OGR and GDAL): GeoJSON, KML, KMZ, Shapefile, ECW, IMG, TIF, GML, ASC, Geopackage, NetCDF. Only the shapefile fails. On 21/09/2023 13:34, Jonathan Moules wrote: 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 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@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] layer.GetSpatialRef() fails on linux for shapefiles
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 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@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev -- http://www.spatialys.com My software is free, but my time generally not. ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] layer.GetSpatialRef() fails on linux for shapefiles
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 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@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] layer.GetSpatialRef() fails on linux for shapefiles
Hi Javier, I don't recall there being any exception message exposed. It was simply a RuntimeError. I guessed it's probably installation/configuration, but surely GDAL should Just Work? Especially if it's coming via Conda? (I don't live in the Linux world; I just used a wheel). Cheers, Jonathan 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 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@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] layer.GetSpatialRef() fails on linux for shapefiles
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 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@lists.osgeo.org > https://lists.osgeo.org/mailman/listinfo/gdal-dev > ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
[gdal-dev] layer.GetSpatialRef() fails on linux for shapefiles
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@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev