Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unloading+loading GDAL might cause PROJ 7.0.0 to loose its way to proj.db. #2344

Closed
edzer opened this issue Mar 24, 2020 · 3 comments
Closed
Labels
awaiting_feedback Awaiting feedback from reporter

Comments

@edzer
Copy link
Contributor

edzer commented Mar 24, 2020

One of the tests in R package sf unloads GDAL, which calls

    OGRCleanupAll();
    OSRCleanup();

and then loads it again, which calls

    GDALAllRegister();
    OGRRegisterAll();

After this test, all GDAL/PROJ calls result in

In CPL_crs_from_input(x) :
  GDAL Error 1: PROJ: proj_create_from_database: Cannot find proj.db

where CPL_crs_from_input(x) calls OGRSpatialReference::SetFromUserInput.

This happens in GDAL 3.0.4/PROJ 7.0.0 combinations, not seen in GDAL 3.0.2/PROJ 6.3.1 versions. Removing the unload/load GDAL test resolved the issue. Can you work with this, or shall I try to put this in a standalone C++ program causing an error?

Cc: @rsbivand

@rouault rouault added the awaiting_feedback Awaiting feedback from reporter label Mar 24, 2020
@rouault
Copy link
Member

rouault commented Mar 24, 2020

I've tried the following reproducer, but works fine for me with GDAL master/3.0 branch + PROJ master:

#include <gdal_priv.h>
#include <ogr_spatialref.h>

int main(int argc, char* argv[]){
    GDALAllRegister();
    OGRRegisterAll();

    {
        OGRSpatialReference oSRS;
        printf("ok = %d\n", oSRS.importFromEPSG(32631) == OGRERR_NONE);
    }

    OGRCleanupAll();
    OSRCleanup();

    GDALAllRegister();
    OGRRegisterAll();

    {
        OGRSpatialReference oSRS;
        printf("ok = %d\n", oSRS.importFromEPSG(32631) == OGRERR_NONE);
    }

    return 0;
}

@rouault
Copy link
Member

rouault commented Apr 5, 2020

@edzer Is this still an issue ?

@edzer
Copy link
Contributor Author

edzer commented Apr 5, 2020

Thanks for looking at this, Even! I haven't been able to reproduce this outside the R context, and am now somewhat confused whether this has disappeared in the R context or not. If not, I'll get back here to dive into it further.

@edzer edzer closed this as completed Apr 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting_feedback Awaiting feedback from reporter
Projects
None yet
Development

No branches or pull requests

2 participants