If you’d like to work with maps and geospatial data using ArcGIS, it is possible to add the ArcGIS API for Python for use in JupyterLab in your Domino environment.
Both examples below are built on Domino Standard Environment Py3.8 R4.1 (quay.io/domino/standard-environment:ubuntu18-py3.8-r4.1-domino5.1)
**Please note: as of June 2022, ArcGIS API for Python is not compatible with Jupyterlab 3+. The instructions in the Dockerfile include steps to downgrade Jupyterlab from the version that comes in the base image to Jupyterlab 2.3.2 (the latest version prior to 3.0.0).
The ArcGIS API for Python is best experienced when all its dependencies are installed. The following instructions will install the ArcGIS API as well as the dependencies listed in the ArcGIS API documentation here.
USER root
# Download older version of Workspaces from Domino
RUN mkdir -p /var/opt/workspaces && cd /tmp && \
wget https://github.com/dominodatalab/workspace-configs/archive/2021q1-v1.zip && \
unzip 2021q1-v1.zip && \
cp -Rf workspace-configs-2021q1-v1/* /var/opt/workspaces && \
rm -rf /var/opt/workspaces/workspace-logos /var/opt/workspaces/README.md && \
rm -rf /tmp/workspace-configs-2021q1-v1 /tmp/2021q1-v1.zip
# Install JupyterLab from workspaces
RUN chmod +x /var/opt/workspaces/Jupyterlab/install && /var/opt/workspaces/Jupyterlab/install
# Install ArcGIS
RUN \
apt-get update && apt-get install -y libkrb5-dev && \
pip install arcgis==2.0.0 && \
# Fix version issue with numpy in ArcGIS
pip uninstall numpy -y && \
pip install numpy==1.17.3 && \
# Add Jupyter Lab extensions and build
jupyter labextension install @jupyter-widgets/jupyterlab-manager && \
jupyter labextension install arcgis-map-ipywidget@2.0.0 && \
jupyter lab build && \
chown ubuntu:ubuntu -R /opt/conda/share/jupyter
USER ubuntu
It is also possible to install ArcGIS with minimum dependencies, which is suitable for specific tasks such as GIS administration and content management. More information on this here. To build an ArcGIS environment with minimum dependencies, only the following instructions are needed for your dockerfile:
USER root
# Download older version of Workspaces from Domino
RUN mkdir -p /var/opt/workspaces && cd /tmp && \
wget https://github.com/dominodatalab/workspace-configs/archive/2021q1-v1.zip && \
unzip 2021q1-v1.zip && \
cp -Rf workspace-configs-2021q1-v1/* /var/opt/workspaces && \
rm -rf /var/opt/workspaces/workspace-logos /var/opt/workspaces/README.md && \
rm -rf /tmp/workspace-configs-2021q1-v1 /tmp/2021q1-v1.zip
# Install JupyterLab from workspaces
RUN chmod +x /var/opt/workspaces/Jupyterlab/install && /var/opt/workspaces/Jupyterlab/install
# Install ArcGIS and required dependencies
RUN \
pip install arcgis==2.0.0 --no-deps && \
pip install ujson six requests_toolbelt requests_ntlm ntlm_auth cachetools requests_oauthlib && \
# Add Jupyter Lab extensions and build
jupyter labextension install @jupyter-widgets/jupyterlab-manager && \
jupyter labextension install arcgis-map-ipywidget@2.0.0 && \
jupyter lab build && \
chown ubuntu:ubuntu -R /opt/conda/share/jupyter
USER ubuntu
Once you’ve built your environment and opened Jupyterlab, you can verify your ArcGIS installation by running the following commands in your Jupyter notebook:
from arcgis.gis import GIS
my_gis = GIS()
m = my_gis.map()
m
Comments
0 comments
Article is closed for comments.