Skip to content

Configuring Regions

jloomisVCE edited this page Oct 13, 2020 · 6 revisions

Here we'll expose the sampled polygons layers in a menu of the regions service.

  1. You need to add CORS headers to your spatial.l-a.site in the geoserver location. Edit the file /etc/nginx/sites-enabled/spatial.l-a.site.conf and add the add_header lines:
location /geoserver {
        if ($blocked_user_agent) {
            return 444;
        }
        # proxy_set_header Host $host;
        proxy_set_header Host spatial.l-a.site;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Port $server_port;
        proxy_read_timeout 10m;
        proxy_pass http://127.0.0.1:8080/geoserver;
        add_header 'Access-Control-Allow-Origin' '*' always;
        add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS' always;
        add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With' always;
}

And restart nginx with sudo service nginx restart.

  1. Configure sensible defaults for the initial maps (the default is scoped to Australia), on the parameter map.bounds at /data/regions/config/regions-config.properties, e.g.:
map.bounds=[38,-9,42,-7]
  1. Configure menu-config.json to use new layer in the menu. This file is found in /data/regions/config, e.g.
[
  {
    "label": "China National Boundaries",
    "fid": "cl10004"
  },
  {
    "label": "Australian States",
    "fid": "cl10006"
  },
  {
    "label": "Canadian National Parks",
    "fid": "cl0007"
  }
]

To make changes to Regions take effect, restart tomcat with 

`systemctl restart tomcat7`, or eg.

`touch /var/lib/tomcat7/webapps-regions.l-a.site.org/ROOT.war`
Clone this wiki locally