# 7

#### Description:

Geospatial representation are so prevalent in day to day life, such as even in simple travel related conversation to maps, aerial/satellite images etc. In digital era, geospatial data is extensively produced and consumed in ever growing proportion. Python with its free and open source libraries are giving wide variety yet simple and effective set of tools to visualise and analyse geospatial data. The current workshop is directed for beginners of Python programming language, who have basic understanding on computing and data formats. The primary objective of the workshop is to introduce and give hands on training on selected list of FOSS libraries for geospatial analysis. The workshop as a do it yourself fashion tries to solve two real world problems in Geographical Information System (GIS) and its geospatial data sources.

The workshop comprised of three components:

Component 1: Introduction

Python environment and work flow setup, an assisted task of setting up the Docker and Jupyter notebook setup. Setting up the Geographical Information System (GIS) environment with extended discussion. Setting up of GIS tools such as FOSS QGIS and Google earth. This component is comprised of four exercises. 1. Introduction to vector data, 2. Introduction to raster data, 3. binary and text file formats of geospatial data, 4. Introduction to tools of GIS, 5. Introduction to literal programming- Jupyter notebook

Component 2: work with vector data

Find characteristics of road network(type of road network, length of the type) within a 1X1 km grid. The data source is Open Street Map (OSM) road network data on a city level (60X60km size). This operation is operationally simple such as measure a line feature but computationally intensive as the operation comprised of geometry within operation on dense road network seen in urban setup. Libraries such as Shapely, Fiona, Geopandas and rtree index will be used for the fast processing of this operation. This component comprised of three exercises 1. Find distance between two points 2. Find distance between two points constrained by another vector 3. Find distance between large number of points in for loop

1. Geospatial data operations by Geopandas, Geometrical operations using Shapely
2. Map plotting of vectors using matplotlib toolkit Basemap, video from maps
3. Web mapping on vector data using Folium

Component 3: work with raster data

1. Basic workflow on satellite imageries using Rasterio, NDVI and other indexing
2. Map plotting of rasters using matplotlib toolkit Basemap
3. Web mapping on raster data using Folium
4. Accessing Google earth engine using its Python API

Note : There won't be any environment setup session separately, participants are requested to ensure below prerequisites are working properly.

Workshop Plan

1. Component 1- 40 minutes
2. Break- 5 minutes
3. Component 2- 50 minutes
4. Break- 5 minutes
5. Component 3- 50 minutes

#### Prerequisites:

1. The hands-on exercises are given as Jupyter notebooks in here
2. The docker imagery for the workshop is in dockerhub, version7 is latest, please update into latest image in the above link just before workshop
3. As the workshop depended on multiple libraries there are two options to carry out hands-on

Option 1

1. Use personal laptop and setup the docker with above image, use Jupyter notebook served from the docker, for a setup please go through this
2. Have latest clone of workshop docker image(version8) `sudo docker pull airpollutionstudyindia/foss-pt-gsa:version8` and jupyter notebook repo of the workshop `git clone https://github.com/nishadhka/FOSS-Python-GeospatialAnalysis.git --depth`

Option 2

1. There will be Jupyterhub running on the workshop docker image available during workshop which can be accessed using participants' github account
2. Participants are requested to ensure fast internet connectivity
4. Have git clone of workshop notebooks from here `git clone https://github.com/nishadhka/FOSS-Python-GeospatialAnalysis.git`

#### Content URLs:

For workshop home here and here such as to get sample data, Jupyter notebooks, slides etc

For workshop slide is available here

#### Speaker Info:

I am a research associate at UrbanEmissions.info, PhD in Environmental Sciences from Sálim Ali Centre for Ornithology and Natural History, Bharathiar University, Coimbatore. My thesis was on "Particulate air pollution data for Coimbatore, India: real time monitoring and modeling with data-interoperability measures", which emphasised need of open and standardised real time data for better management of air pollution in the country. I got exposure into programming and open source software related to my research studies. I used free and open source libraries of Python for most of my studies, especially on geospatial data compilation, analysis and visualization. I have conducted workshop similar to the current one in Kovaipy, Scipy-India 2017.

 Section: Data science Type: Workshops Target Audience: Beginner Last Updated: 06 Oct, 2018

##### 1

Can you specify the requirements for Linux(Debian) ?

Shwetabh Kumar (~shwetabh)
##### 0

Updated the proposal, thanks

##### 0

Hi nishadhka, Facing the below issue on setting up the container, for which Jupyter notebook url is not accessible. Please help, for the below stack trace. First, getting the import error and after doing the last step (11) and (12) under Linux , the url is not accessible in Host machine browser.

root@29dc83135c47:/home/ubuntu/FOSS-Python-GeospatialAnalysis-master# jupyter notebook --ip=0.0.0.0 --port=8080 --allow-root [I 12:09:41.003 NotebookApp] Writing notebook server cookie secret to /root/.local/share/jupyter/runtime/notebook_cookie_secret [W 12:09:41.546 NotebookApp] Error loading server extension jupyter_nbextensions_configurator

``````Traceback (most recent call last):
File "/home/ubuntu/conda/lib/python2.7/site-packages/notebook/notebookapp.py", line 1343, in init_server_extensions
mod = importlib.import_module(modulename)
File "/home/ubuntu/conda/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named jupyter_nbextensions_configurator [I 12:09:41.548 NotebookApp] Serving notebooks from local directory: /home/ubuntu/FOSS-Python-
``````

GeospatialAnalysis-master [I 12:09:41.548 NotebookApp] 0 active kernels [I 12:09:41.548 NotebookApp] The Jupyter Notebook is running at: [I 12:09:41.548 NotebookApp] http://0.0.0.0:8080/?token=2847279f6dcdec704373af57225031a64a122df066610b06 [I 12:09:41.549 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [W 12:09:41.549 NotebookApp] No web browser found: could not locate runnable browser. [C 12:09:41.550 NotebookApp] Copy/paste this URL into your browser when you connect for the first time, to login with a token: http://0.0.0.0:8080/?token=2847279f6dcdec704373af57225031a64a122df066610b06

Regards

sandipsahoo
##### 0

Hi,

I have managed this. to work. I am able to access the URL and notebooks. There is some issue with IP Address i.e. docker inet and container IP address are different. But I am still getting the import error.

Regards

sandipsahoo
##### 0

Hi, @sandipasahoo, I guess there is issue with Jupyter notebook plugin extension in the image, these plugins are used to enhance the user interface of Jupyter notebooks. Thanks for catching this. Will fix this and update the image. However, if the url is accessible and notebooks can be viewed, I would suggest to go through each component folder's .ipynb files and execute the command, probably this issue won't be effecting workflow.