Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Represents The /map resource represents the mapping capabilities of Weave.


Note
For Weave to be able to provide mapping functions one or more map engines must be configured. A map engine abstracts an application or service which is capable of generating map images.


Top-level resource: services/v1/map


Sub-resources:

1

...

. /map/mapengines

Provides a list of all map engines configured and available on Weave.

Noteinfo
titleRelated Further reading

Map engine definition

Map engine configuration


Example 1 

...

Code Block
languagejs
collapsetrue
{
  "success": true,
  "mapengines": [
    {"id": "mapengine.upload"},
    {
      "acetate": false,
      "selection": false,
      "legend": true,
      "format": "image/png32",
      "id": "selection.area_details",
      "override": {"entity": {
        "id": "local_government_area",
        "content": "sld/LGA.sld"
      }},
      "orderCheck": false
    },
    {"id": "google.streets"},
    {
      "acetate": false,
      "selection": false,
      "legend": true,
      "format": "image/png32",
      "id": "selection.main",
      "override": {"polygon": {
        "stroke-width": 1,
        "fill-color": "red",
        "fill-opacity": 0.25,
        "stroke-color": "red"
      }},
      "orderCheck": false
    },
    {
      "acetate": false,
      "selection": false,
      "crs": "EPSG:3857",
      "tokens": {"token": {
        "name": "ITEMFONTSIZE",
        "value": 11
      }},
      "id": "nsw_imagery_wms",
      "url": "http://maps.six.nsw.gov.au/arcgis/services/public/NSW_Imagery/MapServer/WMSServer?VERSION=1.3.0"
    },
    {
      "acetate": false,
      "selection": false,
      "legend": true,
      "format": "image/png32",
      "id": "selection.property_details",
      "override": {"entity": {
        "id": "property",
        "content": "sld/Property.sld"
      }},
      "orderCheck": false
    },
    {
      "acetate": false,
      "id": "nswdpe.ov",
      "selection": false,
      "crs": "EPSG:3857",
      "url": "http://192.168.2.146:80/cgi-bin/qgis_mapserv.fcgi?map=/data/maps/nswdpe_ov.qgs&VERSION=1.3.0"
    },
 {
      "acetate": false,
      "selection": false,
      "crs": "EPSG:3857",
      "scales": {"scale": [
        {
          "maxScale": 1,
          "minScale": 1,
          "layer": "development_application"
        },
        {
          "maxScale": 1,
          "minScale": 1,
          "layer": "major_projects_jobs_lap"
        },
        {
          "maxScale": 1,
          "minScale": 1,
          "layer": "major_projects_sites_lap"
        }
      ]},
      "tokens": {"token": {
        "name": "ITEMFONTSIZE",
        "value": 11
      }},
      "id": "nswdpe",
      "url": "http://192.168.2.146:80/cgi-bin/qgis_mapserv.fcgi?map=/data/maps/nswdpe.qgs&VERSION=1.3.0"
    }
]
}




Anchor

...

layers-info
layers-info
2. /map/mapengines/{mapengineid}/layers

Provides a list of all map layers available for a given map engine.


Example 2 - 

Code Block
languagebash
themeEmacs
curl -X GET --header 'Accept: application/json' 'http://localhost:8080/weave/services/v1/map/mapengine/nswdpe/layers'

...

Code Block
languagejs
collapsetrue
{
  "success": true,
  "layers": [
    {
      "scaleRange": "<500000.0",
      "boundingBoxes": [
        "{minx: 142.269, miny: -37.5493, maxx: 153.695, maxy: -28.1079, crs: 'GEOGCS[\"WGS 84\", DATUM[\"World Geodetic System 1984\", SPHEROID[\"WGS 84\", 6378137.0, 298.257223563, AUTHORITY[\"EPSG\",\"7030\"]], AUTHORITY[\"EPSG\",\"6326\"]], PRIMEM[\"Greenwich\", 0.0, AUTHORITY[\"EPSG\",\"8901\"]], UNIT[\"degree\", 0.017453292519943295], AXIS[\"Geodetic longitude\", EAST], AXIS[\"Geodetic latitude\", NORTH], AUTHORITY[\"EPSG\",\"4326\"]]'}",
        "{minx: 1.58373E7, miny: -4515950.0, maxx: 1.71093E7, maxy: -3262580.0, crs: 'PROJCS[\"WGS 84 / Pseudo-Mercator\", GEOGCS[\"WGS 84\", DATUM[\"World Geodetic System 1984\", SPHEROID[\"WGS 84\", 6378137.0, 298.257223563, AUTHORITY[\"EPSG\",\"7030\"]], AUTHORITY[\"EPSG\",\"6326\"]], PRIMEM[\"Greenwich\", 0.0, AUTHORITY[\"EPSG\",\"8901\"]], UNIT[\"degree\", 0.017453292519943295], AXIS[\"Geodetic longitude\", EAST], AXIS[\"Geodetic latitude\", NORTH], AUTHORITY[\"EPSG\",\"4326\"]], PROJECTION[\"Popular Visualisation Pseudo Mercator\", AUTHORITY[\"EPSG\",\"1024\"]], PARAMETER[\"semi_minor\", 6378137.0], PARAMETER[\"latitude_of_origin\", 0.0], PARAMETER[\"central_meridian\", 0.0], PARAMETER[\"scale_factor\", 1.0], PARAMETER[\"false_easting\", 0.0], PARAMETER[\"false_northing\", 0.0], UNIT[\"m\", 1.0], AXIS[\"Easting\", EAST], AXIS[\"Northing\", NORTH], AUTHORITY[\"EPSG\",\"3857\"]]'}"{
  "success": true,
  "mapengines": [
    {
      "id": "mapengine.upload"
    },
    {
      "acetate": false,
      "selection": false,
      "legend": true,
      "format": "image/png32",
      "id": "selection.area_details",
      "override": {
        "entity": {
          "id": "local_government_area",
          "content": "sld/LGA.sld"
        }
      },
      "orderCheck": false
    },
    {
      "id": "google.streets"
    },
    {
      "acetate": false,
      "selection": false,
      "legend": true,
      "format": "image/png32",
      "id": "selection.main",
      "override": {
        "polygon": {
          "stroke-width": 1,
          "fill-color": "red",
          "fill-opacity": 0.25,
          "stroke-color": "red"
        }
      },
      "orderCheck": false
    },
    {
      "acetate": false,
      "selection": false,
      "crs": "EPSG:3857",
      "tokens": {
        "token": {
          "name": "ITEMFONTSIZE",
          "value": 11
        }
      },
      "id": "nsw_imagery_wms",
      "url": "http://maps.six.nsw.gov.au/arcgis/services/public/NSW_Imagery/MapServer/WMSServer?VERSION=1.3.0"
    },
    {
      "acetate": false,
      "selection": false,
      "legend": true,
      "format": "image/png32",
      "id": "selection.property_details",
      "override": {
        "entity": {
          "id": "property",
          "content": "sld/Property.sld"
        }
      },
      "orderCheck": false
    },
    {
      "acetate": false,
      "id": "nswdpe.ov",
      "selection": false,
      "crs": "EPSG:3857",
      "url": "http://192.168.2.146:80/cgi-bin/qgis_mapserv.fcgi?map=/data/maps/nswdpe_ov.qgs&VERSION=1.3.0"
    },
    {
      "acetate": false,
      "selection": false,
      "crs": "EPSG:3857",
      "scales": {
        "scale": [
          {
            "maxScale": 1,
            "minScale": 1,
            "layer": "development_application"
          },
          {
            "maxScale": 1,
            "minScale": 1,
            "layer": "major_projects_jobs_lap"
          },
          {
            "maxScale": 1,
            "minScale": 1,
            "layer": "major_projects_sites_lap"
          }
        ]
      },
      "tokens": {
        "token": {
          "name": "ITEMFONTSIZE",
          "value": 11
        }
      },
      "id": "nswdpe",
      "url": "http://192.168.2.146:80/cgi-bin/qgis_mapserv.fcgi?map=/data/maps/nswdpe.qgs&VERSION=1.3.0"
    }
  ]
}


3

...

. /map/show

Represents the map imaging capabilities of Weave. This resource supports both HTTP GET and HTTP POST requests. A GET request may specify a map images from a single map engine whereas a POST request may specify a composite image consisting of multiple images sourced from different map engines. POST requests may also specify selections which can be drawn using a specially configured 'selection map engine' in Weave.

Parameters

3.1. GET query parameters

mapengine.id - string - map engine identifier as per configuration

layers - comma separated list of strings - map layers layer identifiers as per configuration (Refer to /map/mapengines/{mapengineid}/layers )

styles - comma separated list of strings - styles as per map layer configuration

crs - string - Coordinate reference system used to specify the map envelope coordinates (minx, miny, maxx, maxy)

minx - decimal - Left margin x axis value of the map image

miny - decimal - Bottom margin y axis value of the map image

maxx - decimal - Right margin x axis value of the map image

maxy - decimal - Top margin y axis value of the map image

scale - Map scale - ratio of a unit of distance on the map image to actual distance on land - if different from the scale derived by comparing the map envelope to width and height, envelope will be readjusted 

dpi - integer - Logical (CSS) dots-per-inch value on the client display 

width - integer - image width in pixels

height - integer - image height in pixels

opacity - decimal - image  transparency as a decimal <= 1.0


3.2. Sample POST body parameterexample:


Code Block
languagejs
collapsetrue
{
  "map.descriptions": [
    {
      "opacity": 1,
      "layers": "0",
      "map.engine": "google.streets"
    },
    {
      "opacity": 1,
      "layers": "addresspoi",
      "map.engine": "nswdpe"
    },
    {
      "opacity": 1,
      "layers": "_selection.all",
      "map.engine": "selection.main"
    }
  ],
  "selections": [
    {
      "entityid": "property",
      "featureids": [
        "2035960_Unit_1_1_Market_Street__11_Sydney_DP777449"
      ]
    }
  ]
}



Return values

Accept headerReturn value exampleDescription
image/*<image binary data
stream>
stream, default format is PNG>image data
image/png<image binary data
stream>
stream, PNG format>image data
image/jpeg<image binary data
stream>
stream, JPEG format>image data
application/json


Code Block
languagejs
collapsetrue
{
  "dpi": 96,
  "path": "mapcache/e9483f10-5437-11e7-b4e8-3252cbe7fd57/image.png",
  "format": "image/png",
  "size": {
    "width": 960,
    "height": 540
  }
}


JSON object containing a 'path' property which points to a generated image on the server




Example 3 - Draw a map image using a map engine backed by a WMS server (HTTP GET)

...

Example 3 - Draw a map image by specifying pre-configured layers and a feature selection (HTTP POST)

Code Block
languagebash
themeEmacs
curl -X POST --header 'Content-Type: application/json' --header 'Accept: applicationimage/jsonpng' --data '{"map.descriptions":[{"opacity":1,"layers":"0","map.engine":"google.streets"}, {"opacity":1,"layers":"addresspoi","map.engine":"nswdpe"},{"opacity":1,"layers":"_selection.all","map.engine":"selection.main"}],"selections":[{"entityid":"property","featureids":["2035960_Unit_1_1_Market_Street__11_Sydney_DP777449"]}]}' 'http://localhost:8080/weave/services/v1/map/show?crs=EPSG%3A3857&minx=16831751.916958902&miny=-4011871.179336485&maxx=16832450.599170577&maxy=-4011360.603874112&scale=288895.277144&dpi=96&width=960&height=540&opacity=1&imagetype=image%2Fpng' > map_1_layer.png


Output:

Image Added



Note
Producing a single map image by combining a number of map images sourced from multiple map engines is a resource - intensive process. Where Weave application's resources are constrained, this approach is not recommended for implementing live map clients. Instead it is recommended that images (with an opacity less than 1) are superimposed as separate layers at the client end.

Output:

...