Skip to content

geographika/GeoPythonNotebooks

Repository files navigation

MapScript Python Notebook ReadMe

Creating a Virtual Environment with Jupyter and mapscript:

SET PYTHON_HOME=C:\Python36
SET PYTHON_HOME=C:\Python27

SET VENV=C:\VirtualEnvs\mapscript-jupyter3
SET VENV=C:\VirtualEnvs\mapscript-jupyter


%PYTHON_HOME%\Scripts\virtualenv %VENV%
%VENV%\scripts\activate

python -m pip install pip -U
pip install jupytext
python -m pip install jupyter
pip install mapscript -U

To create a notebook from a Python script jupytext is used - https://github.com/mwouts/jupytext The script is written using the "percent" format - https://github.com/mwouts/jupytext/blob/master/demo/World%20population.pct.py To create the notebook:

SET NOTEBOOK_HOME=D:\GitHub\GeoPythonNotebooks\notebooks
%VENV%\scripts\activate

cd /D %NOTEBOOK_HOME%

jupytext --to notebook mapscript-quickstart.py

To set up the paths to MapServer and run the notebook:

SET MAPSERVER_HOME=C:\Installation\release-1911-x64-gdal-2-3-2-mapserver-7-2-1
SET MAPSERVER_HOME=D:\MapServer\release-1911-x64-gdal-2-3-2-mapserver-7-2-1
SET MAPSERVER_DEMO=D:\GitHub\mapserver-demo

SET PATH=%MAPSERVER_HOME%\bin;%PATH%
SET PROJ_LIB=%MAPSERVER_HOME%\bin\proj\SHARE

cd /D %NOTEBOOK_HOME%

REM run the script
python mapscript-quickstart.py
REM run the notebook
jupyter notebook mapscript-quickstart.ipynb

Jupyter and Binder

Running on OSGeoLive

wget https://github.com/geographika/GeoPythonNotebooks/archive/master.zip
unzip master.zip
cd GeoPythonNotebooks-master/jupyter/quickstarts

export MAPSERVER_DEMO="/rofs/usr/local/share/mapserver/demos/itasca"

python -m jupyter notebook mapscript-quickstart.ipynb

MapScript on Ubuntu

https://packages.ubuntu.com/search?suite=default&section=all&arch=any&keywords=mapscript&searchon=names

  • bionic (18.04LTS) (devel): Python library for MapServer [universe]
  • 7.0.7-1build2: amd64 arm64 armhf i386 ppc64el s390x
    • /usr/lib/x86_64-linux-gnu/libmapserver.so.2
    • /usr/lib/x86_64-linux-gnu/libmapserver.so.7.0.7

Script Updates

To add:

  • buffer - needs GEOS support
  • queryByShape towns near a lake

Linux Install

sudo apt-get update

sudo apt-get install libmapserver2
sudo apt-get install python-mapscript

sudo apt-get install python-pip
pip install ipython

ipython -c "import mapscript"
python2 -c "import mapscript"

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published