Configuring Regions - AtlasOfLivingAustralia/documentation GitHub Wiki

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=[top-left-lat, top-left-lng, bottom-right-lat, bottom-right-lng]

eg. map.bounds=[38,-9,42,-7] or for eg. US-VT map.bounds=[45.5, -74, 42.5, -72]
  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"
  }
]

And restart tomcat with

systemctl restart tomcat7

or for faster results just restart Regions with eg.

touch /var/lib/tomcat7/webapps-regions.l-a.site.org/ROOT.war

And note that any new layers must be sampled and indexed with biocache for all occurrences, followed by swapping SOLR cores. See https://github.com/AtlasOfLivingAustralia/documentation/wiki/Troubleshooting#sampling for that process.