Skip to content

Commit

Permalink
Added instructions for geonode/worldmap contrib app configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
capooti committed Jan 31, 2018
1 parent da6fde2 commit 0bf9937
Showing 1 changed file with 152 additions and 0 deletions.
152 changes: 152 additions & 0 deletions geonode/contrib/worldmap/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
# WorldMap GeoNode contrib application installation and configuration


## Features

Using the WorldMap contrib application, GeoNode is extended with the following additional features:

* a customized GeoExplorer viewer
* the table of contents is hierarchical with layer categories. When a layer is added a new category containing the layer is added in the table of content. If the category is already in the table of content, then the layer is added to it. By default category is the same as the layer's topic category, but can be renamed by right clicking on it
* the "Add Layers" dialog comes with a "Search" tab which uses Hypermap Registry (Hypermap) as a catalogue of remote and local layers. Hypermap is a requirement when using the WorldMap contrib application
* a gazetteer application: it is possible to include a given layer to a gazetteer. The gazetteer can be checked using the map client. When a layer is part of the gazetter it is possible to include it in a general gazetteer or in a specific project one. It is possible to search place names in the gazetteer by date range, in which case it is needed to specify the layer attributes for the start and end depict dates

## Installation

### Requirements

We are assuming a Ubuntu 16.04.1 LTS development environment, but these instructions can be adapted to any recent Linux distributions.

# Install Ubuntu dependencies
sudo apt-get update
sudo apt-get install python-virtualenv python-dev libxml2 libxml2-dev libxslt1-dev zlib1g-dev libjpeg-dev libpq-dev libgdal-dev git default-jdk postgresql postgis

# Install Java 8 (needed by latest GeoServer 2.12)
sudo apt-add-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

### Virtual environment creation and installation of Python packages

Create and activate the virtual environment:

cd ~
virtualenv --no-site-packages env
. env/bin/activate

Right now WorldMap is a contribute's application which lives in the CGA GeoNode forked version.
But it will be merged in official GeoNode soon.

Therefore git clone from this repository (using the worldmap branch):

git clone -b worldmap https://github.com/cga-harvard/geonode.git

Now install GeoNode:

cd geonode
pip install -r requirements.txt --no-deps
pip install pygdal==1.11.3.3
pip install -e .

### GeoNode/WorldMap projection creation

You will use a geonode-project in order to separate the customization of your instance from GeoNode.

Set the following variables as needed:

export PG_USERNAME=worldmap
export PG_PASSWORD=worldmap
export PG_WORLDMAP_DJANGO_DB=worldmap
export PG_WORLDMAP_UPLOADS_DB=wmdata
export OWNER=$PG_USERNAME

Create your geonode project by using the WorldMap geonode-project as a template (https://github.com/cga-harvard/geonode-project). Rename it to something meaningful (for example your web site name):

cd ~
export SITENAME=worldmap # changes here accordingly
django-admin startproject $SITENAME --template=https://github.com/GeoNode/geonode-project/archive/master.zip -epy,rst
cd $SITENAME

Create a local_settings.py by copying the included template:

cp $SITENAME/local_settings.py.sample $SITENAME/local_settings.py
make build
paver setup

### Start the Server

Start GeoNode with Worldmap using pavement:

python manage.py runserver 0.0.0.0:8000
paver start_geoserver

To upload layers you can login with the default GeoNode administrative account:

user: admin
password: admin

## Hypermap Registry

GeoNode with WorldMap contribute module requires an Hypermap Registry (Hypermap) running instance.

You can install Hypermap by following these instructions (use the "Manual Installation" section): https://github.com/cga-harvard/HHypermap/blob/master/_docs/developers.md

Note that you can bypass Java 8 installation as it was installed previously. As a search engine you should install Solr, as we haven't tested Elasticsearch with WorldMap so far. Create a specific virtual environment for Hypermap in order not to interfere with the GeoNode/WorldMap virtual environment.

After installing Hypermap, start it on a different port than 8000, for example:

python manage.py runserver 0.0.0.0:8001

In another shell start the Celery process as well:

cd HHypermap
celery -A hypermap worker --beat --scheduler django -l info

## Test the stack

Now that GeoNode/WorldMap and Hypermap are both running, test the stack by uploading a layer.

Login in GeoNode (admin/admin) and upload a shapefile from this page: http://localhost:8000/layers/upload

Make sure the shapefile is correctly displayed in GeoNode by going to the layer page.

Now login in Hypermap (admin/admin) and go to the admin services page: http://localhost:8001/admin/aggregator/service/

Add a new WMS service pointing to the GeoServer WMS endpoint:

url: http://localhost:8080/geoserver/ows?
Type: Web Map Service (WMS)

Go to the Hypermap service page and check it the service and the layer is there:
http://localhost:8001/registry/

In order to have layer in the search engine (Solr) there are two options:

1) from task runner press the "Index cached layers" button
2) schedule a task in celery

We recommend the second option, which can be configured in the next section.

## Schedule Celery tasks

Go to the Periodic Task administrative interface: http://localhost:8001/admin/django_celery_beat/periodictask/

Create the following two tasks:

### Index Cached Layer Task

This task will sync the layers from the cache to the search engine. Layers are sent in the cache every time they are saved:

* Name: Index Cached Layer
* Task (registered): hypermap.aggregator.tasks.index_cached_layers
* Interval: every 1 minute (or as needed)

### Check Worldmap Service

This task will do a check of all of WorldMap service:

* Name: Check WorldMap Service
* Task (registered): hypermap.aggregator.tasks.check_service
* Interval: every 1 minute (or as needed)
* Arguments: [1] # 1 is the id of the service. Change as is needed

Now upload a new layer in GeoNode/WorldMap and check if it happears in Hypermap and in Solr (you may need to wait for the tasks to be executed)

0 comments on commit 0bf9937

Please sign in to comment.