04.02.2013 Views

MapInfo Spatial Server Map Tiling Service - Product Documentation ...

MapInfo Spatial Server Map Tiling Service - Product Documentation ...

MapInfo Spatial Server Map Tiling Service - Product Documentation ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong><br />

Version 1.0<br />

<strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> Guide


Information in this document is subject to change without notice and does not represent a commitment on the<br />

part of the vendor or its representatives. No part of this document may be reproduced or transmitted in any<br />

form or by any means, electronic or mechanical, including photocopying, without the written permission of Pitney<br />

Bowes Software Inc., One Global View, Troy, New York 12180-8399.<br />

© 2012 Pitney Bowes Software Inc. All rights reserved. Pitney Bowes Software Inc. is a wholly-owned subsidiary<br />

of Pitney Bowes Inc. Pitney Bowes, the Corporate logo, <strong><strong>Map</strong>Info</strong>, Group 1 Software, and <strong><strong>Map</strong>Info</strong> Professional<br />

are [registered] trademarks of Pitney Bowes Inc. or a subsidiary. All other trademarks are the property of their<br />

respective owners.<br />

United States:<br />

Phone: 518.285.6000<br />

Fax: 518.285.6070<br />

Sales: 800.327.8627<br />

Government Sales: 800.619.2333<br />

Technical Support: 518.285.7283<br />

Technical Support Fax: 518.285.7575<br />

www.pb.com/software<br />

Canada:<br />

Phone: 416.594.5200<br />

Fax: 416.594.5201<br />

Sales: 800.268.3282<br />

Technical Support:.518.285.7283<br />

Technical Support Fax: 518.285.7575<br />

www.pb.com/software<br />

Europe/United Kingdom:<br />

Phone: +44.1753.848.200<br />

Fax: +44.1753.621.140<br />

Technical Support: +44.1753.848.229<br />

www.pitneybowes.co.uk/software<br />

Asia Pacific/Australia:<br />

Phone: +61.2.9437.6255<br />

Fax: +61.2.9439.1773<br />

Technical Support: 1.800.648.899<br />

www.pitneybowes.com.au/software<br />

Contact information for all Pitney Bowes offices is located at: www.pb.com/contact-us.<br />

<strong>Product</strong>s named herein may be trademarks of their respective manufacturers and are hereby recognized.<br />

Trademarked names are used editorially, to the benefit of the trademark owner, with no intent to infringe on<br />

the trademark.<br />

30 / 04 / 2012


Contents<br />

Chapter 1: Introduction..............................................................................................5<br />

About the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong>.............................................................................................6<br />

Supported Data................................................................................................................6<br />

Named <strong>Map</strong> Modifications...............................................................................................6<br />

Chapter 2: Managing <strong>Map</strong> <strong>Tiling</strong> Resources and Configuration............................7<br />

Accessing and Modifying the Configuration File.............................................................8<br />

Global Configuration Parameters.....................................................................................8<br />

Uploading and Accessing Resources in the Repository................................................11<br />

Reload the <strong>Service</strong> Configuration using JMX Console..................................................13<br />

Adding and Modifying Named Tiles.................................................................................14<br />

Defining Named Tiles.....................................................................................................14<br />

Chapter 3: <strong>Map</strong> <strong>Tiling</strong> REST Interface.....................................................................19<br />

What Is the <strong>Map</strong> <strong>Tiling</strong> REST Interface?..........................................................................20<br />

REST URL...........................................................................................................................20<br />

Methods..............................................................................................................................20<br />

<strong>Map</strong>List...........................................................................................................................20<br />

Description.....................................................................................................................21<br />

Tile..................................................................................................................................22<br />

Objects...............................................................................................................................24<br />

<strong>Map</strong>Description..............................................................................................................24<br />

Chapter 4: Legacy <strong>Map</strong> <strong>Tiling</strong> Interface..................................................................27<br />

What Is the Legacy <strong>Map</strong> <strong>Tiling</strong> Interface?.......................................................................28<br />

URL.....................................................................................................................................28<br />

Methods..............................................................................................................................28<br />

get<strong>Map</strong>s.........................................................................................................................28


4<br />

getDescription................................................................................................................29<br />

getLevelDescription........................................................................................................30<br />

getTile.............................................................................................................................31<br />

getTileBounds................................................................................................................33<br />

convertScreenTo<strong>Map</strong>Coord...........................................................................................34<br />

convertScreenToTileCoord.............................................................................................36<br />

convert<strong>Map</strong>ToTileCoord.................................................................................................37<br />

convert<strong>Map</strong>ToVirtualPixelCoord.....................................................................................38<br />

Objects...............................................................................................................................40<br />

<strong>Map</strong>Description..............................................................................................................40<br />

LevelDescription.............................................................................................................42<br />

<strong>Map</strong>Coordinate...............................................................................................................43<br />

TileCoordinate................................................................................................................43<br />

VirtualPixelCoordinate....................................................................................................44<br />

Appendix A: Common Data Types..........................................................................45<br />

Request URL Data Types..................................................................................................46<br />

Response JSON Data Types.............................................................................................47<br />

Primitive Types...............................................................................................................47<br />

Object Types..................................................................................................................47<br />

Appendix B: Errors...................................................................................................49<br />

Handling Errors.................................................................................................................50<br />

Error Object........................................................................................................................50<br />

Error Codes........................................................................................................................50<br />

Appendix C: How Pixels, Tiles, and <strong>Map</strong> Coordinates are Transformed.............53<br />

Transforming a Pixel to a <strong>Map</strong> Coordinate.....................................................................54<br />

Transforming a Pixel to a Tile Coordinate.......................................................................54<br />

Transforming a <strong>Map</strong> Coordinate to a Tile Coordinate....................................................55<br />

<strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> 1.0


Introduction<br />

The <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> generates map tiles that can be combined to form larger<br />

map images. These tiles can be cached by your own enterprise caching solution<br />

to reduce the waiting times as users view, pan, and zoom maps.<br />

This guide provides information on how to configure the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong>, create<br />

named tiles, and how to use the service's accompanying interfaces to access the<br />

service from within your web applications.<br />

In this section:<br />

• About the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> . . . . . . . . . . . . . . . . . . . . . . . .6<br />

1


About the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong><br />

About the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong><br />

The <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> dynamically generates subsets of a map on a per-request basis. This subset is<br />

called a tile. The tiles generated from the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> can be used individually, or combined to<br />

form larger maps, in applications for seamless map interaction. This service provides fast, simple, lightweight<br />

map rendering where more complex map rendering can be performed using the Presentation<br />

<strong>Service</strong>.<br />

The <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> allows the hosting of multiple maps that can be used to generate the tiles. These<br />

named maps are located in one or more map repositories. Each map hosted by the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong><br />

can have a specific configuration that defines how the map will be used to create tiles.<br />

The <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> has two interfaces. Both are web based HTTP interfaces, however, one is a<br />

REST interface, and the other is a name/value pair interface:<br />

• REST - Referred to as the <strong>Map</strong> <strong>Tiling</strong> REST interface, this API is a simplified web interface that has<br />

methods for getting the name of maps, describing maps, and getting tiles. For details of this REST<br />

interface, see <strong>Map</strong> <strong>Tiling</strong> REST Interface on page 19 for more information.<br />

• Name/Value - Referred to as the Legacy <strong>Map</strong> <strong>Tiling</strong> interface, this API provides more complex methods<br />

that include the REST methods as well as methods for getting the bounds of maps, level descriptions<br />

tile sets, and numerous conversion methods between pixel, tile, and screen coordinates.<br />

Note:<br />

This is a legacy interface, and should only be used to support PBBI backwards compatable<br />

applications. For all new applications, use the REST interface.<br />

For details of this interface, see Legacy <strong>Map</strong> <strong>Tiling</strong> Interface on page 27 for more information.<br />

Supported Data<br />

Both vector and raster data can be hosted by the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong>.<br />

Named <strong>Map</strong> Modifications<br />

6<br />

The <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> is designed to host your maps without modification. However, due to the dynamic<br />

nature of tile generation, the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> does make minor modifications to the map after it is<br />

loaded into the server. These changes relate to the rendering of labels, and are as follows:<br />

• Duplication of labels is not allowed.<br />

• Geometry calculation mode is set to STATIC.<br />

• Partial labels are allowed.<br />

A special category of layers relate to the display of highway shields. To allow the accurate display of<br />

highway shield layers the following label properties are set:<br />

• Duplication of labels is allowed.<br />

• Geometry calculation mode is set to STATIC.<br />

• Partial labels are allowed.<br />

These modifications are stored in the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> memory and in no way change the source of<br />

the maps hosted by the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> stored in the repository.<br />

<strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> 1.0


Managing <strong>Map</strong> <strong>Tiling</strong><br />

Resources and<br />

Configuration<br />

This section describes how to configure and add resources to the <strong>Map</strong> <strong>Tiling</strong><br />

<strong>Service</strong>. The <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> is installed and pre-configured with the configuration<br />

file (named configuration) located in the repository. The <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong><br />

uses the standard XML service configuration similar to the other <strong><strong>Map</strong>Info</strong> <strong>Spatial</strong><br />

<strong>Server</strong> services.<br />

The named <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> configuration file <strong>Map</strong><strong>Tiling</strong>Configuration<br />

is located in the Configuration directory under the root repository. For example,<br />

a default installation will place the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> configuration file at http://localhost:8080/Repository<strong>Service</strong>/repository/default/Configuration/<strong>Map</strong><strong>Tiling</strong>Configuration<br />

You can use your standard WebDAV protocol tools (e.g., Windows WebFolders,<br />

DAVExplorer, etc.) to copy the configuration file from the repository, and then<br />

upload the modified configuration file back. Once uploaded, you must use the<br />

<strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> JMX Console to invoke the new configuration for the<br />

service.<br />

Note:<br />

You must be on the local machine hosting <strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> to access<br />

and make changes to resources in the repository.<br />

In this section:<br />

• Accessing and Modifying the Configuration File . . . . . . .8<br />

• Adding and Modifying Named Tiles . . . . . . . . . . . . . . . . .14<br />

2


Accessing and Modifying the Configuration File<br />

Accessing and Modifying the Configuration File<br />

The named <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> configuration file <strong>Map</strong><strong>Tiling</strong>Configurationis located in the Configuration<br />

directory under the root repository. For example, a default installation will place the <strong>Map</strong> <strong>Tiling</strong><br />

<strong>Service</strong> configuration file at http://localhost:8080/Repository<strong>Service</strong>/repository/default/Configuration/<strong>Map</strong>-<br />

<strong>Tiling</strong>Configuration<br />

To configure the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong>, perform the following:<br />

1. You must be located on the local machine hosting <strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> and the repository.<br />

2. Use a standard WebDAV protocol tool to access the repository (e.g., Windows WebFolders, DAVExplorer,<br />

etc.) and copy the configuration file from the repository to a directory on your local machine.<br />

The <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> configuration file is located at http://localhost:8080/Repository<strong>Service</strong>/repository/default/Configuration/<strong>Map</strong><strong>Tiling</strong>Configuration<br />

For examples of using standard WebDAV tools, see Accessing the Repository using WebDAV<br />

3. Make changes to the local <strong>Map</strong><strong>Tiling</strong>Configuration file. For parameter descriptions for the configuration<br />

file, see Global Configuration Parameters on page 8.<br />

4. Upload the modified configuration file back to the same location (and name) in the repository using<br />

your WebDAV tool.<br />

5. Use the <strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> JMX Console to invoke the new configuration for the service. For<br />

instruction on how to reload the configuration using the JMX Console, see Reload the <strong>Service</strong><br />

Configuration using JMX Console on page 13<br />

Global Configuration Parameters<br />

8<br />

The <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> configuration consists of a set of global parameters that define how tiles are<br />

generated. These parameters are used if optional parameters defined in the named tiles are not specified.<br />

If a named tile has defined these parameters, then the parameters in the global configuration will be<br />

overwritten.<br />

The following are global configuration paramters:<br />

Parameter<br />

RepositoryURL<br />

ExpirationDate<br />

Type<br />

string<br />

string<br />

Required<br />

yes<br />

no<br />

Description<br />

The URL defines the location of your local repository<br />

where resource are stored that are accessed<br />

by the <strong>Map</strong> <strong>Tiling</strong> service. This URL should point<br />

to the Repository <strong>Service</strong> rmi, for example: http://localhost:8080/Repository<strong>Service</strong>/rmi<br />

Note:<br />

In most instances, this URL should not be<br />

changed.<br />

The date on which the client should delete the map<br />

tile from the cache, and request a new copy from<br />

the server. The ExpirationDate value must be<br />

specified as a W3C formatted date string (for example,<br />

2013-12-31).<br />

<strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> 1.0


Parameter<br />

MimeList<br />

<strong>Map</strong>Resolution<br />

<strong>Map</strong>Rendering<br />

RenderLabels<br />

PadFactor<br />

Type<br />

string<br />

integer<br />

string<br />

boolean<br />

integer<br />

Required<br />

no<br />

no<br />

no<br />

no<br />

no<br />

Description<br />

Note:<br />

The ExpirationDate parameter has effect<br />

only when using external caching software<br />

such as Squid or Apache.<br />

The available types of tiles generated by the tile<br />

server for named tiles when the MimeList is not<br />

specified.<br />

The resolution of the tile images in dots per inch<br />

(the number of individual dots that can be placed<br />

within the span of one linear inch). The minimum<br />

dpi you can define is 72, anything less would render<br />

a poor quality image. If a value less than 72 is<br />

defined, the service will throw an exception.<br />

The rendering quality (anti-alias) of the tile images<br />

generated. You can specify either Speed or Quality.<br />

If <strong>Map</strong>Rendering is not specified in either the<br />

global configuration or in a named tile, the default<br />

rendering quality is Speed.<br />

Tells the service not to render LabelLayers when<br />

generating a tile. The value is case-insensitive. If<br />

RenderLabels is not specified in either the global<br />

configuration or in a named tile, the default is 'true'.<br />

Used to prevent the clipping of labels when a label<br />

crosses a tile boundary. The PadFactor controls<br />

the amount of space is rendered around the requested<br />

tile with 0 meaning no padding, 1 meaning<br />

padding of 1 tile around the requested tile and so<br />

on. If PadFactor is not specified in either the<br />

global configuration or in a named tile, the default<br />

is 1.0.<br />

Internally, the <strong>Map</strong> <strong>Tiling</strong> service draws tiles to an offscreen bitmap (OSBM) (e.g., BufferedImage). To<br />

help speed up rendering of tiles by reducing garbage collection pauses, pools of offscreen bitmaps may<br />

be used to avoid constantly creating new ones. The OSBMPooling configuration controls how the offscreen<br />

bitmaps are created in memory.<br />

Note:<br />

If the OSBM pooling section of the configuration is removed, then pooling will not be enabled.<br />

The following are OSBM configuration paramters:<br />

Parameter<br />

MaxActive<br />

<strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> Guide<br />

Type<br />

integer<br />

Chapter 2: Managing <strong>Map</strong> <strong>Tiling</strong> Resources and Configuration<br />

Required<br />

no<br />

Description<br />

Controls the maximum number of offscreen bitmaps<br />

(per tile dimension) that can be allocated by the<br />

pool (checked out to client threads, or idle in the<br />

pool) at one time. When non-positive, there is no<br />

limit to the number of objects per key. When this<br />

value is reached, the keyed pool is said to be ex-<br />

9


Global Configuration Parameters<br />

10<br />

Parameter<br />

MinIdle<br />

MaxIdle<br />

MaxTotal<br />

ExhaustedAction<br />

Type<br />

integer<br />

integer<br />

integer<br />

string<br />

Required<br />

no<br />

no<br />

no<br />

no<br />

Description<br />

hausted. The default setting for this parameter is<br />

8.<br />

The minimum number of idle offscreen bitmaps<br />

(per tile dimension) that should always be available.<br />

If this parameter is set to a positive number and<br />

TimeBetweenEvictionRunsMills is greater<br />

than zero, each time the idle object eviction thread<br />

runs, it will try to create enough idle instances so<br />

that there will be this number of idle instances<br />

available under each key. The default setting for<br />

this parameter is 0.<br />

The maximum number of offscreen bitmap that can<br />

sit idle in the pool (per tile dimension) at any time.<br />

When negative, there is no limit to the number of<br />

objects that may be idle per key. The default setting<br />

for this parameter is 8.<br />

The global limit on the number of objects that can<br />

be in circulation (active or idle) within the combined<br />

set of pools. When non-positive, there is no limit to<br />

the total number of objects in circulation. When<br />

MaxTotal is exceeded, all keyed pools are exhausted.<br />

When MaxTotal is set to a positive value<br />

and an offscreen bitmap is requested when at the<br />

limit with no idle instances available, an attempt is<br />

made to create room by clearing the oldest fifteen<br />

percent (15%) of the elements from the keyed<br />

pools. The default setting for this parameter is -1<br />

(no limit).<br />

The behavior when the pool of offscreen bitmaps<br />

is exhausted. The options are fail, grow, or block.<br />

Fail will throw an exception when an offscreen bitmap<br />

is requested when the pool is exhausted.<br />

Grow, the default, will create a new offscreen bitmap<br />

and return it, making MaxActive meaningless.<br />

Block will stop the process until a new or idle<br />

object is available.<br />

Optionally, one may configure the pool to examine<br />

and possibly evict objects as they sit idle in the pool<br />

and to ensure that a minimum number of idle objects<br />

is maintained for each key. This is performed<br />

by an idle object eviction thread, which runs asynchronously.<br />

Caution should be used when configuring<br />

this optional feature.<br />

Eviction runs require an exclusive synchronization<br />

lock on the pool. If they run too frequently or incur<br />

excessive latency when creating, destroying or<br />

validating object instances, performance issues<br />

<strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> 1.0


Parameter<br />

MinEvictableIdle-<br />

TimeMills<br />

TimeBetweenEvictionRunsMills<br />

Type<br />

integer<br />

integer<br />

Required<br />

no<br />

no<br />

Description<br />

Uploading and Accessing Resources in the Repository<br />

may result. The idle object eviction thread may be<br />

configured using the MinEvictableIdleTime-<br />

Mills and TimeBetweenEvictionRunsMills<br />

parameters.<br />

The minimum amount of time that an offscreen<br />

bitmap may sit idle in the pool before it is eligible<br />

for eviction due to idle time. When non-positive, no<br />

object will be dropped from the pool due to idle time<br />

alone. This parameter has no effect unless TimeBetweenEvictionRunsMillis<br />

is greater than<br />

zero. The default setting for this parameter is 30<br />

minutes.<br />

How long the eviction thread should sleep before<br />

examining idle offscreen bitmaps. When non-posit-<br />

ive, no eviction thread will be launched. The default<br />

setting for this parameter is -1 (i.e., by default, idle<br />

object eviction is disabled).<br />

Named resource files are stored in the repository. These files are located at http://localhost:8080/Repository<strong>Service</strong>/repository/default/<br />

under a particular folder. For example:<br />

• NamedLayers<br />

• Named<strong>Map</strong>s<br />

• NamedStyles<br />

• NamedTables<br />

• NamedTiles<br />

You can access these files using two methods: the NamedResource service or manually using a WebDAV<br />

compliant tool. This section describes the manual method. For more information on using the<br />

NamedResource service, see the NamedResource <strong>Service</strong> SOAP Reference.<br />

To access resources manually, you must use a WebDAV protocol tool to access the JCR repository.<br />

There are many tools available to upload and access resources in the repository using the WebDAV.<br />

We have provided two examples:<br />

Using WebFolders to Access the Repository Resources<br />

To add or modify a resource, you must copy the resource to or from the repository using a WebDAV<br />

tool. Using WebFolders is an easy way to access the repository and the resources contained in the repository.<br />

Note:<br />

WebFolders is for Windows machines only. To access the repository, you must be on the same<br />

machine where <strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> and the repository are installed.<br />

To configure a WebFolder:<br />

<strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> Guide<br />

Chapter 2: Managing <strong>Map</strong> <strong>Tiling</strong> Resources and Configuration<br />

11


Uploading and Accessing Resources in the Repository<br />

12<br />

1. Using the Windows file explore, for the method appropriate for your version of Windows, select <strong>Map</strong><br />

Network Drive...<br />

2. In the pop-up window, click on the link 'sign up for online storage or connect to a<br />

network server' or you may have a link that mentions'Connect to a website...'.<br />

3. Click the Next and select Choose another network location. Click Next.<br />

4. In the Internet or network addressfield add the repository URL http://localhost:8080/Repository<strong>Service</strong>/repository/default/.<br />

Click Next.<br />

5. If you are asked for cridentials, use the username and password Admin/Admin<br />

6. Give this connection a name. For example, <strong>Spatial</strong> <strong>Server</strong> Repository. Click Next.<br />

Once finished, you will have a folder connection to the contents of the repository under your network<br />

places.<br />

The WebFolder connection to the repository can be used like any other windows explorer folder, where<br />

files can be copied from the repository, modified, and copied back to the same location in the repository.<br />

Using DAVExplorer to Access the Repository Resources<br />

To add or modify a resource, you must copy the resource to or from the repository using a WebDAV<br />

tool. Using DavExplorer is an easy way to access the repository and the resources contained in the repository.<br />

DAVExplorer is a freely available WebDAV client application. This software is available from<br />

http://www.davexplorer.org.<br />

Note:<br />

DavExplorer is for Windows machines only. To access the repository, you must be on the same<br />

machine where <strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> and the repository are installed.<br />

To get or add resources from the repository using DAVExplorer, use the following instructions:<br />

Getting Resources From the Repository Using DAVExplorer<br />

Use the following steps to get resources from the repository using DAV Explorer:<br />

1. Open DAVExplorer.<br />

2. In DAVExplorer, enter the URL of the <strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> repository and click the Connect button.<br />

For example, enter localhost:8080/Repository<strong>Service</strong>/repository/default/. (Note<br />

that DAVExplorer prepends http:// automatically.)<br />

If prompted, enter the admin/admin login name and password required to connect to the repository.<br />

Once you are connected to the repository, a node for the repository appears in the treeview pane<br />

on the left.<br />

3. In the treeview pane on the left, expand the nodes under the repository node until you see the node<br />

that contains the type of resource you want to get.<br />

For example, if the named resource you want to get is a configuration, expand the repository nodes<br />

until you see the Configuration node. Click on the node to select it. The named configuration resources<br />

in the repository are then listed in the right pane.<br />

4. In the right pane, click on the resource you want to get.<br />

You may click on any of the fields of the named resource to select it.<br />

5. On the File menu, select Get File.<br />

The Save As dialog box opens.<br />

<strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> 1.0


6. In the Save As dialog box, enter a name for the named resource definition file and select the directory<br />

in which you want to save it, then click the Save button.<br />

The selected named resource definition file is saved to the selected file location.<br />

Note:<br />

You should always save the resource as the same name as it appears in the repository. By<br />

using this technique, you will never have a conflict when adding the resource back to the repository.<br />

Adding Resources to the Repository Using DAVExplorer<br />

Use the following steps to add resources to the repository using DAVExplorer:<br />

1. Open DAVExplorer.<br />

2. In DAVExplorer, enter the URL of the <strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> repository and click the Connect button.<br />

For example, enter localhost:8080/Repository<strong>Service</strong>/repository/default/. (Note<br />

that DAVExplorer prepends http:// automatically.)<br />

If prompted, enter the admin/admin login name and password required to connect to the repository.<br />

Once you are connected to the repository, a node for the repository appears in the treeview pane<br />

on the left.<br />

3. In the treeview pane on the left, expand the nodes under the repository node until you see the node<br />

that corresponds to the type of resource you are adding.<br />

For example, if you are adding a configuration resource, expand the repository nodes until you see<br />

the Configuration node. Click on the node to select it.<br />

4. On the File menu, select Write File.<br />

The Write File dialog box opens.<br />

5. In the Write File dialog box, select the definition file of the resource you want to add to the repository,<br />

then click the Open button.<br />

The selected resource is added to the repository.<br />

Reload the <strong>Service</strong> Configuration using JMX Console<br />

Once you have modified a service configuration, you must reload the configuration in the repository using<br />

the JMX Console. The JMX console allows you to reload and administer a service, without having to<br />

restart the application container.<br />

To reload the service configuration:<br />

1. Access the JMX Console using the following URL: http://localhost:8080/jmx-console/<br />

2. Under the Domain: Enterprise<strong>Map</strong>ping section, select the administration link for the service.<br />

For example, Enterprise<strong>Map</strong>ping:name=Administration,type=WMS <strong>Service</strong>.<br />

3. Click the Invoke button for the reloadConfiguration operation.<br />

You will get a message on the status of the invocation.<br />

<strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> Guide<br />

Chapter 2: Managing <strong>Map</strong> <strong>Tiling</strong> Resources and Configuration<br />

13


Adding and Modifying Named Tiles<br />

Adding and Modifying Named Tiles<br />

The <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> uses named tiles to render maps. The named tiles are stored in the repository<br />

located in the NamedTiles directory under the root repository. For example, a default installation will<br />

place the named tile definition files at http://localhost:8080/Repository<strong>Service</strong>/repository/default/NamedTiles<br />

To add or modify named tiles in the repository, perform the following:<br />

1. You must be located on the local machine hosting <strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> and the repository.<br />

2. Use a standard WebDAV protocol tool to access the repository (e.g., Windows WebFolders, DAVExplorer,<br />

etc.) and either add or copy the named tiles to or from the repository.<br />

For examples of using standard WebDAV tools, see Accessing the Repository using WebDAV<br />

Named tiles do not have a file extention, only a name. For a description of the parameters to define<br />

named tiles, see:<br />

Defining Named Tiles<br />

14<br />

Named tiles are stored in the repository, and define how an individual hosted named map is used by the<br />

<strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong>. For each map you want to expose through the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> you must have<br />

an equivalent named tile. In the named tile file, the NamedTile element contains the parameters that<br />

define the named tile, each of which contains some or all of the following list of child elements:<br />

Parameter<br />

DisplayName<br />

Description<br />

ResourceLocation<br />

Projection<br />

Type<br />

string<br />

string<br />

string<br />

string<br />

Required<br />

yes<br />

yes<br />

yes<br />

yes<br />

Description<br />

The alias of the named map stored in the map repository.<br />

This alias can be different than the actual<br />

name of the named map, and will be used in the<br />

tiling service requests to call the named tile.<br />

The metadata description of the named map. This<br />

information is presented to the user when a getDescription<br />

call is sent to the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong>.<br />

The directory and name of the actual named map<br />

in the repository, from the repository base. For ex-<br />

ample, if the named map is located at http://localhost:8080/Repository<strong>Service</strong>/repository/default/Named<strong>Map</strong>s/World,<br />

then you would define<br />

the ResourceLocation as /Named<strong>Map</strong>s/World.<br />

Note:<br />

You must specify the starting '/'<br />

The coordinate system projection to host the named<br />

map. The <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> will transform the<br />

named map into the projection defined. The projection<br />

is defined using the EPSG format.<br />

<strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> 1.0


Parameter<br />

MinimumLevel<br />

MaximumLevel<br />

TileWidth<br />

Bounds<br />

MimeList<br />

ExpirationDate<br />

<strong>Map</strong>Resolution<br />

<strong>Map</strong>Rendering<br />

RenderLabels<br />

PadFactor<br />

<strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> Guide<br />

Type<br />

integer<br />

integer<br />

integer<br />

string<br />

string<br />

string<br />

integer<br />

string<br />

boolean<br />

integer<br />

Chapter 2: Managing <strong>Map</strong> <strong>Tiling</strong> Resources and Configuration<br />

Required<br />

yes<br />

yes<br />

yes<br />

yes<br />

no<br />

no<br />

no<br />

no<br />

no<br />

no<br />

Description<br />

The minimum zoom level to host the map. Must be<br />

greater than zero. See What Is Level? on page<br />

16 for information to help define the level.<br />

The maximum zoom level to host the map. Must<br />

be greater than zero. See What Is Level? on page<br />

16 for information to help define the level.<br />

Width of a tile in pixels. Must be greater than or<br />

equal to 16 and must be a number that can be<br />

calculated from a 2 n equation (for example 2 4 =16,<br />

2 5 =32, 2 8 =256).<br />

The bounds of the map. Coordinates are comma<br />

separated and in the coordinate system specified<br />

by the projection option.<br />

The available types of tiles generated by the tile<br />

server for this map only.<br />

The date on which the client should delete the map<br />

tile from the cache, and request a new copy from<br />

the server. The ExpirationDate value must be<br />

specified as a W3C formatted date string.<br />

Note:<br />

The ExpirationDate parameter has effect<br />

only when using external caching software<br />

such as Squid or Apache.<br />

The resolution of the tile images in dots per inch<br />

(the number of individual dots that can be placed<br />

within the span of one linear inch). If not specified,<br />

the Global<strong>Map</strong>Resolution is used. The minimum<br />

dpi you can define is 72, anything less would render<br />

a poor quality image. If a value less than 72 is<br />

defined, the service will throw an exception.<br />

The rendering quality (anti-alias) of the tile images<br />

generated. You can specify either Speed or Quality.<br />

If a <strong>Map</strong>Rendering preference is not specified,<br />

the global preference in the configuration will be<br />

used to determine the maps rendering quality. If<br />

neither is specified, the default rendering quality is<br />

Speed.<br />

Tells the service not to render LabelLayers when<br />

generating a tile. The value is case-insensitive. If<br />

a RenderLabels preference is not specified, the<br />

global preference in the configuration will be used.<br />

If neither is specified, the default is 'true'.<br />

Used to prevent the clipping of labels when a label<br />

crosses a tile boundary. The PadFactor controls<br />

the amount of space is rendered around the reques-<br />

15


Defining Named Tiles<br />

16<br />

Parameter<br />

Type<br />

Required<br />

The following is an example named tile definition:<br />

Description<br />

ted tile with 0 meaning no padding, 1 meaning<br />

padding of 1 tile around the requested tile and so<br />

on. If a PadFactor preference is not specified, the<br />

global preference in the configuration will be used.<br />

If neither is specified, the default is 1.0.<br />

<br />

World<br />

<strong>Map</strong> Of The World<br />

/Named<strong>Map</strong>s/World<strong>Map</strong><br />

epsg:3857<br />

1<br />

20<br />

256<br />

-20037508.34,-20037508.34,20037508.34,20037508.34<br />

<br />

image/png<br />

image/jpeg<br />

image/gif<br />

<br />

2019-12-31<br />

96<br />

Speed<br />

false<br />

1.0<br />

<br />

What Is Level?<br />

The level, in combination with the tile width, tile height, and bounds of the named map, determines the<br />

zoom level of the tiles to be returned. The level shows how close the map image is to the Earth. Level<br />

1 is the furthest away and is composed of one tile that the entire map will be drawn into. Level 2 is<br />

composed of 4 tiles, 2 across and 2 down. Each tile is a quarter of the entire map. Level 3 is composed<br />

of 16 tiles, 4 across and 4 down, and so on. The higher the level specified, the closer to the Earth the<br />

map image appears. For example, levels 1 to 3 usually show global or hemispheric detail, levels 4 to 15<br />

show county/state/province level of detail and some larger cities, levels greater that 15 show street level<br />

views.<br />

What the levels actually display is dependant on the named map hosted by the <strong>Map</strong> Tile <strong>Service</strong>. For<br />

example, a level of 1 for a world map would be zoomed out to show the entire world. However, if you<br />

have a named map of only a city (for example, New York, Toronto, or London), a level of 1 would be<br />

zoomed out to show a street level map.<br />

How Tile Height Is Calculated<br />

The tile height is calculated from the map bounds and the tile width to produce a tile that has the same<br />

aspect ratio as the bounds.<br />

The tile height is calculated using the following equation:<br />

tileHeight = (boundsHeight ÷ boundsWidth) × tileWidth<br />

<strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> 1.0


There is one restriction when defining a map: the resultant tile height must be a whole number (integer).<br />

Since tile height and tile width are calculated in pixels, it is impossible for a user to display these values<br />

as fractions of a pixel.<br />

For example, a map with a bounds of (-180, -90, 180, 90) in WGS84 has an aspect ratio (width to height)<br />

of 2:1. So the tileHeight calculation is half the tileWidth. If you defined the tileWidth parameter<br />

to be 256 then the tileHeight would be 128. This is an acceptable tileHeight value. However, if<br />

you have defined a map with the bounds of (-180, -90, 90, 0) in WGS84, that would create an aspect<br />

ratio of 3:1. Calculating the tileHeight based on a tileWidth of 256 would result in a tileHeight<br />

of 85.3333333. This is not an acceptable tileHeight value, and will not be displayed by the <strong>Map</strong> <strong>Tiling</strong><br />

<strong>Service</strong>. If a map hosted by the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> is configured with tileWidth and bounds parameter<br />

settings that result in an invalid tileHeight calculation, then the map will not appear in the list of<br />

available maps returned by a call to the get<strong>Map</strong>s method in the <strong>Map</strong> <strong>Tiling</strong> Interface.<br />

<strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> Guide<br />

Chapter 2: Managing <strong>Map</strong> <strong>Tiling</strong> Resources and Configuration<br />

17


<strong>Map</strong> <strong>Tiling</strong> REST Interface<br />

This chapter describes the <strong>Map</strong> <strong>Tiling</strong> REST Interface for the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong>.<br />

You can use this interface in your application code to access the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong>.<br />

In this section:<br />

• What Is the <strong>Map</strong> <strong>Tiling</strong> REST Interface? . . . . . . . . . . . . . .20<br />

• REST URL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20<br />

• Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20<br />

• Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24<br />

3


What Is the <strong>Map</strong> <strong>Tiling</strong> REST Interface?<br />

What Is the <strong>Map</strong> <strong>Tiling</strong> REST Interface?<br />

The <strong>Map</strong> <strong>Tiling</strong> REST Interface is a web RESTfull interface for quickly accessing the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong><br />

from within your web applications. The <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> generates tiles that can be combined to form<br />

larger map images. These tiles can be cached by the service or by other web caching solutions to reduce<br />

the waiting times as users view, pan, and zoom Envinsa maps.<br />

The <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> provides functionality for clients to determine the maps that are available, the<br />

ability to query the metadata of each map, and return a map comprised of tiles.<br />

REST URL<br />

The URL of a REST <strong>Map</strong> <strong>Tiling</strong> Interface request has the following form:<br />

http://host[:port]/rest/Enterprise<strong>Map</strong>ping/<strong>Map</strong><strong>Tiling</strong><strong>Service</strong>/paramValue1/paramValue2/methodName.json<br />

Methods<br />

<strong>Map</strong>List<br />

20<br />

This section describes the methods that are available in the <strong>Map</strong> <strong>Tiling</strong> REST Interface.<br />

Description<br />

Returns the list of available named tiles for the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong>. Only the tiles listed in the response<br />

can have tiles generated.<br />

Note:<br />

Before sending any requests to the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong>, it is good practice to send a <strong>Map</strong>List<br />

request to determine the available tiles of the service.<br />

HTTP GET URL Format<br />

The following format is used for HTTP GET requests:<br />

HTTP GET /mapList.json<br />

Parameters<br />

The mapList method does not have any input parameters. You only need to specify mapList.json as the<br />

REST parameter.<br />

<strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> 1.0


Example<br />

http://localhost:8080/rest/Enterprise<strong>Map</strong>ping/<strong>Map</strong><strong>Tiling</strong><strong>Service</strong>/mapList.json<br />

The following example shows the format of the JSON object returned in the response:<br />

{"Response":["/NamedTiles/WorldTile","/NamedTiles/UKCountriesTile"]}<br />

Returns<br />

An array of String values returned in a JSON response object. This is the list of available named maps<br />

for the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong>.<br />

Description<br />

Description<br />

Returns the metadata of a specified named tile for the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong>.<br />

HTTP GET URL Format<br />

The following format is used for HTTP GET requests:<br />

HTTP GET /{mapname}/description.json<br />

Parameters<br />

For information on the parameter types listed below, see Request URL Data Types on page 46.<br />

Parameter<br />

mapname<br />

Example<br />

Type<br />

String<br />

Required<br />

yes<br />

Description<br />

The name of the named tile to return the metadata<br />

for. You must specify the path inside the repository<br />

where the named tile is located.<br />

http://localhost:8080/rest/Enterprise<strong>Map</strong>ping/<strong>Map</strong><strong>Tiling</strong><strong>Service</strong>/NamedTiles/WorldTile/description.json<br />

The following example shows the format of the JSON object returned in the response:<br />

{"Response":{"numberOfLevels":20,"coordSys":"epsg:41001","description":"<strong>Map</strong><br />

Of The World","mapName":"World","tileWidth":256,"tile-<br />

Height":256,"bounds":{"maxX":2.0E7,"maxY":2.0E7,"minX":-2.0E7,"minY":-<br />

2.0E7},"outputTypes":["image/png","image/jpeg","image/gif"],"mapResolution":110,"mapRendering":"SPEED"}}<br />

<strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> Guide<br />

Chapter 3: <strong>Map</strong> <strong>Tiling</strong> REST Interface<br />

21


Tile<br />

Tile<br />

22<br />

Returns<br />

A <strong>Map</strong>Description object. See <strong>Map</strong>Description on page 24.<br />

Description<br />

Returns generated map tiles from the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> based on the input parameters specified.<br />

HTTP GET URL Format<br />

The following format is used for HTTP GET requests:<br />

HTTP GET /{mapname}/{level}/{x}:{y}/tile.{image type}<br />

Parameters<br />

For information on the parameter types listed below, see Request URL Data Types on page 46.<br />

Parameter<br />

mapname<br />

level<br />

Type<br />

String<br />

Integer<br />

Required<br />

yes<br />

yes<br />

Description<br />

The name of the named tile to generate the tile<br />

from. You must specify the location inside the repository<br />

where the named tile is located.<br />

Determines the zoom level of the tile to be returned.<br />

The level shows how close the map image is to the<br />

Earth. Level 1 is the furthest away and is composed<br />

of one tile that the entire map will be drawn into.<br />

Level 2 is composed of 4 tiles, 2 across and 2<br />

down. Each tile is a quarter of the entire map. Level<br />

3 is composed of 16 tiles, 4 across and 4 down,<br />

and so on. The higher the level specified, the closer<br />

to the Earth the map image appears. For example,<br />

levels 1 to 3 usually show global or hemispheric<br />

detail, levels 4 to 15 show county/state/province<br />

level of detail and some larger cities, levels greater<br />

that 15 show street level views.<br />

What the levels actually display is dependant on<br />

the named map published to the <strong>Map</strong> Tile <strong>Service</strong>.<br />

For example, if you published a map of New York,<br />

Toronto, or London then level 1 would be a street<br />

level map of Toronto while high levels would be<br />

more detailed.<br />

This parameter must be set to a value greater than<br />

or equal to the minLevel value and less than or<br />

equal to the maxLevel value for the named map.<br />

<strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> 1.0


Parameter<br />

x<br />

y<br />

.{image type}<br />

Returns<br />

A map image.<br />

Type<br />

Integer<br />

Integer<br />

Image Mime<br />

Required<br />

yes<br />

yes<br />

yes<br />

Description<br />

A JSON error will be returned if one of the following conditions are met:<br />

• The mapname parameter is not specified.<br />

Specifies the column of the tile, based on the<br />

level parameter specified.<br />

• The name specified is not an available named map on the <strong>Tiling</strong> <strong>Service</strong>.<br />

Specifies the row of the tile, based on the level<br />

parameter specified.<br />

Specifies the response image format. Must be png,<br />

gif, or jpeg.<br />

• The level parameter is less than the minlevel defined in the metadata for the specified map.<br />

• The level parameter is greater than the maxlevel defined in the metadata for the specified map.<br />

• The x parameter is less than 1.<br />

• The x parameter is greater than what the level dictates the map can provide.<br />

• The y parameter is less than 1<br />

• The y parameter is greater than what the level dictates the map can provide.<br />

Example<br />

http://localhost:8080/rest/Enterprise<strong>Map</strong>ping/<strong>Map</strong><strong>Tiling</strong><strong>Service</strong>/NamedTiles/WorldTile/2/1:1/tile.png<br />

The following example shows the image output returned in the response:<br />

<strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> Guide<br />

Chapter 3: <strong>Map</strong> <strong>Tiling</strong> REST Interface<br />

23


Objects<br />

Objects<br />

This section describes the JSON objects that are returned in the response to a <strong>Map</strong> <strong>Tiling</strong> REST Interface<br />

request.<br />

<strong>Map</strong>Description<br />

24<br />

A <strong>Map</strong>Description object defines the metadata for a named map.<br />

Fields<br />

A <strong>Map</strong>Description object contains the following fields:<br />

Field Name<br />

numberOfLevels<br />

Type<br />

Integer<br />

Description<br />

The maximum number of levels (zoom in) that you<br />

can request for the map. Level 1 is the furthest<br />

away and is composed of one tile that the entire<br />

map will be drawn into. Level 2 is composed of 4<br />

tiles, 2 across and 2 down. Each tile is a quarter of<br />

the entire map. Level 3 is composed of 16 tiles, 4<br />

across and 4 down, and so on. The higher the level<br />

<strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> 1.0


Field Name<br />

coordSys<br />

description<br />

name<br />

tileWidth<br />

tileHeight<br />

bounds<br />

outputTypes<br />

Example<br />

{<br />

}<br />

Type<br />

CoordSys<br />

String<br />

String<br />

Integer<br />

Integer<br />

Bounds object<br />

Array of Strings<br />

"numberOfLevels": 20,<br />

"coordSys": "epsg:41001",<br />

"description": "<strong>Map</strong> of the World",<br />

"name": "World",<br />

"tileWidth": 256,<br />

"tileHeight": 256,<br />

"bounds":{<br />

"minX": -3.756380109844111E7,<br />

"minY": -4.497601034176671E7,<br />

"maxX": 3.773376466605809E7<br />

"maxY": 4.49763662218225E7,<br />

},<br />

"outputTypes":<br />

[<br />

"png"<br />

"jpeg"<br />

"gif"<br />

]<br />

<strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> Guide<br />

Description<br />

Chapter 3: <strong>Map</strong> <strong>Tiling</strong> REST Interface<br />

specified, the closer to the Earth the map image<br />

appears (zoom in).<br />

The coordinate system of the projection defining<br />

the map tiles.<br />

A textural description of the named map.<br />

The name of the named map.<br />

The width of the tiles in pixels.<br />

The height of the tiles in pixels.<br />

The geographical extent of the map's bounding box<br />

in the map's projection as specified by the coord-<br />

Sys field. See Bounds on page 48.<br />

The list of supported tile image formats that can be<br />

rendered for the map.<br />

25


Legacy <strong>Map</strong> <strong>Tiling</strong> Interface<br />

This chapter describes the Legacy <strong>Map</strong> <strong>Tiling</strong> Interface for the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong>.<br />

You can use this interface in your application code to access the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong>.<br />

In this section:<br />

• What Is the Legacy <strong>Map</strong> <strong>Tiling</strong> Interface? . . . . . . . . . . . .28<br />

• URL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28<br />

• Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28<br />

• Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .40<br />

4


What Is the Legacy <strong>Map</strong> <strong>Tiling</strong> Interface?<br />

What Is the Legacy <strong>Map</strong> <strong>Tiling</strong> Interface?<br />

The Legacy <strong>Map</strong> <strong>Tiling</strong> Interface is a programming interface for accessing the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> from<br />

within your web applications.<br />

Note:<br />

URL<br />

The Legacy <strong>Map</strong> <strong>Tiling</strong> interface is for backwards compatability only. This interface should not<br />

be used to create new application using map tiling.<br />

The URL of a <strong>Map</strong> <strong>Tiling</strong> Interface request has the following form:<br />

http://host[:port]/rest/Enterprise<strong>Map</strong>ping/Legacy<strong>Map</strong><strong>Tiling</strong><strong>Service</strong>/methodName?paramName=paramValue<br />

Methods<br />

get<strong>Map</strong>s<br />

28<br />

This section describes the methods that are available in the <strong>Map</strong> <strong>Tiling</strong> Interface.<br />

Description<br />

Returns the list of available named named tiles for the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong>. Only the tiles listed in the response<br />

can have tiles generated.<br />

Note:<br />

Parameters<br />

Before sending any requests to the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong>, it is good practice to send a get<strong>Map</strong>s<br />

request to determine the available tiles of the service.<br />

For information on the parameter types listed below, see Request URL Data Types on page 46.<br />

Parameter<br />

output<br />

Returns<br />

Type<br />

String<br />

Required<br />

yes<br />

Description<br />

Specifies the response format. Must be json.<br />

An array of String values. This is the list of available named tiles for the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong>.<br />

When an array of tile name values is returned in the EnvinsaResponse JSON object, the array is always<br />

located in a JSON field named maps.<br />

<strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> 1.0


Example<br />

http://localhost:8080/rest/Enterprise<strong>Map</strong>ping/Legacy<strong>Map</strong><strong>Tiling</strong><strong>Service</strong>/get<strong>Map</strong>s?<br />

output=json<br />

The following example shows the format of the JSON object returned in the response:<br />

{<br />

}<br />

getDescription<br />

"EnvinsaResponse":<br />

{<br />

"type": "<strong>Map</strong><strong>Tiling</strong>Response",<br />

"maps":<br />

[<br />

"World",<br />

"High"<br />

]<br />

}<br />

Description<br />

Returns the metadata of a specified named tile for the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong>.<br />

Parameters<br />

For information on the parameter types listed below, see Request URL Data Types on page 46.<br />

Parameter<br />

name<br />

output<br />

Returns<br />

Type<br />

String<br />

String<br />

Required<br />

yes<br />

yes<br />

Description<br />

A <strong>Map</strong>Description object. See <strong>Map</strong>Description on page 40.<br />

Example<br />

The name of the named tile to return the metadata<br />

for. You must specify the location of the named tile<br />

in the repository.<br />

Specifies the response format. Must be json.<br />

http://localhost:8080/rest/Enterprise<strong>Map</strong>ping/Legacy<strong>Map</strong><strong>Tiling</strong><strong>Service</strong>/getDescription?<br />

name=/NamedTiles/WorldTile<br />

&output=json<br />

<strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> Guide<br />

Chapter 4: Legacy <strong>Map</strong> <strong>Tiling</strong> Interface<br />

29


getLevelDescription<br />

getLevelDescription<br />

30<br />

Description<br />

Returns the number of map tiles across (on the x axis) and the number of map tiles down (on the y axis),<br />

and the width and height in virtual pixels of the map image created in memory, for a specified map zoom<br />

level.<br />

Parameters<br />

For information on the parameter types listed below, see Request URL Data Types on page 46.<br />

Parameter<br />

name<br />

level<br />

output<br />

Returns<br />

Type<br />

String<br />

Integer<br />

String<br />

Required<br />

yes<br />

yes<br />

yes<br />

Description<br />

A LevelDescription object. See LevelDescription on page 42.<br />

Example<br />

Specifies the name of the named tile for which the<br />

level description is to be returned. You must specify<br />

the location of the named tile in the repository.<br />

Specifies the zoom level for which the description<br />

is to be returned.<br />

This parameter must be set to a value greater than<br />

or equal to the minLevel value and less than or<br />

equal to the maxLevel value for the named map.<br />

You can determine these values by calling the<br />

getDescription method and examining the returned<br />

<strong>Map</strong>Description object. For more information, see<br />

getDescription on page 29 and <strong>Map</strong>Description<br />

on page 40.<br />

Specifies the response format. Must be json.<br />

http://localhost:8080/rest/Enterprise<strong>Map</strong>ping/Legacy<strong>Map</strong><strong>Tiling</strong><strong>Service</strong>/getLevel-<br />

Description?<br />

name=/NamedTiles/WorldTile<br />

&level=4<br />

&output=json<br />

<strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> 1.0


getTile<br />

Description<br />

Returns generated map tiles from the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> based on the input parameters specified.<br />

Parameters<br />

For information on the parameter types listed below, see Request URL Data Types on page 46.<br />

Parameter<br />

name<br />

level<br />

col<br />

<strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> Guide<br />

Type<br />

String<br />

Integer<br />

Integer<br />

Required<br />

yes<br />

yes<br />

yes<br />

Description<br />

Chapter 4: Legacy <strong>Map</strong> <strong>Tiling</strong> Interface<br />

Specifies the name of the named tile from which<br />

the tile is generated. You must specify the location<br />

in the repository for the named tile.<br />

Determines the zoom level of the tile to be returned.<br />

The level shows how close the map image is to the<br />

Earth. Level 1 is the furthest away and is composed<br />

of one tile that the entire map will be drawn into.<br />

Level 2 is composed of 4 tiles, 2 across and 2<br />

down. Each tile is a quarter of the entire map. Level<br />

3 is composed of 16 tiles, 4 across and 4 down,<br />

and so on. The higher the level specified, the closer<br />

to the Earth the map image appears. For example,<br />

levels 1 to 3 usually show global or hemispheric<br />

detail, levels 4 to 15 show county/state/province<br />

level of detail and some larger cities, levels greater<br />

that 15 show street level views.<br />

What the levels actually display is dependant on<br />

the named map published to the <strong>Map</strong> Tile <strong>Service</strong>.<br />

For example, the levels demonstrated above are<br />

for Envinsa's High named map. If you published a<br />

map of New York, Toronto, or London then level 1<br />

would be a street level map of Toronto while high<br />

levels would be more detailed.<br />

This parameter must be set to a value greater than<br />

or equal to the minLevel value and less than or<br />

equal to the maxLevel value for the named map.<br />

You can determine these values by calling the<br />

getDescription method and examining the returned<br />

<strong>Map</strong>Description object. For more information, see<br />

getDescription on page 29 and <strong>Map</strong>Description<br />

on page 40.<br />

Specifies the column of the tile, based on the<br />

level parameter specified.<br />

31


getTile<br />

32<br />

Parameter<br />

row<br />

output<br />

Returns<br />

A map image.<br />

Type<br />

Integer<br />

String<br />

Required<br />

yes<br />

yes<br />

Description<br />

A JSON error will be returned if one of the following conditions are met:<br />

• The name parameter is not specified.<br />

• The name specified is not an available named map on the <strong>Tiling</strong> <strong>Service</strong>.<br />

Specifies the row of the tile, based on the level<br />

parameter specified.<br />

Specifies the response image format. Must be png,<br />

gif, or jpg.<br />

• The level parameter is less than the minlevel defined in the metadata for the specified map.<br />

• The level parameter is greater than the maxlevel defined in the metadata for the specified map.<br />

• The col parameter is less than 1.<br />

• The col parameter is greater than what the level dictates the map can provide.<br />

• The row parameter is less than 1<br />

• The row parameter is greater than what the level dictates the map can provide.<br />

Example<br />

http://localhost:8080/rest/Enterprise<strong>Map</strong>ping/Legacy<strong>Map</strong><strong>Tiling</strong><strong>Service</strong>/getTile?<br />

name=/NamedTiles/WorldTile<br />

&level=2<br />

&col=1<br />

&row=1<br />

&dpi=96<br />

&output=png<br />

The following example shows the image output returned in the response:<br />

<strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> 1.0


getTileBounds<br />

Description<br />

Returns the geographic bounds of a specified map tile. The bounds are expressed in terms of the map's<br />

coordinate system.<br />

Parameters<br />

For information on the parameter types listed below, see Request URL Data Types on page 46.<br />

Parameter<br />

name<br />

level<br />

<strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> Guide<br />

Type<br />

String<br />

Integer<br />

Required<br />

yes<br />

yes<br />

Description<br />

Chapter 4: Legacy <strong>Map</strong> <strong>Tiling</strong> Interface<br />

Specifies the name of the named tile from which<br />

the tile is generated. You must specify the location<br />

in the repository for the named tile.<br />

Specifies the zoom level of the tile whose bounds<br />

are to be returned.<br />

This parameter must be set to a value greater than<br />

or equal to the minLevel value and less than or<br />

equal to the maxLevel value for the named map.<br />

You can determine these values by calling the<br />

getDescription method and examining the returned<br />

<strong>Map</strong>Description object. For more information, see<br />

33


convertScreenTo<strong>Map</strong>Coord<br />

Parameter<br />

row<br />

col<br />

output<br />

Returns<br />

Type<br />

Integer<br />

Integer<br />

String<br />

Required<br />

yes<br />

yes<br />

yes<br />

Description<br />

getDescription on page 29 and <strong>Map</strong>Description<br />

on page 40.<br />

Specifies the grid row number of the map tile whose<br />

bounds are to be returned.<br />

Specifies the grid column number of the map tile<br />

whose bounds are to be returned.<br />

Specifies the response format. Must be json.<br />

A Bounds object located in a JSON field named tileBounds. See Bounds on page 48.<br />

Example<br />

http://localhost:8080/rest/Enterprise<strong>Map</strong>ping/Legacy<strong>Map</strong><strong>Tiling</strong><strong>Service</strong>/getTile-<br />

Bounds?<br />

name=/NamedTiles/WorldTile<br />

&level=4<br />

&row=1<br />

&col=1<br />

&output=json<br />

convertScreenTo<strong>Map</strong>Coord<br />

34<br />

Description<br />

Converts a specified set of screen pixel coordinates to coordinates in the map's coordinate system, and<br />

returns them.<br />

Parameters<br />

For information on the parameter types listed below, see Request URL Data Types on page 46.<br />

Parameter<br />

name<br />

Type<br />

String<br />

Required<br />

yes<br />

Description<br />

Specifies the name of the named map for which<br />

you are converting coordinates.<br />

<strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> 1.0


Parameter<br />

level<br />

screenX<br />

screenY<br />

view<br />

output<br />

Example<br />

Type<br />

Integer<br />

Integer<br />

Integer<br />

Bounds<br />

String<br />

Required<br />

yes<br />

yes<br />

yes<br />

yes<br />

yes<br />

Description<br />

Specifies the map zoom level.<br />

This parameter must be set to a value greater than<br />

or equal to the minLevel value and less than or<br />

equal to the maxLevel value for the named map.<br />

You can determine these values by calling the<br />

getDescription method and examining the returned<br />

<strong>Map</strong>Description object. For more information, see<br />

getDescription on page 29 and <strong>Map</strong>Description<br />

on page 40.<br />

Specifies the x coordinate value of the point in the<br />

view to be converted. This point is specified from<br />

the upper left corner of the view in pixels.<br />

Specifies the y coordinate value of the point in the<br />

view to be converted. This point is specified from<br />

the upper left corner of the view in pixels.<br />

Specifies the geographic bounds of the view that<br />

displays the map, expressed in terms of the map's<br />

coordinate system.<br />

Specifies the response format. Must be json.<br />

http://localhost:8080/rest/Enterprise<strong>Map</strong>ping/Legacy<strong>Map</strong><strong>Tiling</strong><strong>Service</strong>/convertScreenTo<strong>Map</strong>Coord?<br />

name=/NamedTiles/WorldTile<br />

&level=4<br />

&screenX=100<br />

&screenY=100<br />

&view=-20000000,20000000,20000000,-20000000<br />

&output=json<br />

The above example will return the following JSON response object:<br />

{"EnvinsaResponse":{"mapCoord":{"coordSys":"epsg:41001","point":{"x":-<br />

1.8045920859794818E7,"y":1.8045920859794818E7}},"type":"<strong>Map</strong><strong>Tiling</strong>Response"}}<br />

Returns<br />

A <strong>Map</strong>Coordinate object as seen in the above sample. See <strong>Map</strong>Coordinate on page 43.<br />

<strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> Guide<br />

Chapter 4: Legacy <strong>Map</strong> <strong>Tiling</strong> Interface<br />

35


convertScreenToTileCoord<br />

convertScreenToTileCoord<br />

36<br />

Description<br />

Returns the row and column number of the map tile in which a specified screen pixel lies.<br />

Parameters<br />

For information on the parameter types listed below, see Request URL Data Types on page 46.<br />

Parameter<br />

name<br />

level<br />

screenX<br />

screenY<br />

view<br />

output<br />

Example<br />

Type<br />

String<br />

Integer<br />

Integer<br />

Integer<br />

Bounds<br />

String<br />

Required<br />

yes<br />

yes<br />

yes<br />

yes<br />

yes<br />

yes<br />

Description<br />

Specifies the name of the named map.<br />

Specifies the map zoom level.<br />

This parameter must be set to a value greater than<br />

or equal to the minLevel value and less than or<br />

equal to the maxLevel value for the named map.<br />

You can determine these values by calling the<br />

getDescription method and examining the returned<br />

<strong>Map</strong>Description object. For more information, see<br />

getDescription on page 29 and <strong>Map</strong>Description<br />

on page 40.<br />

Specifies the x coordinate value of the point in the<br />

view used to select the tile. This point is specified<br />

from the upper left corner of the view in pixels.<br />

Specifies the y coordinate value of the point in the<br />

view used to select the tile. This point is specified<br />

from the upper left corner of the view in pixels.<br />

Specifies the geographic bounds of the view that<br />

displays the map, expressed in terms of the map's<br />

coordinate system.<br />

Specifies the response format. Must be json.<br />

http://localhost:8080/rest/Enterprise<strong>Map</strong>ping/Legacy<strong>Map</strong><strong>Tiling</strong><strong>Service</strong>/convertScreenToTileCoord?<br />

<strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> 1.0


name=/NamedTiles/WorldTile<br />

&level=4<br />

&screenX=100<br />

&screenY=100<br />

&view=-20000000,20000000,20000000,-20000000<br />

&output=json<br />

The above example will return the following JSON response object:<br />

{"EnvinsaResponse":{"tileCoord":{"column":1,"row":1},"type":"<strong>Map</strong><strong>Tiling</strong>Response"}}<br />

Returns<br />

A TileCoordinate object as seen in the above sample. See TileCoordinate on page 43.<br />

convert<strong>Map</strong>ToTileCoord<br />

Description<br />

Returns the row and column number of the map tile in which a specified set of map coordinates lies.<br />

Parameters<br />

For information on the parameter types listed below, see Request URL Data Types on page 46.<br />

Parameter<br />

worldX<br />

worldY<br />

<strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> Guide<br />

Type<br />

Float<br />

Float<br />

Required<br />

yes<br />

yes<br />

Description<br />

Chapter 4: Legacy <strong>Map</strong> <strong>Tiling</strong> Interface<br />

Specifies the x coordinate of the map's point location.<br />

The map location is specified in terms of the units<br />

of the map coordinate system (for example, degrees<br />

or meters). You can determine the coordinate<br />

system of the map by calling the convertScreen-<br />

To<strong>Map</strong>Coord method and examining the returned<br />

<strong>Map</strong>Coordinate object. For more information, see<br />

convertScreenTo<strong>Map</strong>Coord on page 34 and<br />

<strong>Map</strong>Coordinate on page 43.<br />

Specifies the y coordinate of the map's point location.<br />

The map location is specified in terms of the units<br />

of the map coordinate system (for example, degrees<br />

or meters). You can determine the coordinate<br />

system of the map by calling the convertScreen-<br />

To<strong>Map</strong>Coord method and examining the returned<br />

<strong>Map</strong>Coordinate object. For more information, see<br />

37


convert<strong>Map</strong>ToVirtualPixelCoord<br />

Parameter<br />

level<br />

name<br />

output<br />

Example<br />

Type<br />

Integer<br />

String<br />

String<br />

Required<br />

yes<br />

yes<br />

yes<br />

Description<br />

convertScreenTo<strong>Map</strong>Coord on page 34 and<br />

<strong>Map</strong>Coordinate on page 43.<br />

Specifies the map zoom level.<br />

This parameter must be set to a value greater than<br />

or equal to the minLevel value and less than or<br />

equal to the maxLevel value for the named map.<br />

You can determine these values by calling the<br />

getDescription method and examining the returned<br />

<strong>Map</strong>Description object. For more information, see<br />

getDescription on page 29 and <strong>Map</strong>Description<br />

on page 40.<br />

Specifies the name of the named map from which<br />

the map tiles are generated.<br />

Specifies the response format. Must be json.<br />

http://localhost:8080/rest/Enterprise<strong>Map</strong>ping/Legacy<strong>Map</strong><strong>Tiling</strong><strong>Service</strong>/convert-<br />

<strong>Map</strong>ToTileCoord?<br />

name=/NamedTiles/WorldTile<br />

&level=4<br />

&worldX=-79.377366<br />

&worldY=43.64713<br />

&output=json<br />

The above example will return the following JSON response object:<br />

{"EnvinsaResponse":{"tileCoord":{"column":4,"row":4},"type":"<strong>Map</strong><strong>Tiling</strong>Response"}}<br />

Returns<br />

A TileCoordinate object as seen in the above example. See TileCoordinate on page 43.<br />

convert<strong>Map</strong>ToVirtualPixelCoord<br />

38<br />

Description<br />

Converts a specified set of map coordinates to coordinates in the virtual pixel space of the entire map<br />

image, and returns them.<br />

Note:<br />

Do not confuse coordinates in the virtual pixel space of the entire map image with normal screen<br />

pixel coordinates. Normal screen pixel coordinates always start with (0, 0) at the top left corner<br />

<strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> 1.0


Parameters<br />

of the screen, regardless of what section of the entire map image is currently displayed in the<br />

screen. In contrast, the virtual pixel space of the map image is constant at any particular zoom<br />

level, regardless of what part of the map is currently displayed in the screen. So, for example, if<br />

a map image is set to zoom level 3, the map image is composed of 4 tiles across and 4 tiles<br />

down. If each tile has dimensions of 512 by 256 pixels, then the dimensions of the entire map<br />

image are 2048 by 1024 pixels. This is referred to as the virtual pixel space of the map image,<br />

because only a subsection of the entire image may be displayed in the screen at any one time.<br />

For information on the parameter types listed below, see Request URL Data Types on page 46.<br />

Parameter<br />

worldX<br />

worldY<br />

level<br />

<strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> Guide<br />

Type<br />

Float<br />

Float<br />

Integer<br />

Required<br />

yes<br />

yes<br />

yes<br />

Description<br />

Chapter 4: Legacy <strong>Map</strong> <strong>Tiling</strong> Interface<br />

Specifies the x coordinate of the map's point location.<br />

The map location is specified in terms of the units<br />

of the map coordinate system (for example, degrees<br />

or meters). You can determine the coordinate<br />

system of the map by calling the convertScreen-<br />

To<strong>Map</strong>Coord method and examining the returned<br />

<strong>Map</strong>Coordinate object. For more information, see<br />

convertScreenTo<strong>Map</strong>Coord on page 34 and<br />

<strong>Map</strong>Coordinate on page 43.<br />

Specifies the y coordinate of the map's point location.<br />

The map location is specified in terms of the units<br />

of the map coordinate system (for example, degrees<br />

or meters). You can determine the coordinate<br />

system of the map by calling the convertScreen-<br />

To<strong>Map</strong>Coord method and examining the returned<br />

<strong>Map</strong>Coordinate object. For more information, see<br />

convertScreenTo<strong>Map</strong>Coord on page 34 and<br />

<strong>Map</strong>Coordinate on page 43.<br />

Specifies the map zoom level.<br />

This parameter must be set to a value greater than<br />

or equal to the minLevel value and less than or<br />

equal to the maxLevel value for the named map.<br />

You can determine these values by calling the<br />

getDescription method and examining the returned<br />

<strong>Map</strong>Description object. For more information, see<br />

getDescription on page 29 and <strong>Map</strong>Description<br />

on page 40.<br />

39


Objects<br />

Parameter<br />

name<br />

output<br />

Example<br />

Type<br />

String<br />

String<br />

Required<br />

yes<br />

yes<br />

Description<br />

Specifies the name of the named map from which<br />

the map tiles are generated.<br />

Specifies the response format. Must be json.<br />

http://localhost:8080/rest/Enterprise<strong>Map</strong>ping/Legacy<strong>Map</strong><strong>Tiling</strong><strong>Service</strong>/convert-<br />

<strong>Map</strong>ToVirtualPixelCoord?<br />

name=/NamedTiles/WorldTile<br />

&level=4<br />

&worldX=-79.377366<br />

&worldY=43.64713<br />

&output=json<br />

The above example will return the following JSON response object:<br />

{"EnvinsaResponse":{"type":"<strong>Map</strong><strong>Tiling</strong>Response","virtualPixelCoord":{"virtualX":1023,"virtualY":1023}}}<br />

Returns<br />

A VirtualPixelCoordinate object as seen in the above example. See VirtualPixelCoordinate on page<br />

44.<br />

Objects<br />

This section describes the JSON objects that are returned in the response to a <strong>Map</strong> <strong>Tiling</strong> Interface request.<br />

<strong>Map</strong>Description<br />

40<br />

A <strong>Map</strong>Description object defines the metadata for a named map.<br />

When a <strong>Map</strong>Description object is returned in an EnvinsaResponse JSON object, the <strong>Map</strong>Description<br />

object is always located in a JSON field named description.<br />

Fields<br />

A <strong>Map</strong>Description object contains the following fields:<br />

Field Name<br />

maxLevel<br />

Type<br />

Integer<br />

Description<br />

The maximum level (zoom in) that you can request<br />

for the map. Level 1 is the furthest away and is<br />

<strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> 1.0


Field Name<br />

minLevel<br />

coordSys<br />

description<br />

name<br />

tileWidth<br />

tileHeight<br />

bounds<br />

outputTypes<br />

Example<br />

{<br />

Type<br />

Integer<br />

CoordSys<br />

String<br />

String<br />

Integer<br />

Integer<br />

Bounds object<br />

Array of Strings<br />

"maxLevel": 20,<br />

"coordSys": "epsg:41001",<br />

"minLevel": 1,<br />

"description": "<strong>Map</strong> of the World",<br />

"name": "World",<br />

"tileWidth": 256,<br />

"tileHeight": 256,<br />

"bounds":<br />

{<br />

"minX": -3.756380109844111E7,<br />

"minY": -4.497601034176671E7,<br />

"maxX": 3.773376466605809E7<br />

"maxY": 4.49763662218225E7,<br />

},<br />

<strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> Guide<br />

Description<br />

Chapter 4: Legacy <strong>Map</strong> <strong>Tiling</strong> Interface<br />

composed of one tile that the entire map will be<br />

drawn into. Level 2 is composed of 4 tiles, 2 across<br />

and 2 down. Each tile is a quarter of the entire map.<br />

Level 3 is composed of 16 tiles, 4 across and 4<br />

down, and so on. The higher the level specified,<br />

the closer to the Earth the map image appears<br />

(zoom in). The maximum zoom level is set in the<br />

MaximumLevel configuration parameter for the<br />

<strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong>. See Configuring the <strong>Map</strong><br />

<strong>Tiling</strong> <strong>Service</strong> for more information.<br />

The minimum level (zoom out) that you can request<br />

for the map. The minimum zoom level is set in the<br />

MinimumLevel configuration parameter for the<br />

<strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong>. See Configuring the <strong>Map</strong><br />

<strong>Tiling</strong> <strong>Service</strong> for more information.<br />

The coordinate system of the projection defining<br />

the map tiles.<br />

A textural description of the named map.<br />

The name of the named map.<br />

The width of the tiles in pixels.<br />

The height of the tiles in pixels.<br />

The geographical extent of the map's bounding box<br />

in the map's projection as specified by the coord-<br />

Sys field. See Bounds on page 48.<br />

The list of supported tile image formats that can be<br />

rendered for the map.<br />

41


LevelDescription<br />

}<br />

"outputTypes":<br />

[<br />

"png"<br />

"gif"<br />

"jpeg"<br />

]<br />

LevelDescription<br />

42<br />

A LevelDescription object contains information about the number of map tiles on the horizontal and<br />

vertical axes, and the width and height in virtual pixels of the map image created in memory, for a given<br />

map zoom level.<br />

When a LevelDescription object is returned in an EnvinsaResponse JSON object, the LevelDescription<br />

object is always located in a JSON field named levelDescription.<br />

Fields<br />

A LevelDescription object contains the following fields:<br />

Field Name<br />

tileAcross<br />

tileDown<br />

virtualImageHeight<br />

virtualImageWidth<br />

Type<br />

Integer<br />

Integer<br />

Integer<br />

Integer<br />

Description<br />

The number of map tiles on the horizontal axis in<br />

this zoom level.<br />

The number of map tiles on the vertical axis in this<br />

zoom level.<br />

The height of the map image created in memory,<br />

measured in the virtual pixel space of the entire<br />

map image. (See note below.)<br />

The width of the map image created in memory,<br />

measured in the virtual pixel space of the entire<br />

map image. (See note below.)<br />

Note: Do not confuse coordinates in the virtual pixel space of the entire map image with normal screen<br />

pixel coordinates. Normal screen pixel coordinates always start with (0, 0) at the top left corner<br />

of the screen, regardless of what section of the entire map image is currently displayed in the<br />

screen. In contrast, the virtual pixel space of the map image is constant at any particular zoom<br />

level, regardless of what part of the map is currently displayed in the screen. So, for example, if<br />

a map image is set to zoom level 3, the map image is composed of 4 tiles across and 4 tiles<br />

down. If each tile has dimensions of 512 by 256 pixels, then the dimensions of the entire map<br />

image are 2048 by 1024 pixels. This is referred to as the virtual pixel space of the map image,<br />

because only a subsection of the entire image may be displayed in the screen at any one time.<br />

Example<br />

{<br />

"tileAcross": 2,<br />

<strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> 1.0


}<br />

<strong>Map</strong>Coordinate<br />

"tileDown": 2,<br />

"virtualImageHeight": 512,<br />

"virtualImageWidth": 512<br />

A <strong>Map</strong>Coordinate object contains the map coordinates for a location, and the coordinate system in which<br />

they are expressed.<br />

When a <strong>Map</strong>Coordinate object is returned in an EnvinsaResponse JSON object, the <strong>Map</strong>Coordinate<br />

object is always located in a JSON field named mapCoord.<br />

Fields<br />

A <strong>Map</strong>Coordinate object contains the following fields:<br />

Field Name<br />

point<br />

coordSys<br />

Example<br />

{<br />

}<br />

TileCoordinate<br />

Type<br />

"point":<br />

{<br />

"x": -79.377366<br />

"y": 43.64713,<br />

},<br />

coordSys": "epsg:4326"<br />

Point object<br />

CoordSys<br />

Description<br />

The point location expressed as map coordinates.<br />

See Point on page 47.<br />

The coordinate system of the location points.<br />

A TileCoordinate object contains the row and column number of a map tile.<br />

When a TileCoordinate object is returned in an EnvinsaResponse JSON object, the TileCoordinate object<br />

is always located in a JSON field named tileCoord.<br />

Fields<br />

A TileCoordinate object contains the following fields:<br />

Field Name<br />

row<br />

<strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> Guide<br />

Type<br />

Integer<br />

Description<br />

Chapter 4: Legacy <strong>Map</strong> <strong>Tiling</strong> Interface<br />

The row number of the map tile. Row numbering<br />

starts at the left, at number 1.<br />

43


VirtualPixelCoordinate<br />

Field Name<br />

column<br />

Example<br />

{<br />

}<br />

"row": 1,<br />

"column": 8<br />

VirtualPixelCoordinate<br />

44<br />

Type<br />

Integer<br />

Description<br />

The column number of the map tile. Column numbering<br />

starts at the top, at number 1.<br />

A VirtualPixelCoordinate object contains the x and y coordinates of a pixel in the virtual pixel space of<br />

the entire map image.<br />

Note: Do not confuse coordinates in the virtual pixel space of the entire map image with normal screen<br />

pixel coordinates. Normal screen pixel coordinates always start with (0, 0) at the top left corner<br />

of the screen, regardless of what section of the entire map image is currently displayed in the<br />

screen. In contrast, the virtual pixel space of the map image is constant at any particular zoom<br />

level, regardless of what part of the map is currently displayed in the screen. So, for example, if<br />

a map image is set to zoom level 3, the map image is composed of 4 tiles across and 4 tiles<br />

down. If each tile has dimensions of 512 by 256 pixels, then the dimensions of the entire map<br />

image are 2048 by 1024 pixels. This is referred to as the virtual pixel space of the map image,<br />

because only a subsection of the entire image may be displayed in the screen at any one time.<br />

When a VirtualPixelCoordinate object is returned in an EnvinsaResponse JSON object, the VirtualPixel-<br />

Coordinate object is always located in a JSON field named virtualPixelCoord.<br />

Fields<br />

A VirtualPixelCoordinate object contains the following fields:<br />

Field Name<br />

virtualX<br />

virtualY<br />

Example<br />

{<br />

}<br />

"virtualX": 256,<br />

"virtualY": 300<br />

Type<br />

Integer<br />

Integer<br />

Description<br />

The x coordinate of the virtual pixel. The x coordinate<br />

numbering starts at the left edge of the left-most<br />

tile of the map image, at number 0.<br />

The y coordinate of the virtual pixel. The y coordinate<br />

numbering starts at the top edge of the top-most<br />

tile of the map image, at number 0.<br />

<strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> 1.0


Common Data Types<br />

This appendix describes the data types that can be passed as URL parameters<br />

to a <strong>Map</strong> <strong>Tiling</strong> Interface method, and which may be contained in the returned<br />

JSON object.<br />

In this section:<br />

• Request URL Data Types . . . . . . . . . . . . . . . . . . . . . . . . . .46<br />

• Response JSON Data Types . . . . . . . . . . . . . . . . . . . . . . .47<br />

A


Request URL Data Types<br />

Request URL Data Types<br />

46<br />

The following table lists the common data types for URL parameters to a service method.<br />

Although the method parameters (like all URL parameters) are essentially just strings, this table shows<br />

how the various types of data must be formatted in the URL of the method call.<br />

Note:<br />

Name<br />

Bounds<br />

CoordSys<br />

Country<br />

Float<br />

Integer<br />

Language<br />

LinearUnit<br />

Point<br />

Polygon<br />

Rectangle<br />

String<br />

The 'value' portion of a method parameter 'name=value' pair is case sensitive.<br />

Description<br />

A comma-separated array of<br />

four numbers of type Float.<br />

A geographical coordinate<br />

system.<br />

An ISO country code.<br />

A floating point number.<br />

An integer number.<br />

The language used for the<br />

service method response.<br />

A unit of measure for distance.<br />

A point in 2D geometry.<br />

A polygon geometry.<br />

A rectangle geometry.<br />

A string of characters that is<br />

not required to be formatted<br />

as one of the other data types<br />

Format<br />

float,float,float,float<br />

EPSG format<br />

2 or 3 character ISO<br />

country code<br />

[sign]integer.integer<br />

[sign]integer<br />

[ISO language<br />

code]_[ISO country<br />

code]<br />

One of the following values:<br />

M, DM, KM, FT,<br />

YD, or MI.<br />

Example<br />

view=-180,-90,180,90<br />

coordsys=EPSG:4269<br />

country=CA<br />

radius=6.25<br />

maxCandidates=10<br />

language=en_CA<br />

distanceUnit=KM<br />

An x and y value pair point=3.57%20-1.89<br />

separated by a space.<br />

Both x and y are Float<br />

values. In the service request<br />

URL, the space<br />

separator is encoded as<br />

'%20'.<br />

An array of Points.<br />

Points in the array are<br />

separated by a comma<br />

character.<br />

An array of two Points.<br />

The two Points in the array<br />

are separated by a<br />

comma character.<br />

Any string of valid URLencoded<br />

characters.<br />

polygon=1.23%202.34,<br />

3.45%204.56, ... ,<br />

5.67%206.78<br />

rectangle=1.23%202.34,<br />

3.45%204.56<br />

city=New%20York<br />

<strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> 1.0


Name<br />

Description<br />

in this table. An arbitrary<br />

string value.<br />

Format<br />

Response JSON Data Types<br />

Example<br />

This section lists the common data types contained in the JSON objects that are returned in the response<br />

to a service method request.<br />

Note: Note that the data types listed below are distinct from JSON data types. The native JSON data<br />

types are Number, String, Boolean, Array, Object, and null. The purpose of this table is to indicate<br />

how the various Envinsa data types are formatted in the JSON fields, so you can handle them<br />

correctly in your application code.<br />

Primitive Types<br />

The following table lists the primitive (non-object) data types that may be contained in the JSON response<br />

objects.<br />

Name<br />

CoordSys<br />

LinearUnit<br />

Country<br />

Object Types<br />

Description<br />

A geographical coordinate<br />

system.<br />

A unit of measure for distance.<br />

An ISO country code.<br />

Format<br />

EPSG format<br />

One of the following values:<br />

M, DM, KM, FT,<br />

YD, or MI.<br />

2 or 3 character ISO<br />

country code<br />

Example<br />

"coordSys": "EPSG:4269"<br />

"distanceUnit": "M"<br />

"country": "CAN"<br />

This section describes the object data types that may be contained in the JSON response objects.<br />

Point<br />

A Point object represents a point in the 2D geometry of a geographic coordinate system.<br />

Fields<br />

A Point object contains the following fields:<br />

Field Name<br />

x<br />

y<br />

<strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> Guide<br />

Type<br />

Float<br />

Float<br />

Description<br />

The x value of the point.<br />

The y value of the point.<br />

Appendix A: Common Data Types<br />

47


Object Types<br />

48<br />

Example<br />

{<br />

}<br />

"y": 43.64713,<br />

"x": -79.377366<br />

Bounds<br />

A Bounds object defines the geographical extent of a map.<br />

Fields<br />

A Bounds object contains the following fields:<br />

Field Name<br />

minX<br />

minY<br />

maxX<br />

maxY<br />

Example<br />

{<br />

}<br />

Type<br />

Float<br />

Float<br />

Float<br />

Float<br />

"minX": -3.756380109844111E7,<br />

"minY": -4.497601034176671E7,<br />

"maxX": 3.773376466605809E7,<br />

"maxY": 4.49763662218225E7<br />

Description<br />

The x value of the lower left point.<br />

The y value of the lower left point.<br />

The x value of the upper right point.<br />

The y value of the upper right point.<br />

<strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> 1.0


Errors<br />

This appendix describes the error codes that may be returned by the Envinsa<br />

REST Interfaces, and the Error object in which the codes are returned.<br />

In this section:<br />

• Handling Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50<br />

• Error Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50<br />

• Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50<br />

B


Handling Errors<br />

Handling Errors<br />

When making requests to the Envinsa REST Interfaces, errors may occur for a variety of reasons. When<br />

they do occur, the interfaces return an Error object.<br />

Before processing the response from an interface, your client application must first check whether the<br />

returned JSON object is an Error object. If it is, your application can examine the contents of the object<br />

to determine what type of error occurred, and then call the appropriate error handling code.<br />

Error Object<br />

An Error object can be identified by its type field, which is set to the String value Error. It has an error<br />

field that contains the error details as an object. The object has the following fields:<br />

Field Name<br />

code<br />

message<br />

Type<br />

String<br />

String<br />

Description<br />

The error code.<br />

The error message.<br />

The following example illustrates the general form of an Error object:<br />

{<br />

}<br />

"EnvinsaResponse":<br />

{<br />

"type": "Error",<br />

"error":<br />

{<br />

"code": "8001",<br />

"message": "Missing input parameter : point"<br />

}<br />

}<br />

In the above example, the Error object contains an error code of 8001 and an error message of Missing<br />

input parameter : point.<br />

Error Codes<br />

50<br />

The following table lists the codes and messages for errors that may be generated by the Envinsa REST<br />

Interfaces.<br />

Note:<br />

Errors that are generated by the Envinsa Web <strong>Service</strong>s do not have an error number.<br />

<strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> 1.0


Code<br />

8000<br />

8001<br />

8002<br />

Message<br />

<strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> Guide<br />

<strong>Service</strong> error : message<br />

Invalid parameter : message<br />

Missing parameter : message<br />

Description<br />

Appendix B: Errors<br />

A general error has occurred. The nature of the<br />

error is indicated in the message text.<br />

The request URL contained an invalid method<br />

parameter value.<br />

The request URL did not contain a required method<br />

parameter.<br />

51


How Pixels, Tiles, and <strong>Map</strong><br />

Coordinates are<br />

Transformed<br />

The following sections provide background information on the underlying process<br />

used by the <strong>Map</strong> <strong>Tiling</strong> Interface methods to perform transformations between<br />

pixels, tiles and coordinate systems. These transformations enable applications<br />

to return, pan, zoom, and display the appropriate tile.<br />

The <strong>Map</strong> <strong>Tiling</strong> Interface methods convertScreenTo<strong>Map</strong>Coord, convertScreenToTileCoord,<br />

convert<strong>Map</strong>ToVirtualPixelCoord and convert<strong>Map</strong>ToTileCoord<br />

provide a much easier way to perform the transformations<br />

described in the following sections. For information on these methods, see convertScreenTo<strong>Map</strong>Coord<br />

on page 34, convertScreenToTileCoord on page 36,<br />

convert<strong>Map</strong>ToVirtualPixelCoord on page 38 and convert<strong>Map</strong>ToTileCoord on<br />

page 37.<br />

In this section:<br />

• Transforming a Pixel to a <strong>Map</strong> Coordinate . . . . . . . . . . . .54<br />

• Transforming a Pixel to a Tile Coordinate . . . . . . . . . . . .54<br />

• Transforming a <strong>Map</strong> Coordinate to a Tile Coordinate . . .55<br />

C


Transforming a Pixel to a <strong>Map</strong> Coordinate<br />

Transforming a Pixel to a <strong>Map</strong> Coordinate<br />

To pan or zoom a map based on tiles from the <strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> the client must have the ability to<br />

convert a pixel to a location on the Earth. To do this the client must create an affine transform that when<br />

given a coordinate in pixels returns a coordinate in the projection of the tiles. You need to know the<br />

projection of the tiles, the bounds of the map being tiled, and the dimensions of a tile. Given this information<br />

you must do the following:<br />

1. Calculate the maximum number of tiles across that represents the map.<br />

2. Calculate the maximum number of tiles down that represents the map.<br />

3. Calculate the maximum number of pixels across that represents the map.<br />

4. Calculate the maximum number of pixels down that represents the map.<br />

5. Create an affine transform based on the bounds of the map and the bounds of the map in pixels.<br />

6. Feed your location in pixels into the affine transform. The result will be a location on the earth in the<br />

projection of the map.<br />

To perform these steps, and transform a pixel into your map's coordinate system:<br />

1. Calculate the maximum number of tiles across the map using the following equation: tilesAcross<br />

= 2 level<br />

2. Calculate the maximum number of tiles down the map using the following equation: tilesDown =<br />

2 level<br />

3. Calculate the number of pixels across the entire map using the following equation: pixelsAcross<br />

= tileWidth × tileAcross<br />

4. Calculate the number of pixels down the entire map using the following equation: pixelsDown =<br />

tileHeight × tileDown<br />

5. Given the bounds of the map in the map's projection and the bounds of the map in pixels an affine<br />

transform from pixels to map coordinates can be constructed. The pixel coordinate passed must be<br />

in the map's pixel space. It may not be enough to directly feed a pixel coordinate from a mouse location<br />

on the screen. For instance, you may have to convert the mouse location to a location in the<br />

map's pixel space. This involves keeping track of the location in map pixels space of the upper righthand<br />

corner of the image control and offsetting the mouse location with that location.<br />

The getDescription method provides all the information needed to construct the affine transform like<br />

tileWidth, tileHeight, map projection, and map bounds. See getDescription on page 29.<br />

Transforming a Pixel to a Tile Coordinate<br />

54<br />

To perform pan and zoom, and locate items in a particular map tile, you need to be able to determine<br />

which tile a pixel is in. To do this the client must be able to calculate the column and row or the tile when<br />

given a coordinate in pixels. To perform this step, and transform a pixel into a tile coordinate, you can<br />

use the following calculations:<br />

<strong><strong>Map</strong>Info</strong> <strong>Spatial</strong> <strong>Server</strong> 1.0


1. Calculate the tile column:<br />

col = (pixelX ÷ tileWidth) + 1<br />

2. Calculate the tile row:<br />

row = (pixelY ÷ tileHeight) + 1<br />

It is important to remember that the pixel location is relative to the map's pixel space and not the screen<br />

space. It may not be enough to directly feed a pixel coordinate from a mouse location on the screen.<br />

For instance, you may have to convert the mouse location to a location in the map's pixel space. This<br />

involves keeping track of the location in map pixels space of the upper right-hand corner of the image<br />

control and offsetting the mouse location with that location.<br />

Transforming a <strong>Map</strong> Coordinate to a Tile Coordinate<br />

Using the information specified in the section Transforming a Pixel to a <strong>Map</strong> Coordinate on page 54,<br />

instead, reverse the affine transform and create a transform that goes from map coordinates to pixels.<br />

Feed a coordinate in the map's projection into the affine transform and the result is a coordinate in the<br />

map's pixel space. Next, apply the steps from the section Transforming a Pixel to a Tile Coordinate<br />

on page 54 to convert the pixels from map space to a tile coordinate.<br />

<strong>Map</strong> <strong>Tiling</strong> <strong>Service</strong> Guide<br />

Appendix C: How Pixels, Tiles, and <strong>Map</strong> Coordinates are Transformed<br />

55

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!