Adding Layers - AtlasOfLivingAustralia/documentation Wiki

Introduction

In this page we document how to:

Load Shapefile into spatial service

  1. Using a browser go to your: http://spatial.l-a.site/ws
  2. Upload shapefile (SHP) in zip file using the “Manage layer uploads”. Your shapefile should be zipped and contain at least SHP, DBF, PRJ and SHX files with a ISO-8859-1 DBF charset (you can convert DBF charset using libreoffice calc), more info about this charset issue and future support of other charsets. Verify that the DBF have some field with unique values (and if not, add it with QGis or similar). You can download an example shapefile here or here. Also a WGS84 CSR is highly recommended.
  3. Create the “Layer” using the UI
  4. View the DBF fields of the Shapefile by clicking on the map (this requires the PRJ file to included) - view the layers and click “edit layer”
  5. Define one or “Fields” for your layer. These are the properties used in sampling. Make sure to:
    1. Select a sensible field from the layer. For this you use libreoffice calc to open the DBF and see the fields aka column names and values, so you can choose something like a region or country name, as is what name the user will see in each region of the layer. You can also use qgis and select some region to see the properties (field names and values).
    2. Change the display name. This is how the layer can be found in the spatial portal
    3. Edit the layer and set values for the properties Classification1 and Classification2. This is visible in a tree hierarchy in the spatial portal
  6. Monitor progress of Field generation using the “Tasks” UI. All these tasks are time consuming so, be patient.
  7. Refresh intersect config: http://spatial.l-a.site/ws/intersect/reloadConfig
  8. Verify the layer and fields in spatial service & geoserver and web services are working:
    1. Use the geoserver UI http://spatial.l-a.site/geoserver
      1. Preview the layer in OpenLayers
      2. View configuration for layers (default username/password = admin/geoserver)
    2. Test the following JSON services:
      1. Check your layer appears in the layer list: http://spatial.l-a.site/ws/layers
      2. Check you field(s) appears in the fields list: http://spatial.l-a.site/ws/fields
      3. List the objects in the field http://spatial.l-a.site/ws/objects/<FIELD_ID>
      1. Retrieve the details of single object http://spatial.l-a.site/ws/object/<OBJECT_ID>
      2. Download the KML for an object: http://spatial.l-a.site/ws/shape/kml/<OBJECT_ID>
      3. Check point intersection works for your field(s) http://spatial.l-a.site/ws/intersect/<FIELD_ID>/<LATITUDE>/<LONGITUDE>
  9. Test the uploaded layer in the spatial portal
    1. Use “Add to Map > Areas > Gazetteer Polygon”
    2. Use “Add to Map > Areas > Select from Polygon Layer”

Symptom of a incorrectly or incompatible uploaded layer

If you add some layer to the map, and you try to select a region by pressing a zoom icon, you should zoom to that region correctly:

but if instead you get a world image, it's an indication that something is not supported or correct in your layer (like some not supported projection and/or encoding):

One way to fix this is to import your shapefiles into eg. QGIS-desktop, then re-export them with new encoding (ISO-8859-1) and new Coordinate Reference System (EPSG:4326 - WGS 84, or just 'WGS84'):

Typical utf-8 issue:

Copy your new layers to your biocache-store

With something like from your spatial VM:

scp -i your-ssh-key /data/spatial-data/layer/*{shp,dbf,prj,shx} [email protected]:/data/biocache/layers

TODO: Why do we do this? (Like: 'biocache sample uses layers files for sampling.')

Load a grid file into spatial service

Examples can be downloaded from: http://www.worldclim.org/current. Look for the BioClim layers. You can get an example of grid layers here. If you are only testing, use a 10 minute grid (smaller). Note: the zips from this website will fail. Uploads require a zip with a single set of HDR, BIL, PRJ and bil.aux.xml files).

But you can for example download 1.4 version from http://worldclim.org/version1 like http://biogeo.ucdavis.edu/data/climate/worldclim/1_4/grid/cur/prec_10m_bil.zip, unzip and zip again a single set of .hdr and .bil files, such as prec1.hdr and prec1.bil and then zip that up and use that file.

For http://worldclim.org/version2, that is, GeoTIFF files, use gdal_translate before hand: gdal_translate -of EHdr -ot Float32 wc2.0_bio_10m_01.tif wc2.0_bio_10m_01.bil.

  1. Using a browser go to your: http://spatial.l-a.site/ws for the admin screen
  2. Upload grid file (must contain HDR, BIL and PRJ files) in zip file using the “Manage layer uploads”.
  3. Create the “Layer” using the UI
  4. Create a “Field” associated with this layer using the UI
  5. Monitor progress of Field generation using the “Tasks” UI
  6. Refresh intersect config: http://spatial.l-a.site/ws/intersect/reloadConfig
  7. Verify the layer and fields in spatial service & geoserver and web services are working:
    1. Use the geoserver UI http://spatial.l-a.site/geoserver
      1. Preview the layer in OpenLayers
    2. Test the following JSON services:
      1. Check you layer appears in the layer list: http://spatial.l-a.site/ws/layers
      2. Check you field(s) appears in the fields list: http://spatial.l-a.site/ws/fields
      3. Check point intersection works for your field(s) http://spatial.l-a.site/ws/intersect/<FIELD_ID>/<LAT>/<LNG>