docker-lambda icon indicating copy to clipboard operation
docker-lambda copied to clipboard

Geopandas and Fiona success!

Open jcary741 opened this issue 3 years ago • 0 comments

Not sure how to document this, but I managed to build a container with Geopandas and Fiona based on this project. Thanks so much!

A couple gotchas:

  1. I had to add the following at the top of my handler file
import pyproj
pyproj.datadir.set_data_dir(os.path.join(os.path.dirname(__file__), 'share/proj'))
  1. In order to get the final package size below 250MB, I used the following options for pip (based on https://github.com/szelenka/shrink-linalg) and trim some fluff:
RUN CFLAGS="-g0 -Wl,--strip-all -I/usr/include:/usr/local/include -L/usr/lib:/usr/local/lib" \
            pip install \
            --no-cache-dir \
            --compile \
            --global-option=build_ext \
            --global-option="-j 4" \
            --no-binary :all: \
            --target ${PACKAGE_PREFIX}/ \ fiona pandas geopandas shapely pyproj
# Remove tests, docs, and examples
RUN cd $PREFIX && rm -rf **/tests/ **/_testing/ **/doc/ **/examples/

jcary741 avatar Aug 26 '22 21:08 jcary741