Web Services - Advanced Guide

Custom Applications

Web Services can be utilised in custom GIS applications built with a variety of web GIS frameworks such as:


Leaflet

Web Services can be used in a leaflet application using the ESRI Leaflet plugin.

The line of code below is an example of how to add the Imagery service to a Leaflet map as a Tiled Map Layer:

L.esri.tiledMapLayer("http://maps.six.nsw.gov.au/arcgis/rest/services/public/NSW_Imagery/MapServer", {}).addTo(map);


ESRI JavaScript API

This snippet would add the Imagery service as a Tiled Map Layer to an application built using the ESRI JavaScript API:

var map;
require(["esri/map", "esri/layers/ArcGISTiledMapServiceLayer", "dojo/domReady!"], function(Map, Tiled) {
  map = new Map("map");
  var tiled = new Tiled(http://maps.six.nsw.gov.au/arcgis/rest/services/public/NSW_Imagery/MapServer);
  map.addLayer(tiled);
});


ArcGIS Online

To open an Web Service in ArcGIS Online, visit it's REST endpoint (e.g. NSW Imagery) and click the link to view in 'ArcGIS.com Map'.

View in ArcGIS.com Map


SOAP

You can also use Web Services in a custom application that makes SOAP requests.
To obtain the service's SOAP URL, visit the REST endpoint (e.g. NSW Imagery) and look for SOAP link towards the top of the page. The SOAP link provides the URL that accepts SOAP requests from your application.

Supported Interfaces


Using Tile Cache in MapInfo and QGIS

The default configurations of QGIS and MapInfo do not work with Tiled Map Services by default. However we can use Tiled Map Services in these applications through the use of an XML definition file.


QGIS

Create an XML file with the following content:

<GDAL_WMS>
  <Service name="TMS">
    <ServerUrl>http://maps.six.nsw.gov.au/arcgis/rest/services/public/NSW_Imagery/MapServer/tile/${z}/${y}/${x}</ServerUrl>
  </Service>
  <DataWindow>
    <UpperLeftX>1.53E7</UpperLeftX>
    <UpperLeftY>-5070000.0</UpperLeftY>
    <LowerRightX>1.781E7</LowerRightX>
    <LowerRightY>-2950000.0</LowerRightY>
    <TileLevel>18</TileLevel>
    <TileCountX>1</TileCountX>
    <TileCountY>1</TileCountY>
    <YOrigin>top</YOrigin>
  </DataWindow>
  <Projection>EPSG:3857</Projection>
  <BlockSizeX>256</BlockSizeX>
  <BlockSizeY>256</BlockSizeY>
  <BandsCount>3</BandsCount>
  <Cache />
</GDAL_WMS>


The example shown uses the Imagery service. To use the Map service, update the ServerUrl to the following:

<ServerUrl>http://maps.six.nsw.gov.au/arcgis/rest/services/public/NSW_Base_Map/MapServer/tile/${z}/${y}/${x}</ServerUrl>


You can then drag and drop the XML file into QGIS, or navigate to the file's location and open using 'Add Raster Layer'.


MapInfo

Create an XML file with the following content:

<?xml version="1.0" encoding="utf-8"?>
<TileServerInfo Type="LevelRowColumn">
  <Url>http://maps.six.nsw.gov.au/arcgis/rest/services/public/NSW_Imagery/MapServer/tile/{LEVEL}/{COL}/{ROW}</Url>
  <MinLevel>0</MinLevel>
  <MaxLevel>18</MaxLevel>
  <TileSize Height="256" Width="256" />
  <AttributionText Font='Font ("Tahoma",257,8,16777215,0)'>
    (c) Land and Property Information,NSW</AttributionText>	
</TileServerInfo>


The example shown uses the Imagery service. To use the NSW Map service, update the URL to the following:

<Url>http://maps.six.nsw.gov.au/arcgis/rest/services/public/NSW_Base_Map/MapServer/tile/{LEVEL}/{COL}/{ROW}</Url>


For MapInfo you also need to create a .tab file that points at the XML file. Content of the tab file should be:

!table
!version 1050
!charset WindowsLatin1
Definition Table
  File "NSWMap.xml"
  Type "TILESERVER"
  CoordSys Earth Projection 10, 157, "m", 0 Bounds (-20037508.343,-20037508.343) (20037508.343,20037508.343)


Replace the 'File' entry to the filename of the XML.

Opening the .tab file in MapInfo will access the service as a Tiled Map Service.