Skip to content

aecryan/gis-apps

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Geo Web Apps

A coding session about an intro to web architecture of web apps for geographic data: this session demonstrates the steps to deploy geo-web services and how to connect clients to the services.

Objectives

  1. Explain the basics software architecture of web-based GIS applications and how do they compare with more generic web-based applications.
  2. Describe how the Server-Client model is used in web-based GIS applications and common toolchains.
  3. Implement a simple client to consume Geo-Web services (MWS, WMTS, and WFS) using Jupyter notebooks.
  4. Do some geeky things with Python and geodata.

Toolchain

Server Side

  • Geoserver: a server used for geospatial data. Java based.
  • PostgreSQL + PostGIS: A relational database with goespatial capabilites.

Client Side

  • Python
  • Jupyter Notebooks via Anaconda, and the following packages:
    • ipywidgets, enables widgets in jupyter notebook for dynamic content
    • ipyleaflet, enables the display of maps on jupyter notebooks using LeafLet. Leaflet is a JavaScript library for interactive maps.

Some Guidelines

  • Linux Server, to deploy a geo-web server we need a dedicate machine for this task; for example a remote server in a cloud-based platform running Ubuntu Server 18.04. Note that people often use the term 'server' to refer to hardware or software, or the combination of hardware and software.
  • Communication with a remote server is done using SSH(Secured Shell). On Linux this is done directly from a Terminal, on Windows, we need an SSH client, for example Bitvise.

Installing GeoServer

  1. Download Geoserver; mind about the version.
$ wget https://sourceforge.net/projects/geoserver/files/GeoServer/2.18.0/geoserver-2.18.0-bin.zip
  1. If needed, install unzip, and unzip the file the preferred location. Geoserver recommends to use /usr/share/geoserver
$ sudo apt unzip
$ sudo unzip geoserver-2.18.0-bin.zip -d /usr/share/geoserver
  1. Add the location of GeoServer as an environment variable.
$ echo "export GEOSERVER_HOME=/usr/share/geoserver" >> ~/.profile
. ~/.profile
  1. Make your user the owner of the geoserver directory.
$ sudo chown -R <USER_NAME> /usr/share/geoserver/
  1. Start GeoServer. Go to geserver/bin and execute the startup.sh
$ cd /usr/share/geoserver/bin
$ sh startup.sh
  1. In the browser go to http://localhost:8080/geoserver

More on how to install and use Geoserver at https://docs.geoserver.org/latest/en/user/installation/linux.html

Installing PostreSQL and PostGIS

  1. Install PostreSQL. Installing and manipulating PostgreSQL required a list of laborious steps, that are well documented around the Internet. For details check this blog-post

  2. Installing PostGIS. PostGIS is an extension on top of PostgreSQL which enable handling geospatial data inside ProgreSQL. Again, there's a ton of documentation on several ways to do this, here's a way. Something important to remember is that even when you have installed PostGIS, you have to enable this extension when creating a database explicitly.

Jupyter

We will use jupyter as a friendly environment to build a GIS web-client that will retrieve data from Geoserver. In a real-world situation, you will use web frameworks such as DJango, Flask, ReAct, etc. to build a web client.

  1. On the Anaconda prompt install the ipywidgets and ipyleaflet packages to the base environment.
$ conda install -c conda-forge ipyleaflet ipyleaflet

-c:= channel

  1. Start Jupyter Notbook, create a new notebook and run the code below to verify that the packages can be loaded into the notebook.
from ipyleaflet import Map, Marker

center = (51.999285, 4.373791)

m = Map(center=center, zoom=14)

marker = Marker(location=center, draggable=True)
m.add_layer(marker)
display(m)

You should see a map appearing before your eyes, if it doesn't, look for help in StackOverflow

FAQ

About

Coding session on intro to web architure of GIS apps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 100.0%