developmentseed / geolambda

Create and deploy Geospatial AWS Lambda functions
MIT License
303 stars 85 forks source link

Use with geodjango #59

Closed ptrhck closed 5 years ago

ptrhck commented 5 years ago

Hi,

am I right that simply adding your public layer to my lambda function makes GDAL available to my lambda function?

I get the following error invoking the function:

django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library (tried "gdal", "GDAL", "gdal2.2.0", "gdal2.1.0", "gdal2.0.0", "gdal1.11.0", "gdal1.10.0", "gdal1.9.0"). Is GDAL installed? If it is, try setting GDAL_LIBRARY_PATH in your settings.

Is that some non-standard location for gdal? As far as I can see here, I might need to adjust the path. But, where to?

matthewhanson commented 5 years ago

Hi @ptrhck, if you are using the Docker image the library is located at /usr/local/lib

If you are talking about the Lambda function, the Lambda layer gets mounted at /opt, so /opt/lib is where libgdal is located. In most cases however the system should already know to look there for libraries. Give that a try and let us know how it works, thanks.

ptrhck commented 5 years ago

The following seems to work in the django settings.py:

if "LAMBDA_TASK_ROOT" in os.environ:
    GDAL_LIBRARY_PATH = '/opt/lib/libgdal.so'
matthewhanson commented 5 years ago

Great, thanks for following up!