Code Monkey home page Code Monkey logo

gisportal's Introduction

GIS Portal

The GIS portal is a web-based visualisation and analysis tool for examining geospatial data that is available via Web Map Service (WMS) and Web Coverage Service (WCS)

The GIS portal was developed as part of the European Commission FP7 project OpEc, and its development continues with eartH2Observe as well as other sources of development investment or sponsorship of particular features.

Example Instances

You can find a full list of example instances of the GISportal software at http://pmlrsg.github.io/GISportal

Overview

The portal is composed of three parts. A web frontend written with HTML, CSS and JavaScript, a middleware written in Node.js, and a plotting and data extraction library written in Python that provides the analysis tools.

Web Frontend

Javascript source: src/
Javascript Libs: html/js-libs/
Our CSS: src/css/ Our Images: html/img/
HTML: src/index.html and src/templates/

Middleware

Written in Node.js, the middleware facilitates communication between the backend OGC WxS services and the web frontend.

First Steps | Linux

  1. Clone Repository
    First we need to clone the repository, and pull in the submodules
git clone https://github.com/pmlrsg/GISportal.git GISportal
cd GISportal
git submodule init
git submodule update
  1. Install Dependencies

    The following dependencies will need to be installed by your package manager (for example, yum). Some of the names may be different depending on your system, we use Fedora. Some may already be installed.

    yum install nodejs  npm  redis  ruby  ruby-devel gdal  libjpeg-turbo  freetype-devel  libpng-devel  hdf5-devel  \
        netcdf-devel  python-devel  python-pip  python-pillow-devel  python-requests  python-pandas  python-jinja2
    

    A note about numpy: Depending on your host OS and how up to date your package manager sources are you may need to update your version of numpy. For example, Centos7 currently has version 1.7.1, and Fedora 21 offers 1.8.2, however, there was a change to the way that masked arrays are handled that was introduced in version 1.8.3. You can check which version you have by running the following in Python:

    import numpy
    npv = numpy.version.version
    print(npv)
    

    This will give you the version number and the installation location. If you have version number < 1.8.3 you will need to delete the folder where it is installed and install via pip which has a more recent version:

    pip install numpy
    

    We also need to install all the required libraries. This can be done in a few ways, the easiest using pip. This will probably need sudo permissions.

    pip install bokeh owslib shapely netCDF4 
    
  2. Build JavaScript/CSS

    Install SASS

    To compile the CSS for the project we use SASS. This relies on a ruby gem called sass.

    sudo gem install sass
    

    For production, JavaScript and CSS should be minifed; the application is configured to offer compressed files unless you tell it to use dev mode. The build mechanism uses Grunt, which first needs to be installed.

    Make sure you have Grunt CLI tools

    npm install -g grunt-cli
    

    Install the Node.js application modules

    npm install
    

    To build in production mode; this uses minified javascript and CSS

    grunt
    

    To build in development mode; this uses uncompressed javascript and CSS that can easily be debugged

    grunt dev
    
  3. Start Redis

    The application uses Redis to store information when the collaboration features are being used. This needs to be running in order for the application to start

    systemctl enable redis
    systemctl start redis
    
  4. Run the application

    At this point you should have everything you need to start the application

    node app.js
    

    You can check the application is running by going to http://localhost:6789/ This will give you basic functionality and the ability to add new WMS layers, but if you want to use the application's collaboration features and/or allow users to upload and save geometry files you will need to setup a configuration file...

  5. Creating a configuration file

    The application configuration files are created in config and the easiest way to create one is to use the install script; run:

    ./install.sh
    

    and following the prompts to create a config file. The resulting config file will be created in config/site_settings/<domain>/config.js - you should keep a backup of this file. Have a look in config_examples/config.js for additional optional configuration options that can be used to change the behviour of your version.

  6. On-going maintenance

    During normal use of the application users can upload shape files, CSV files and various geometry files to identify their region of interest. Eventually, these are stored in /config/site_settings/<domain>/user_<email_address> but whilst they are being uploaded and converted they are stored in uploads. If the conversion to GeoJSON fails for any reason then the uploaded file is not deleted; you may want to periodcally delete everything from this folder.

    If a user requests a plot the resulting plot files are stored in html/plots; this folder can grow to be very large and you may want to periodically delete things from this directory too. During the plot creation a netCDF file is created in /tmp to holde the data for the requested area; these should be deleted regularly too.

    You could add a crontab entry to cover each of these tasks:

    0 2 * * * find /path/to/GISporal/uploads/ -mtime +1 exec rm -rf {} \;
    0 2 * * * find /path/to/GISporal/html/plots -mtime +1 exec rm -rf {} \;
    0 2 * * * find /tmp -name "*.nc" -mtime +1 exec rm -rf {} \;
    

Additional Indicator Information

To give users more information, you can set up some markdown files that can be shown on indicators.

To do this you need to create a markdown folder inside the domain level site_settings folder. Inside this folder you should create a folder for each of the layer tags that you want to describe further. Finally fill each tag folder with markdown files in the format: tag_value.md where tag_value is the lowercase value of the tag.

nginx Configuration

The collaboration features of the GISportal use websockets to communicate between server and browser. nginx offers really good support for websockets so this is the preferred and recommended web server software; other web servers may work but not fully.

An example nginx configuration would look like this:

server {
    listen *:80;

    location  /. { ## Disable .htaccess and other hidden files
        return 404;
    }

    location / {
        try_files @uri @location_node;
    }

    location @location_node {
        proxy_pass http://localhost:6789;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        proxy_redirect     off;
        proxy_set_header   Host $host;
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Host $server_name;
    }
}

Docker

There is a Dockerfile that can be used to build a Docker image provided with this repository. See the [docker-readme.md] file for full details of how to do this.

Alternatively, you can use the pre-built image that is available to download from the Docker Hub

docker pull pmlrsg/gisportal

Analytics

Enabling basic GA

Go to config/config.js and set gisportal.config.analytics.active to true and gisportal.config.analytics.UATrackingId to the tracking code of the project. Basic tracking is now enabled.

Setting up Custom Definations

For a deeper level of tracking custom definations needs to be setup. For this you need to go into the google analytics admin and select Custom Definitions under the property column.

Custom Dimensions Start by clicking Custom Dimensions and creating a new custom dimesion labeled Indicator Name.
Procede to make this list IN THIS ORDER:

  • Indicator Name
  • Indicator ID
  • Region
  • Interval
  • Elevation
  • Layer Style
  • Graph type
  • Confidence
  • Year
  • Click Location

Custom Metrics In the left hand panel select Custom Metrics and again make the following in the same order:

  • Used in graph
  • Used in layer

If you had no previous metrics or dimensions installed and you added them in the listed order analytics is now setup.

Follow this section only if you already had custom metrics made or didnt make them in that order:
Each custom definiation has a unique index.cm[0-9][0-9] for Custom Metrics and cd[0-9][0-9] for Custom Dimensions. Indexes can not be changed. The current config file was expecting the definition names to be next to certain indexes. Go over each custom definition key in the config file and change it the one in your analytics account.

Currently mapped names:
Dimenstions:
#cd1 - Indicator Name
#cd2 - Indicator ID
#cd3 - Region
#cd4 - Interval
#cd5 - Elevation
#cd6 - Layer Style
#cd7 - Graph type
#cd8 - Confidence
#cd9 - Year
#cd10 - Click Location
#cd11 - Indicator Provider

Metrics:
#cm1 - Used in graph
#cm2 - Used in layer

gisportal's People

Contributors

bcalton avatar bod-pml avatar doclements avatar earthserver-pml avatar kjones1876 avatar nickmackz avatar ojsdude avatar petwa avatar pml-snee avatar pmltester1 avatar shanehudson avatar shanopow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gisportal's Issues

Error handling code when user is not logged in

Code creates a silent HTTP 500 error and creates the below stacktrace.

[Thu Apr 03 14:24:16.644533 2014] [:error] [pid 7025] [remote 192.171.164.51:180] Traceback (most recent call last):
[Thu Apr 03 14:24:16.644568 2014] [:error] [pid 7025] [remote 192.171.164.51:180]   File "/usr/lib/python2.7/site-packages/flask/app.py", line 1701, in __call__
[Thu Apr 03 14:24:16.645191 2014] [:error] [pid 7025] [remote 192.171.164.51:180]     return self.wsgi_app(environ, start_response)
[Thu Apr 03 14:24:16.645219 2014] [:error] [pid 7025] [remote 192.171.164.51:180]   File "/usr/lib/python2.7/site-packages/flask/app.py", line 1689, in wsgi_app
[Thu Apr 03 14:24:16.645250 2014] [:error] [pid 7025] [remote 192.171.164.51:180]     response = self.make_response(self.handle_exception(e))
[Thu Apr 03 14:24:16.645268 2014] [:error] [pid 7025] [remote 192.171.164.51:180]   File "/usr/lib/python2.7/site-packages/flask/app.py", line 1687, in wsgi_app
[Thu Apr 03 14:24:16.645292 2014] [:error] [pid 7025] [remote 192.171.164.51:180]     response = self.full_dispatch_request()
[Thu Apr 03 14:24:16.645309 2014] [:error] [pid 7025] [remote 192.171.164.51:180]   File "/usr/lib/python2.7/site-packages/flask/app.py", line 1360, in full_dispatch_request
[Thu Apr 03 14:24:16.645332 2014] [:error] [pid 7025] [remote 192.171.164.51:180]     rv = self.handle_user_exception(e)
[Thu Apr 03 14:24:16.645348 2014] [:error] [pid 7025] [remote 192.171.164.51:180]   File "/usr/lib/python2.7/site-packages/flask/app.py", line 1358, in full_dispatch_request
[Thu Apr 03 14:24:16.645371 2014] [:error] [pid 7025] [remote 192.171.164.51:180]     rv = self.dispatch_request()
[Thu Apr 03 14:24:16.645387 2014] [:error] [pid 7025] [remote 192.171.164.51:180]   File "/usr/lib/python2.7/site-packages/flask/app.py", line 1344, in dispatch_request
[Thu Apr 03 14:24:16.645410 2014] [:error] [pid 7025] [remote 192.171.164.51:180]     return self.view_functions[rule.endpoint](**req.view_args)
[Thu Apr 03 14:24:16.645427 2014] [:error] [pid 7025] [remote 192.171.164.51:180]   File "/home/rsgadmin/oceancolour.org/OpEcVis/middleware/portalflask/views/graph.py", line 93, in setGraph
[Thu Apr 03 14:24:16.645590 2014] [:error] [pid 7025] [remote 192.171.164.51:180]     error_handler.setError('2-01', state, g.user.id, "views/graphs.py:setGraph - The user is no t logged in, returning 401 to user.", request)
[Thu Apr 03 14:24:16.645642 2014] [:error] [pid 7025] [remote 192.171.164.51:180] NameError: global name 'error_handler' is not defined

Branding

There are still some OPEC branding issues, such as the logo. These need to be made configurable.

Any way to update the layer cache?

I have a thredds WMS Service that gets extended every day with new data. In the past there was a way to update the layer cache. Is seems these scripts were removed in 76a882b

Is there any way to do that now?

I've tried some of the calls in GISportal/app/lib/site_settings.js but was not successful.

Deactivate data download

Hi, I am currently setting up the GISportal for our soil moisture data records (https://dataviewer.geo.tuwien.ac.at/)

I was wondering if it is possible to deactivate the netcdf data download for a data set (or all datasets) after installation, while still providing the WCS features to create time series / hovmoeller diagram etc.

Date field is broken.

Trying to change the date using the date field in the lower right corner does not work.

Polygon drawing broken

Trying to draw a polygon for plotting gets stuck in dragging the map around. This was already an issue in the past see #37 but it has returned for me int he latest master.

Tried on

  • Firefox 44.0.2
  • Chrome 50.0.2661.94 (64-bit)

both on Ubuntu 14.04 with GISportal running out of a docker container.

SRS value for GetMetaData

With thredds 4.3 the getMetaData request also requires an SRS value.

Portal.js, line 2652, add the following to the request:

&srs=EPSG%3A4326

User dashboard error 403 Forbidden

Hi

I've set up GISportal on an internal RHEL vm under supervsiord. It's accessible through a browser, however, no user dashboard is available. I feel I'm missing something really basic in the config steps.

I've added admin user emails for myself and another, however, when I track the http responses I see some errors.

There is a 404 Not Found on:

GET /app/cache/10.83.64.51:6789/vectorLayers.json HTTP/1.1

And a 403 Forbidden on:

GET /app/user/dashboard/?domain=10.83.64.51:6789 HTTP/1.1

Here's the full http response (minus the cookie details) on the latter:

GET /app/user/dashboard/?domain=10.83.64.51:6789 HTTP/1.1
Host: 10.83.64.51:6789
Accept: application/json, text/javascript, /; q=0.01
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
Cookie:
Referer: http://10.83.64.51:6789/
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.162 Safari/537.36
X-Requested-With: XMLHttpRequest

HTTP/1.1 403 Forbidden
Connection: keep-alive
Content-Length: 9
Content-Type: text/plain; charset=utf-8
Date: Wed, 21 Mar 2018 00:11:03 GMT
ETag: W/"9-cilpV3qWyjlT6E49lJ3ugQ"
X-Powered-By: Express

Is there a login screen? How is authentication handled?

Thanks for your help
Ian

Indicators Automatically Change Panel

Once the #8 Panel Manager is implemented, we need to automatically change to indicator panel when an indicator is added. This improves the learning and reduces the load on the server.

Impossible to use `_` in path name?

It seems that / in domains are replaced by _ without taking care of existing _ characters. If this is by design then it should be at least documented somewhere.

Feature Request: Values exceeding colour palette min/max default to black instead of the first/last colour in the palette.

When using the default stretching we use for chlor_a (log 10 scaled, 0.01 to ~67) to keep features highlighted nicely but also comparable between images.

However, when a value is below the minimum or above the maximum, in typical viewers/plotting tools they are just shown as either the first or last colour from the palette. In the GIS portal, these default to being shown as black and the option to go White/Transparent/Pick a colour is given in the layer options but is difficult to manage for colour palettes that don't use a colour for which you could easily guess the hex value.

Features requested:

  • Use the lowest value colour from the palette for values that are lower than the palette minimum.
  • Use the highest value colour from the palette for values that are higher than the palette maximum.
  • Potentially make this the default behaviour to keep functionality in line with what is a fairly well established norm across plotting tools/viewers. (at least the ones I'm familiar with)

Rewrite README

The README needs rewriting so that it is not directly related to OPEC and so that all installation steps are correct and up to date.

Support for servers other than THREDDS

Great job on the GIS portal, i was wondering if it is still under development or not.

It looks that it is mainly built to work with the THREDDS server.

Are there any plans to make it work with other ones such as GeoServer? The WCS implementation specifically seems to be different

OpenLayers drag seems broken.

Hi, Thanks for the new release. It is great and I was very happy to see that the plotting functionality is now also based on Python.

But there is one thing that only became an issue recently. It seems that in the latest dockerfile as well as on the master branch the dragging of the map is broken. The map is dragged further than the mouse moves. Also trying to draw a polygon for plotting gets stuck in dragging the map around.

This still worked middle of last week.

Panel Manager

Currently the panels are managed by just showing and hiding each one, since I didn't want to to over complicate the development. But I think now we are at a position that we can start looking towards a 'class' that just manages panels, so we know in code (as opposed to DOM) which panel is open etc. Makes it far easier for states too.

Share button not working / throws error javascript error

First of all thanks for all the help on the other issues.

This might be more of a question than an issue.

The src/js/openid.js file is not in the coreFiles in the Gruntfile so the gisportal.openid object is not created. But even after adding it the Share button does not produce an URL. I saw some todos about this in the code so is this even supposed to work in the current state?

Sharing a map does not reproduce the set colorbar min and max value

I've just tried this on the running portal at https://wci.earth2observe.eu/portal so sorry if it was already fixed in a development version.

Anyway. When looking at the map accessible under the link https://wci.earth2observe.eu/portal/?state=a0ce77 you can see that the soil moisture has black areas because it is automatically scaled between 0.05... and 0.433... In the original map that I created before pressing the share button I manually scaled the data between 0 and 0.6 so that it looks nice. It would be great if the colorbar settings could be also stored in the shared map state.

Colorbar error with THREDDS server

Hey.

I have made two docker containers. One contains the GISportal from the dockerhub the pmlrsg/gisportal and the second one the unidata/thredds-docker server. I have also hosted a netcdf file with THREDDS which I am testing and trying to show and so far I've made it to work with the display of data but the colorbar doesn't seem to appear.

I am getting the error: There was an error loading the scalebar from this URL:

http://thredds:8080/thredds/wms/test/ncf.nc?REQUEST=GetLegendGraphic&LAYER=testlayer&PALETTE=ferret&COLORSCALERANGE=0.04393946,0.4649605&NUMCOLORBANDS=255&ABOVEMAXCOLOR=0x000000&BELOWMINCOLOR=0x000000

The URL GET request works but it shows the full graphic not just the color bar. It seems to me that some params are missing in the get request (i.e colorbaronly) as in the link below the color bar works. Some other params are HEIGHT and WIDTH

https://wci.earth2observe.eu/thredds/wms/anu/wrr2-monthly-agg.nc?REQUEST=GetLegendGraphic&LAYER=GroundMoist&PALETTE=rainbow&HEIGHT=500&WIDTH=30&colorbaronly=true&COLORSCALERANGE=-1645.4514,119.667984&NUMCOLORBANDS=255&HEIGHT=500&WIDTH=30&colorbaronly=true&COLORSCALERANGE=-1645.4514,119.667984&NUMCOLORBANDS=255%22

Any hints in solving this? Thanks in advance.

.install.sh not creating server config in ./GISportal/config/site-settings/<server name>

Hi,

I'm setting up GISportal on a virtual machine (RHEL 6.8). This vm is only available within the university domain and so I've gone for 'no' to ssl and authentication options as a test.

I've gotten everything installed and running up to the point of launching node app.js

When I've run the ./install.sh it goes through the install process smoothly with no errors but 4 warnings:

WARN: Dropping unused variable csv_found [GISportal.js:6134,10]
WARN: Dropping side-effect-free statement [GISportal.js:11555,9]
WARN: Dropping side-effect-free statement [GISportal.js:19587,6]
WARN: Dropping side-effect-free statement [GISportal.js:21336,3]

And says it completes with no errors. However, when I launch node.js these are the messages I see:
"
No server config was found.

If this is a new installation you should run ./install.sh to create a configuration for your domain.

List of domains with Google authentication settings:

(node:38304) [DEP0016] DeprecationWarning: 'GLOBAL' is deprecated, use 'global'

GISportal server listening on port 6789
Connected to redis.
Redis client ready.
"
I check on a browser by going to the vm hostname\domain name from ./install.sh and port 6789 but get 'site can't be reached'. I notice there's a) no server config found, b) list of google auth is empty and c) deprecation warning. When I check the "./GISportal/config/site-settings/" dir it's empty.

I'm not a linux/redis/node guru obviously, can you please advise what might be causing these issues?

Cheers
Ian

Any plans for support of other OGC Protocols, especially WMTS?

Last week the Copernicus Viewing Service was announced and I discovered that they are using WMTS instead of WMS. Since we would like to integrate at least one of their products in our viewer it would be interesting to use their servers instead of hosting it ourselves. Are there any plans already to also support this protocol? If not then I might be able to work on that in a few weeks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.