Spectrum Technology Platform. Version 9.0. Spectrum Spatial Developer Guide



Similar documents
Spectrum Technology Platform

Spectrum Technology Platform

Spotfire v6 New Features. TIBCO Spotfire Delta Training Jumpstart

Developer Tutorial Version 1. 0 February 2015

v4.8 Getting Started Guide: Using SpatialWare with MapInfo Professional for Microsoft SQL Server

Sisense. Product Highlights.

Insight for location-powered decision making.

Release 2.1 of SAS Add-In for Microsoft Office Bringing Microsoft PowerPoint into the Mix ABSTRACT INTRODUCTION Data Access

Spectrum Technology Platform. Version 9.0. Administration Guide

ORACLE BUSINESS INTELLIGENCE WORKSHOP

SAP HANA Core Data Services (CDS) Reference

Business Insight Report Authoring Getting Started Guide

Publishing KML Services Tutorial

There are various ways to find data using the Hennepin County GIS Open Data site:

Spectrum Technology Platform. Version 9.0. Spectrum Spatial Administration Guide

Oracle Service Bus Examples and Tutorials

CA Identity Manager. Glossary. r12.5 SP8

How To Test Your Web Site On Wapt On A Pc Or Mac Or Mac (Or Mac) On A Mac Or Ipad Or Ipa (Or Ipa) On Pc Or Ipam (Or Pc Or Pc) On An Ip

Logi Ad Hoc Reporting System Administration Guide

ArcGIS Server mashups

T320 E-business technologies: foundations and practice

IBM Information Server

SAS BI Dashboard 4.3. User's Guide. SAS Documentation

Terms and Definitions for CMS Administrators, Architects, and Developers

Geographic Web Application

SharePoint Integration Framework Developers Cookbook

Chapter 6: Data Acquisition Methods, Procedures, and Issues

SAP Business Objects Business Intelligence platform Document Version: 4.1 Support Package Data Federation Administration Tool Guide

Activity: Using ArcGIS Explorer

Jaspersoft APIs. Integrating BI with your Applications. Community and Professional Editions

Security Development Tool for Microsoft Dynamics AX 2012 WHITEPAPER

Site Configuration Mobile Entrée 4

Creating a Patch Management Dashboard with IT Analytics Hands-On Lab

Content Author's Reference and Cookbook

Getting Started With Mortgage MarketSmart

Oracle Spatial 10g. An Oracle White Paper August 2005

ORACLE BUSINESS INTELLIGENCE WORKSHOP

PeopleTools 8.51 PeopleBook: PeopleSoft Application Designer Lifecycle Management Guide

SAS BI Dashboard 4.4. User's Guide Second Edition. SAS Documentation

WEBFOCUS QUICK DATA FOR EXCEL

Build Your First Web-based Report Using the SAS 9.2 Business Intelligence Clients

SAS IT Resource Management 3.2

From GPS Data Collection to GIS Data Display A Walk-Through Example

ORACLE APPLICATION EXPRESS 5.0

Documentation of open source GIS/RS software projects

Accessing Data with ADOBE FLEX 4.6

Generating Open For Business Reports with the BIRT RCP Designer

Maximizer CRM 12 Winter 2012 Feature Guide

Which Reporting Tool Should I Use for EPM? Glenn Schwartzberg InterRel Consulting info@interrel.com

Getting Started With LP360

Sage Intelligence Financial Reporting for Sage ERP X3 Version 6.5 Installation Guide

J j enterpririse. Oracle Application Express 3. Develop Native Oracle database-centric web applications quickly and easily with Oracle APEX

Spectrum Technology Platform. Version 9.0. Enterprise Data Integration Guide

ER/Studio Enterprise Portal User Guide

Enterprise Service Bus

Printing Guide. MapInfo Pro Version Contents:

Contents. Launching FrontPage Working with the FrontPage Interface... 3 View Options... 4 The Folders List... 5 The Page View Frame...

Load testing with. WAPT Cloud. Quick Start Guide

UOFL SHAREPOINT ADMINISTRATORS GUIDE

Introduction to NaviGenie SDK Client API for Android

SAS Task Manager 2.2. User s Guide. SAS Documentation

64 Bits of MapInfo Pro!!! and the next BIG thing. March 2015

GXP WebView GEOSPATIAL EXPLOITATION PRODUCTS (GXP )

Exploring GIS Integration Options for SAP BusinessObjects

4 Understanding. Web Applications IN THIS CHAPTER. 4.1 Understand Web page development. 4.2 Understand Microsoft ASP.NET Web application development

Asset Track Getting Started Guide. An Introduction to Asset Track

MapInfo Professional Version Printing Guide

Web Services API Developer Guide

Oracle Business Intelligence Server Administration Guide. Version December 2006

SQL Server 2005: Report Builder

Reporting Services. White Paper. Published: August 2007 Updated: July 2008

Visualization with Excel Tools and Microsoft Azure

Actian Vortex Express 3.0

NatureServe s Environmental Review Tool

Using IBM dashdb With IBM Embeddable Reporting Service

<Insert Picture Here> Oracle Application Express 4.0

Dynamic Decision-Making Web Services Using SAS Stored Processes and SAS Business Rules Manager

Publishing Geoprocessing Services Tutorial

SQL Server 2005 Reporting Services (SSRS)

MyOra 3.0. User Guide. SQL Tool for Oracle. Jayam Systems, LLC

Scheduling Software User s Guide

Ultimus and Microsoft Active Directory

GeoMedia Product Update. Title of Presentation. Lorilie Barteski October 15, 2008 Edmonton, AB

Data Tool Platform SQL Development Tools

Chapter 4 Accessing Data

Step by Step Guide for GIS Cloud Applications

Using Adobe Dreamweaver CS4 (10.0)

Quick and Easy Web Maps with Google Fusion Tables. SCO Technical Paper

Five Steps to Better Performance

DEPLOYMENT GUIDE Version 1.1. Deploying F5 with Oracle Application Server 10g

SAP BO Course Details

Change Management for Rational DOORS User s Guide

Toad for Oracle 8.6 SQL Tuning

TIBCO Spotfire Web Player Release Notes

Chapter 4: Website Basics

APPENDICES. Appendix 1 Autodesk MapGuide Viewer R6 Help

ArcGIS Viewer for Silverlight An Introduction

Managing Software Updates with System Center 2012 R2 Configuration Manager

Teamcenter s manufacturing process management 8.3. Report Generator Guide. Publication Number PLM00064 E

HydroDesktop Overview

Transcription:

Spectrum Technology Platform Version 9.0 Spectrum Spatial Developer Guide

Contents Chapter 1: Introduction...9 What Is Location Intelligence?...10 What Is the Location Intelligence Module?...10 Location Intelligence Module Capabilities...10 Chapter 2: Concepts...11 Spectrum Spatial Concepts...12 Named Resources...12 Repository...12 REST...12 RIA Controls...12 SOAP...12 Stages...12 Web Services...13 Named Connections...13 Mapping Concepts...13 Maps...13 Layers...13 Tables...14 Features...14 Labels and Legends...14 Themes...15 Styles...16 Geocoding...16 Routing...16 Coordinate Systems and Projections...16 Map Tiles...17 Rasters and Grids...17 MAPINFO_MapCatalog...17 Chapter 3: Architecture...19 Architecture Overview...20 Architecture: Basic and Scaled Diagrams...21

Chapter 4: Working With Spatial Services...23 Learning More About the Web Services...24 Feature Service...24 Geometry Service...24 Map Tiling Service...25 Mapping Service...25 Named Resource Service...26 Catalog Service for the Web...27 Web Feature Service...28 Web Map Service...28 Accessing Location Intelligence Module Services...28 Via Stages...29 Via Web Services...29 Chapter 5: Working with RIA Controls...33 What Are the RIA Controls?...34 Getting Started with the RIA Controls...34 Developing with the RIA Controls...35 Using the RIA Proxy...35 Installing the RIA Proxy...36 Why Use the RIA Proxy?...37 Using the RIA Proxy in your Web Application...38 Chapter 6: Working With REST Services...41 What Are the REST Services?...42 REST Interfaces...42 Mapping REST Interface...43 Methods...43 Feature REST Interface...66 Methods...66 Map Tiling REST Interface...80 Methods...80 Objects...83 Common Data Types...85 Request URL Data Types...85 Chapter 7: Understanding Tables...87 Supported Data Sources...88 Uses for Tables...88 Chapter 8: Understanding Layers...89 Feature Layer...90 4 Spectrum Technology Platform 9.0

FeatureLayer in Named Map...90 Named Layer...91 FeatureLayer as an Overlay...92 Line Linkage Layer...92 LineLinkageLayer in Named Map...93 Layer With Line Linkage...94 Label Layer...95 Layer With Labels...95 Graduated Symbol Layer...97 Graduated Symbol Theme Definition...98 Graduated Symbol Theme SOAP Request...99 Bar Chart Layer...100 Bar Chart Theme Definition...100 Bar Chart Theme SOAP Request...101 Pie Chart Layer...102 Pie Chart Theme Definition...103 Pie Chart Theme SOAP Request...104 Line Chart Layer...105 Line Chart Theme Definition...106 Line Chart Theme SOAP Request...107 Grid Layer...108 Grid Example...109 Modifying the Style with a FeatureStyleModifier...111 Style Override...111 Range Theme...113 Individual Value Theme...118 Dot Density Theme...120 Chapter 9: Using Styles...123 About Styles...124 Specifying Styles...124 Defining Named Styles...125 MapBasic Styles...125 MapBasicLineStyle...126 MapBasicAreaStyle...126 MapBasicPointStyle...128 MapBasicTextStyle...131 MapBasicCompositeStyle...132 Named Styles...132 Line Styles...132 Fill Styles...136 Point Styles...143 Font Styles...145 Symbol Styles...147 Image Styles...151 Spectrum Spatial Developer Guide 5

Composite Styles...157 Pattern Codes...161 Line Pattern Codes...161 Fill Pattern Codes...162 Symbol Codes...162 MapInfo 3.0 Symbol Codes...163 Chapter 10: Rasters and Grids...165 Supported Capabilities for Rasters and Grids...166 Supported Raster Formats...166 Using Rasters and Grids...167 Grid Example...167 Chapter 11: How To's...171 Mapping...172 Design Your Map...172 Use a Map Created in MapInfo Professional...173 Create a Thematic Map...179 Add a Legend to Your Map...182 Accessing Data from a Database...183 Adding or Modifying a JDBC Named Connection...183 Map Tiling...184 Configuring the Map Tile Service...184 Creating a Named Tile Definition...187 Requesting a Map Tile...193 Generating Map Tiles...193 Using Tile Caching...195 Web Service Authentication...199 Using Basic Authentication...199 WMS Configuration...203 Step 1: Create Named Tables...203 Step 2: Create Named Layer...204 Step 3: Add Layers to WMS Configuration...205 Step 4: Create Layer Tree in WMS Configuration...207 Step 5: Test the WMS Configuration...208 Custom Symbols...211 Displaying Custom Symbols...211 Chapter 12: Migrating from Envinsa or MapXtreme Java...213 Architecture Considerations...214 Migration Tasks...215 Configuration...215 Development...216 6 Spectrum Technology Platform 9.0

Chapter 13: Sample Applications...221 When to Use REST and SOAP...222 REST Samples...222 List the Named Tiles In the Repository...222 List the Named Maps In the Repository...223 SOAP Samples...224 Find the Nearest Five Subway Stations...224 Chapter 14: Common Object Types...231 Geometry Types...232 Geometry Examples...232 MapView Types...243 MapView Examples...243 Chapter 15: MapInfo Workspace (MWS)...247 What Is the MapInfo Workspace?...248 Structure of a Workspace...248 Header Section...248 Connection Section...249 DataSource Definition Section...251 Map Definition Section...252 Spectrum Spatial Developer Guide 7

Introduction 1 Welcome to the Spectrum Technology Platform Location Intelligence Module Developer Guide. This guide will help you build a web mapping application or embed mapping in an existing application using a variety of web services, capabilities, tools and sample code. Addressed in this guide are: Web Services for Mapping, Feature, Map Tiling, and Geometry. OGC-compliant Web Services for WMS, WFS and CSW Capabilities for rendering maps, searching for features, getting metadata about maps and features, performing spatial calculations and more APIs for the above capabilities Step-by-procedures for common tasks: using a MapInfo Professional workspace in Spectrum Technology Platform, creating named resources, configuring WMS, using map tiling Migration information for moving an Envinsa or MapXtrene Java application to Spectrum Spatial Demo pages for web service SOAP/REST requests Sample applications in JavaScript, RIA controls Code examples in Java and.net Utilities for loading workspaces, generating tiles and validating geometries Additional Spectrum Technology Platform and Location Intelligence Module documentation is located online at support.pb.com. In this section: What Is Location Intelligence?.....................10 What Is the Location Intelligence Module?...........10

What Is Location Intelligence? What Is Location Intelligence? Location intelligence is: An awareness of relationships between location information and business analysis and operations The ability to use the understanding of geographic relationships to predict how it impacts a business or organization The capability to react to how location influences an organization by changing business processes in order to minimize risk and maximize opportunities Location Intelligence enables a business to measure, compare and analyze its data from business operations, in conjunction with external data such as transportation networks, regulatory jurisdictions, market characteristics or its own customers. What Is the Location Intelligence Module? The Location Intelligence Module enables an organization to rapidly integrate location information into business applications and processes. This enables organizations to create and embed maps, understand spatial relationships, and carry out spatial calculations. The Location Intelligence Module provides support for standards-based geospatial information sharing through support for certified OGC web services. The Location Intelligence Module provides support for integration at three levels: Web application development - Rapid application development user interface components and JavaScript API Web service integration - Support for SOAP, REST and certified OGC web services (WMS, WFS, CSW) Data integration - Batch and transactional integration of spatial data sources The Location Intelligence Module is part of the Spectrum Spatial solution encompassing: Location Intelligence Module Enterprise Geocoding Module Enterprise Routing Module Location Intelligence Module Capabilities The Location Intelligence Module offers the following capabilities: Map-based data visualization and analysis Feature querying and searching Geometry operations including measurements (area, perimeter, length), predicates (within, contains, intersects), geometry manipulation (union, buffer, intersection) and coordinate transformation Some of the things these capabilities enable you to do are: Determine which sites are nearest to a given location Determine whether or not a location resides in a given area Query a spatial database using spatial functions as well as standard SQL functions Perform a variety of calculations on spatial data, such as determining the area of a polygon, determining the distance between two points, or measuring the perimeter of an area Return a geometry object that represents the union of two input geometry objects 10 Spectrum Technology Platform 9.0

Concepts 2 Before you start developing with Spectrum Spatial, it's helpful to understand both Spectrum Spatial concepts, as well as basic mapping concepts and how these concepts are implemented in Spectrum Technology Platform. This chapter discusses the common concepts you will come across as you learn Spectrum Technology Platform. In this section: Spectrum Spatial Concepts........................12 Mapping Concepts...............................13

Spectrum Spatial Concepts Spectrum Spatial Concepts This section presents concepts of which you will need an understanding as you develop your applications with Spectrum Technology Platform. Named Resources A resource can be a table, layer, map, tile, or style. In the Spectrum Technology Platform, a named resource is data to which a name has been given. This allows the resource to referred by its name and not its properties. Named resources must be stored in a central database called a repository. For more information, see the Resources and Data section in the Spectrum Technology Platform Spectrum Spatial Guide on support.pb.com. Repository The repository is a central document database that stores Named Resource definitions. For more information, see the Resources and Data section in the Spectrum Technology Platform Spectrum Spatial Guide on support.pb.com. REST Representational State Transfer (REST) is an architectural style that revolves around resources and the actions (analogous to verbs) that one can take with them. The "verbs" are provided by HTTP (for example, GET, PUT, or DELETE). In REST, resources can have one or more representation, typically HTML, JSON and image types. REST services are usually used from within a web application in a browser (for example, RIA or web controls). RIA Controls The RIA (Rich Internet Application) controls provide a set of browser-based user interface components for easily embedding maps and other location-based capabilities in web pages. The RIA controls can be used in a wide range of scenarios, from simply embedding maps in your web site to show locations, to creating rich web applications. Built entirely in JavaScript, the controls work without the need for any browser plug-ins and without having to write any server-side code. The RIA controls use Web 2.0 techniques to provide functionality such as seamless map panning and the ability to search and display information without requiring a web page refresh. For more information, see What Are the RIA Controls? on page 34. SOAP SOAP is short for Simple Object Access Protocol. A SOAP request message must be in the XML format that is defined by the SOAP specification. Stages To access Location Intelligence Module services via stages, you build and run a dataflow in Enterprise Designer that includes one of more Location Intelligence Module stages. Stages use a direct socket-based method to communicate with the corresponding Location Intelligence Module services. For more information, see Via Stages on page 29. 12 Spectrum Technology Platform 9.0

Chapter 2: Concepts Web Services The Location Intelligence Module services are exposed as web services (interfaces for a service oriented architecture (SOA), in which Web-based applications dynamically interact with other Web applications using open standards such as SOAP or REST). To access Location Intelligence Module services via the web services, you construct an HTTP request and submit it directly to the web service. The HTTP request can be in the form of a SOAP request, a REST request, or a POST/GET request, and can be submitted directly from a web browser or from a client application. Named Connections A named connection describes the connection information to access a data source, such as a.tab file or table in a remote database management system. It contains a name so that the connection can be referenced from a wide variety of places. A named connection is not to be confused with named resources that are stored in the Spectrum Technology Platform repository. Named connections are created in the Management Console. Mapping Concepts Before you create a mapping application, it's helpful to understand basic mapping concepts and how these concepts are implemented in Spectrum Technology Platform. This chapter discusses the common concepts you will come across as you learn Spectrum Technology Platform. Maps A map displays the spatial relationship among map features, such as town boundaries, customer locations, or power lines. The map visually orients you to where those features are and what they represent. In addition to features, elements on the map can include labels, titles, legends, and themes. Themes are created based on some action taken involving the features and information on the map. Layers Maps are made up of layers. Layers contain the rules that define how features are drawn on the map. The bottommost layer is drawn first and the topmost layer drawn last. Layers containing features that would obscure the features of other layers should be placed lower, respectively. For example, a layer of boundary regions should be placed beneath a layer of points. Spectrum Spatial Developer Guide 13

Mapping Concepts Layers in Spectrum Technology Platform can represent more than features. Layers can be raster or grid images, seamless maps (joined maps), contain labels or user-drawn features, or contain a theme, such as a pie or bar chart. To change how the layer is displayed, use a style override or theme. To learn about the types of layers that Spectrum Technology Platform supports, see the Resources and Data section in the Spectrum Technology Platform Spectrum Spatial Guide on support.pb.com. Tables Tables are collections of features from a data source. Tables hold rows and columns of information that describe the features, including their geometry, style, and attributes. Features A feature is a row in a table. Features are defined by their data source, ID, style, attributes, and in the case of spatial features, geometry. Features are displayed on a map as a Feature Layer. Searching features for additional information is one of the main uses of digital maps. In Spectrum Technology Platform features are returned in FeatureCollections as the result of a query. Labels and Legends Maps need text such as labels and legends to deliver the message of the map. Labels describe the data in the feature table. They can be customized in many ways, including their visibility, position, style, and content. Themes that change the style and content can be applied to label layers. Use MI SQL expressions to generate custom label strings and rules. Legends are cartographic elements that describe the features in a coded manner. For example, the legend may describe the boundaries as school districts, the lines as a power line network, or points as corporate office locations. Legends also contain a title to describe collectively what the map represents. Legends in Spectrum Technology Platform are generated on the fly when a map is requested, and based on the defined themes and styles of the map's layers. 14 Spectrum Technology Platform 9.0

Chapter 2: Concepts Themes Themes are the mechanism by which you can change the display of a map. This can be as simple as overriding the current style of the features or more complex to show information from the underlying data in a visual way. The main purpose of a thematic map is to graphically communicate a particular type of data that is associated with the map, such as population levels or temperature ranges. The particular type of data forms the theme of the map, and the theme can represent the data using shades of color, fill patterns, symbols, bar charts, and pie charts. For example, a ranged theme shows color blocks where each color represents features on the map that meet the same criteria. A graduated symbol theme is useful for showing distributions of populations for example, with the largest symbol representing the largest population. Themes can also be created for labels. For example, use a ranged label theme to show the relative population size among cities. The largest labels represent the cities with the largest populations. Spectrum Spatial Developer Guide 15

Mapping Concepts Styles Styles enable you to control the visual appearance of map features, labels, themes and legends. Each feature has a default style. To change the style, apply an override theme. In Spectrum Technology Platform the support for sparse styles allows you to change only the properties you want and merge styles together to form a single style. Geocoding Geocoding is the process of determining the latitude/longitude coordinates of an address. A typical use of geocoded addresses is to display the data on a map and analyze the relationships among the data from a spatial point of view. Any custom data that contains locational information, such as street address or postal code, can be geocoded. The process involves matching it against already geocoded records covering the same location. If an address match is made, the coordinates from the geocoded record are assigned to the custom record. Routing Another component available to developers of Spectrum Technology Platform is routing. Driving direction applications and those involved in planning routes for deliveries or laying cable, for example, utilize routing. Typically the goal is to locate the route by shortest distance or shortest travel time. Coordinate Systems and Projections Coordinate systems and projections are two important mapping concepts about which you should have a basic understanding. Projection refers to how a map is displayed on a flat surface such as a paper map or computer screen, while a coordinate system describes how map features are spatially arranged. Both are important considerations when developing applications, especially those where spatial precision and accuracy are important. A projection is a method of reducing the distortion that occurs when objects from a spherical surface are displayed on a flat surface. There are two main trade-offs to be considered: the preservation of equal area, and the preservation of the true shape of a feature. There are many different types of projections, each designed to reduce the amount of distortion for a given area. Some projections preserve shape; others preserve accuracy of area, distance, or direction. 16 Spectrum Technology Platform 9.0

Chapter 2: Concepts A coordinate system is a set of parameters that tells you how to interpret the locational coordinates for objects. One of those parameters is projection. Coordinates can be of two types: Spherical or Cartesian. Spherical relates to locations on the curved surface of the Earth, while Cartesian describes flat surface locations in two dimensions. Both are represented by x and y coordinates. The difference comes when calculating distance or area of features that represent real Earth locations such as streets or rivers (Spherical), or relative locations, such as a map of brain anatomy or a chess board (Cartesian). Knowing which coordinate system your map uses is an important consideration when developing applications. Analytical operations involving distance and area calculations, such as buffering, routing, and querying, use the coordinate system and projection to yield the correct results. Map Tiles Map tiles are portions of a map that are seamlessly joined on the fly while you are panning and zooming in the map window. Each pan and zoom is a call to the server to request the appropriate map tile(s). Only those that fit the bounds of the map view and match the zoom level are returned. Google Maps and Bing Maps are examples of applications that use map tiles. Map tiles are created by dividing a map into levels that represents specific zoom levels. Level 0 is the entire map, Level 1 is one level zoomed out from the entire map and divided evenly into four tiles. Level 2 contains 16 tiles, which are the four tiles from Level 1 divided evenly. Level 3 are the 16 Level 2 tiles subdivided into 64 tiles. Levels 0-3 of a world map typically show global levels detail, while higher levels, are zoomed in to show street-level detail. Actual zoom levels are dependent on the bounds of the named map. At very high levels (16 and above), the number of tiles is huge. For faster retrieval, you can pre-render the tiles if you know the map layers will not change. Or for more dynamic map tiles, you can cache them and provide an expiration date so that new tiles are generated when necessary. Rasters and Grids Raster and grid images are special kinds of layers. These are image files plus a registration point TAB file that allows the image to be rendered as a map layer. You can create a registration point file in MapInfo Professional. A raster is typically a background layer used for reference: aerial photo, topo map, custom graphics. In Spectrum Technology Platform, user-controlled properties of raster images include brightness, contrast, opacity, grayscale and transparency. A grid is an overlay layer that shows a continuous gradation of color to represent interpolated values from the underlying data. In Spectrum Technology Platform user-controlled properties of a grid include brightness, contrast, opacity, grayscale, transparency, and an inflection collection (how the colors are defined and spread). See Supported Raster Formats on page 166 for further information. MAPINFO_MapCatalog A MAPINFO_MapCatalog is a server table that stores information about the location of spatial columns in a database management system. Each table in the database is represented as a row in the MapCatalog. Spectrum Technology Platform does not require the use of a MapCatalog, but other MapInfo-based products do. If there is no MapCatalog for the database, Spectrum Technology Platform derives the data types from the data source itself. Spectrum Spatial Developer Guide 17

Architecture 3 This section describes the architecture of the Spectrum Technology Platform Location Intelligence Module. It provides an overview as well as an evolution of the basic architecture to an extended, more scaled-up version. In this section: Architecture Overview............................20 Architecture: Basic and Scaled Diagrams............21

Architecture Overview Architecture Overview The following diagram shows an overview of the fundamental architecture of Spectrum Technology Platform Location Intelligence Module, prior to any development, extension, or scaling. The architecture consists of the following components: Repository The foundation of the Spectrum Technology Platform Location Intelligence Module is the repository. It contains named resources such as named styles, named tables, named maps, named layers, and named configurations. See the Resources and Data section in the Spectrum Technology Platform Spectrum Spatial Guide on support.pb.com. Core Services The core services that Location Intelligence Module provides are Mapping, Feature, and Geometry services. See Learning More About the Web Services for more information on these core services. OGC Services The OGC (Open Geospatial Consortium) services include: 20 Spectrum Technology Platform 9.0

Chapter 3: Architecture Catalog Service for the Web (CSW) Web Map Service (WMS) Web Feature Service (WFS) Map Tiling The Map Tiling Service returns map tiles on the fly or from a tile cache at the user's request. See Map Tiling Service for more information on this service. Named Resource You can use the Named Resource Service to manage almost any type of named resource in the repository. See the Services section in the Spectrum Technology Platform Spectrum Spatial Guide on support.pb.com. Architecture: Basic and Scaled Diagrams The diagram below shows an example of the default, initial architecture of Spectrum Technology Platform Location Intelligence Module, where there is a single server on which Spectrum Spatial is installed. Everything, including the repository, image files, and tile cache on a single box in the same location as where the product is installed. To scale Spectrum Spatial from one to three servers, each server leverages a single shared database server and image server to maximize efficiency and to avoid situations where an image or database resource is unavailable to one of the Spectrum Spatial servers. The file image server stores all images between multiple versions of Spectrum Spatial. All instances of Spectrum Spatial store images in a single location Spectrum Spatial Developer Guide 21

Architecture: Basic and Scaled Diagrams For load balancing information, see the Adminstration section in the Spectrum Technology Platform Spectrum Spatial Guide on support.pb.com. 22 Spectrum Technology Platform 9.0

Working With Spatial Services 4 This chapter describes the spatial services, and how you can access the various spatial services. This section also shows you how to start using the spatial services in your applications. In this section: Learning More About the Web Services..............24 Accessing Location Intelligence Module Services.....28

Learning More About the Web Services Learning More About the Web Services This section provides a brief overview of each of the Location Intelligence Module web services. Feature Service The Feature Service provides the ability to search spatial databases. It provides a set of common operations that you can use to query content, regardless of the underlying data provider. The advantage of this is that you can run the exact same operation against many different content stores (such as a native TAB file, an Oracle database table, or a SQL Server database table) by specifying different named tables; the same query will work on each table type. The Feature Service provides operations that: list all tables in the catalog describe specific tables in the catalog search within a distance search intersects search within a polygon search for the nearest feature search using a custom MapInfo SQL query Service URLs The URL endpoint for the REST implementation of the Feature Service has the following general form: http://hostname[:portnumber]/rest/spatial/featureservice The URL endpoint for the SOAP implementation of the Feature Service has the following general form: http://hostname[:portnumber]/soap/featureservice The URL for the Feature Service WSDL document has the following general form: http://hostname[:portnumber]/soap/featureservice?wsdl The URL for the Feature Service demo page has the following general form: http://hostname[:portnumber]/spatial/featureservice/demopage.html Documentation Geometry Service The Geometry Service provides a simplified interface to perform Geometry Service measurements, conversions, and operations. The Geometry Service provides four different types of capabilities: Aggregate (buffer, centroid, envelope, union, intersection, convex hull, difference, symdifference) Transformation (coordinate transformations) 24 Spectrum Technology Platform 9.0

Chapter 4: Working With Spatial Services Measurement (area, distance, length, perimeter) Predicate (contains, intersects, within) This service provides a set of common operations that you can use to perform operations on content, regardless of the data provider. One advantage is that you can run the exact same operation against many different content repositories (e.g., a native TAB file, an Oracle table, or a SQL Server table) by specifying different named tables; the same operation will work on each table type. Using the Geometry Service, you only need to worry about the request, not the location or type of data in the repository. The Geometry Service is based on the well known mathematical concepts described in the OGC Simple Features Specification. Service URLs The URL endpoint for the Geometry Service has the following general form: http://hostname[:portnumber]/soap/geometryservice The URL for the Geometry Service WSDL document has the following general form: http://hostname[:portnumber]/soap/geometryservice?wsdl The URL for the Geometry Service demo page has the following general form: http://hostname[:portnumber]/spatial/geometryservice/demopage.html Map Tiling Service The Map Tiling Service dynamically generates subsets of a map on a per-request basis. This subset is called a tile. The tiles generated from the Map Tiling Service can be used individually, or combined to form larger maps, in applications for seamless map interaction. This service provides fast, simple, light-weight map rendering where more complex map rendering can be performed using the Mapping Service. The Map Tiling Service allows the hosting of multiple maps that can be used to generate the tiles. These named maps are located in one or more map repositories. Each map hosted by the Map Tiling Service can have a specific configuration that defines how the map will be used to create tiles. The built-in pluggable caching mechanism is an important feature of the Map Tiling Service. When this caching is turned on, tiles are stored so serving of tiles to the client is both faster and less resource intensive. This also allows the pregeneration of tiles and pointing the Map Tiling Service to this cache. Service URLs The URL endpoint for the Map Tiling Service has the following general form: http://hostname[:portnumber]/rest/spatial/maptilingservice Mapping Service The Mapping Service provides a simplified interface to perform Mapping Service rendering, themes, overlays, and conversions. The Mapping Service provides both simple operations that are more frequently used, or more complex operations that require higher levels of customization. Spectrum Spatial Developer Guide 25

Learning More About the Web Services The Mapping Service provides operations that: list and get all maps, layers, styles, or tables in the repository conversion methods between real world coordinates, XY, and screen coordinates screen calculations such as length navigation methods such as zoom, and pan render maps and layers overlay, override, and theme maps customize your map with legends, watermarks, and other adornments. In the past, mapping required the use of many map layers and map definitions to access data. With the addition of the table model and repository, data access and mapping is independent. The tables define the data access, and the repository takes care of the table management. Therefore, with the Mapping Service, you are able to render maps and perform mapping operations without the worry of where the data is located. Service URLs The URL endpoint for the REST implementation of the Mapping Service has the following general form: http://hostname[:portnumber]/rest/spatial/mappingservice The URL endpoint for the SOAP implementation of the Mapping Service has the following general form: http://hostname[:portnumber]/soap/mappingservice The URL for the Mapping Service WSDL document has the following general form: http://hostname[:portnumber]/soap/mappingservice?wsdl The URL for the Mapping Service demo page has the following general form: http://hostname[:portnumber]/spatial/mappingservice/demopage.html Documentation Named Resource Service The Named Resource Service provides the ability to work with resources in the repository. It provides a set of common operations that you can use to add, list, update, delete, and search resources in the repository. The advantage of this is that you can administer the repositories resources at the service level, with a simple SOAP API that allows you to manage your content. The Named Resource Service provides operations that: list all resources (or a subset) in the repository add a resource to the repository modify a resource that exists in the repository delete a resource from the repository read a resource from the repository to return the definition search for resources in the repository 26 Spectrum Technology Platform 9.0

Chapter 4: Working With Spatial Services Service URLs The URL endpoint for the Named Resource Service has the following general form: http://hostname[:portnumber]/soap/namedresourceservice The URL for the Named Resource Service WSDL document has the following general form: http://hostname[:portnumber]/soap/namedresourceservice?wsdl The URL for the Named Resource Service demo page has the following general form: http://hostname[:portnumber]/spatial/namedresourceservice/demopage.html Catalog Service for the Web The Catalog Service for the Web (CSW) provides the ability to search, retrieve, and update collections of descriptive information (metadata) about geospatial data, services, and related resources. Catalogs are used to register metadata that conform to a specific information model or standard. You then have the ability to search for geospatial data and services in very efficient ways. The CSW provides operations that: describe the service capabilities describe the information models (schema) supported by the catalog search within the catalog get records based on a particular ID insert, update, or delete catalog entries batch retrieval and conversion of metadata The Catalog Service for the Web is an OGC-compliant web service. Service URLs The URL endpoint for the POST/GET implementation of the Catalog Service for the Web has the following general form: http://hostname[:portnumber]/rest/spatial/csw The URL endpoint for the SOAP implementation of the Catalog Service for the Web has the following general form: http://hostname[:portnumber]/soap/cswservice The URL for the Catalog Service for the Web WSDL document has the following general form: http://hostname[:portnumber]/soap/cswservice?wsdl The URL for the Catalog Service for the Web demo page has the following general form: http://hostname[:portnumber]/spatial/cswservice/demopage.html Spectrum Spatial Developer Guide 27

Accessing Location Intelligence Module Services Web Feature Service The Web Feature Service is used for searching, obtaining metadata descriptions, querying, and filtering spatial data (feature types) at the service level. The XML interface and syntax follow the WFS 1.0.0 OGC specification. Both SOAP and HTTP POST/GET requests are supported. As a result, a standard compliant WFS client, such as MapInfo Professional, can access data by submitting an XML request through HTTP to display it on a map or to get vector geometries for calculations. Use the Web Feature Service to help perform a search for features within a given distance from a point (or other type of geometry). For example, a real estate application determines a realistic value for a home by comparing the distance of it to numerous features, including railroad tracks, highways, shopping malls, and police stations. This application would call WFS to select a highway feature and a home (a point). The application would then calculate distance values for proprietary rating calculations. The Web Feature Service is an OGC-compliant web service. Service URLs The URL endpoint for the Web Feature Service has the following general form: http://hostname[:portnumber]/rest/spatial/wfs Web Map Service The Web Map Service (WMS) allows software clients to reference map images over the Internet or a private intranet. The WMS implementation is based on the WMS 1.1.1 and 1.3.0 OGC specification. Using HTTP requests, the WMS provides georeferenced data to a client that displays this data as an image. Georeferenced data is information associated with maps that describe the real world extents of specific features and the projection upon which it is based. The images can be provided as GIF, JPEG, PNG, and other image formats. The Web Map Service is an OGC-compliant web service. Service URLs The URL endpoint for the Web Map Service has the following general form: http://hostname[:portnumber]/rest/spatial/wms Accessing Location Intelligence Module Services There are two distinct ways to access the services provided by the Location Intelligence Module. The first way is to construct a dataflow in Enterprise Designer that includes one or more Location Intelligence Module stages. The second way is to submit an HTTP request directly to a Location Intelligence Module web service, from either a web browser or from a client application. Each of these two ways is discussed in the following sections. 28 Spectrum Technology Platform 9.0

Chapter 4: Working With Spatial Services Via Stages To access Location Intelligence Module services via stages, you build and run a dataflow in Enterprise Designer that includes one of more Location Intelligence Module stages. The stages use a direct socket-based method to communicate with the corresponding Location Intelligence Module services. The following Location Intelligence Module stages are available in the Enterprise Designer: Closest Site Determines which sites are closest to a given location. Find Nearest Locates the points of interest (POI) that are nearest to a given location. Point In Polygon Determines whether or not a location resides in a given area. Query Spatial Data Allows you to query a spatial database using spatial functions as well as standard SQL functions. Read Spatial Data Allows you to access spatial data in a variety of commonly-used spatial data formats. Spatial Calculator Performs a variety of calculations on spatial data, such as determining the area of a polygon, determining the distance between two points, or measuring the perimeter of an area, among other functions. Spatial Union Returns a geometry object which represents the union of two input geometry objects. Write Spatial Data Allows you to insert data into a named table as output of a job. For more information about these stages, see the the Stages section in the Spectrum Technology Platform Spectrum Spatial Guide on support.pb.com. Via Web Services To access Location Intelligence Module services via the web services, you construct an HTTP request and submit it directly to the web service. The HTTP request can be in the form of a SOAP request, a REST request, or a POST/GET request, and can be submitted directly from a web browser or from a client application. The Location Intelligence Module services are exposed as the following web services: Feature Service Provides the ability to search spatial databases. Geometry Service Provides a simplified interface to perform Geometry Service measurements, conversions, and operations. Map Tiling Service Generates map tiles that can be combined to form larger map images. Mapping Service Provides a simplified interface to perform Mapping Service rendering, themes, overlays, and conversions. Named Resource Service Provides the ability to work with resources in the Location Intelligence Module repository. Catalog Service for the Web * Enables an application to publish and search collections of descriptive information (metadata) for data, services, and related information. Web Feature Service * Used for searching, obtaining metadata descriptions, querying, and filtering spatial data (feature types) at the service level. Web Map Service * Enables software clients to reference map images over the Internet or a private intranet. For more information about each of the web services listed above, see Learning More About the Web Services on page 24. Request Types Depending on the web service, you can submit an HTTP request to a Location Intelligence Module web service in one of the following forms: a SOAP request a REST request a POST/GET request * Indicates an OGC-compliant web service. Spectrum Spatial Developer Guide 29

Accessing Location Intelligence Module Services SOAP is short for Simple Object Access Protocol. A SOAP request message must be in the XML format that is defined by the SOAP specification. REST is short for Representational State Transfer. A REST request message is contained in the query string parameters of an HTTP request. A POST/GET request message can be structured either as query string parameters submitted via HTTP GET, or as an XML-formatted message submitted via HTTP POST. The XML-formatted message is identical to a regular SOAP request, but with the SOAP XML wrapper removed. Many of the web services can accept requests in more than one form. For example, the Feature Service can accept either a SOAP request or a REST request. Some services, however, can accept a request in only one form. For example, the Map Tiling Service can accept only a REST request, and the Web Map Service can accept only a POST/GET request. The following table lists the types of request that each web service can accept. Web Service SOAP REST POST/GET Feature Geometry Map Tiling Mapping Named Resource Catalog Service for the Web * Web Feature * Web Map * Web Service Documentation To see the documentation for each Location Intelligence Module web service, refer to the the Services section in the Spectrum Technology Platform Spectrum Spatial Guide on support.pb.com. Using a Client Application This section describes the steps required to create a client application (such as a Java client) that accesses the Location Intelligence Module web services using SOAP requests. About Stub Code To create a client application that can invoke the Location Intelligence Module web services, you use a tool to generate the stub code for the application. The tool generates the stub code from the web service operations described in a service's Web Services Language (WSDL) document. Once the stub code has been generated, its methods provide a proxy for the web service operations. WSDL URLs To generate the stub code for your client application, you need to tell your stub code generator where to find the web service's WSDL document. The URLs for the WSDL documents will vary from installation to installation, but all installations have the following basic patterns: http://on.premise.domain/soap/mappingservice?wsdl http://on.premise.domain/soap/featureservice?wsdl http://on.premise.domain/soap/geometryservice?wsdl http://on.premise.domain/soap/namedresourceservice?wsdl http://on.premise.domain/soap/cswservice?wsdl * Indicates an OGC-compliant web service. 30 Spectrum Technology Platform 9.0

Chapter 4: Working With Spatial Services Generating Stub Code for a Java Client Use the following steps to generate the stub code for a Java web services client application, using the wsimport tool that is included with the Java Development Kit. 1. Open an xterm or command prompt window and change to the directory that contains the wsimport program, usually JDK_install_dir/bin/. 2. At the command prompt, type wsimport -s source_dir -d classes_dir URL_TO_WSDL and press Enter. For example, to generate stub classes for the SAAS version of the Named Resource Service, you might enter the following command: wsimport -s output/source -d output/classes http://dev.pb.com/namedresourceservice/services/namedresourceservice?wsdl After the command has been executed, the generated source.java files are placed within the directory you specified with the -s option, and the compiled.class files are placed within the directory you specified with the -d option. Adding a Web Reference in Eclipse To develop Java programs that consume Location Intelligence Module web services in Eclipse, you first create a reference to the web service in your Java project. When the reference is created, the client-side stub code required to use the web service is generated. 1. Start Eclipse. 2. On the File menu, select New > Project. The New Project wizard opens. 3. In the New Project wizard, select Java > Java Project. Click Next. 4. In the Project Name field, enter the name you want to give your project. Click Finish to close the wizard. The new project folder appears in the Package Explorer. 5. In the Package Explorer, right-click on the project folder you created in the previous step. On the pop-up menu, select New > Other. The New wizard opens. 6. In the New wizard, select Web Services > Web Service Client. Click Next. 7. In the Service Definition field, enter the URL to the web service's WSDL document. Select Develop Client on the slider bar. Click Finish to close the wizard. The stub code for the web service is generated in the project folder. Adding a Web Reference in Visual Studio Before you can use web reference facilities in your C# program code, you must first add the web reference to your Visual Studio project. Use the following steps to add a web reference to any of the Location Intelligence Module web services. 1. Start Visual Studio. 2. On the File menu, select New > Project. Spectrum Spatial Developer Guide 31

Accessing Location Intelligence Module Services The New Project dialog box opens. 3. In the New Project dialog box, enter the desired settings, then click OK. 4. In the Solution Explorer pane, right-click on References. On the pop-up menu, select Add Web Reference. The Add Web Reference dialog box opens. 5. In the Add Web Reference dialog box, enter the URL to the web service's WSDL document. After you have entered the URL, click the Go button. Documentation for the web service then appears under the URL field. 6. In the Add Web Reference dialog box, note the web reference name provided in the Web Reference Name field, then click the Add Reference button. The web reference is added to the project. After you have completed these steps, you can see the new web reference in the Solution Explorer pane. Using a Browser-based Application You can create powerful mapping applications that run entirely in a web browser, using the RIA controls installed with Spectrum Technology Platform. See Working with RIA Controls on page 33 for a description of the RIA controls and how to get started using them in your web applications. 32 Spectrum Technology Platform 9.0

Working with RIA Controls 5 You can create powerful mapping applications that run entirely in a web browser, using the RIA controls installed with Spectrum Technology Platform. This section describes what the RIA controls are, and how to get started using the RIA controls in your web applications. In this section: What Are the RIA Controls?........................34 Getting Started with the RIA Controls...............34 Developing with the RIA Controls...................35 Using the RIA Proxy..............................35

What Are the RIA Controls? What Are the RIA Controls? The RIA (Rich Internet Application) controls provide a set of browser-based user interface components for easily embedding maps and other location-based capabilities in web pages. A JavaScript API is also provided which, together with the user interface components, enable you to create custom browser-based mapping applications. The RIA controls can be used in a wide range of scenarios, from simply embedding maps in your web site to show locations, to creating rich web applications. Built entirely in JavaScript, the controls work without the need for any browser plug-ins and without having to write any server-side code. The RIA controls use Web 2.0 techniques to provide functionality such as seamless map panning and the ability to search and display information without requiring a web page refresh. The following controls are available: Control LegendControl FeatureService MultiTableFeatureService OpenLayers layer types Generic data formatting REST Services A user interface control containing descriptive information about features appearing on a map. It also provides the means to show and hide individual overlays on a map. A non-user interface control, that lets developers write Javascript code to call the FeatureService REST API. This control can be used to query tables for features. Search results are returned as GeoJSON FeatureCollections. The search call is performed asynchronously. A non-user interface control, that lets developers make FeatureService REST calls against multiple tables simultaneously. This is a convenience class, allowing a feature search on multiple tables which is useful when a feature search is triggered by interactions with a map, that typically display the features of multiple tables stacked on top of each other. For example, a SearchNearest against TABLE1 and TABLE2 at a given point (x,y). An easy way to display either a MappingService NamedMap or a TileService map tile on an OpenLayers map. Template formatting controls for developers to display JSON data in an OpenLayers popup (for example) but intelligently styled. For example, a Table name underlined, field names in italics, and field values in bold. REST-ful service control for developers to send cross-domain calls to the REST services. These calls will be performed as asynchronous XMLHttpRequest calls. Getting Started with the RIA Controls The RIA controls are installed with Spectrum Technology Platform. To get started using these controls, you are provided with the following: Java Servlet Proxy download located at http://localhost:8080/ria-examples/riaproxy/riaproxy.war IIS (.NET) Proxy download located at http://localhost:8080/ria-examples/riaproxy/riaproxy.zip Controls JavaScript hosted at http://localhost:8080/ria/ria.js JavaScript API Documentation hosted at http://localhost:8080/ria/api/. RIA example application hosted at http://localhost:8080/ria-examples/. 34 Spectrum Technology Platform 9.0

Chapter 5: Working with RIA Controls Using these resources and the instructions provided in this guide, you will be able to get the RIA proxy installed in your environment, run the example RIA controls, and start developing your own RIA-control-based application. Note: To use the RIA controls with Bing Maps, including using the examples, you will need a Bing Maps key. To register, go to the Bing Maps Account Center. Developing with the RIA Controls To develop with the RIA controls on your own machine or to place applications developed with RIA controls on another server, you will need to install the RIA proxy. The following link from Yahoo provides background information on why proxy pages are needed: http://developer.yahoo.com/javascript/howto-proxy.html The RIA proxy is required to start working with the RIA controls. Simply reference the relevant JavaScript file hosted by Spectrum Technology Platform in your html pages, and the browser takes care of the rest. To get started developing an RIA-control-based application: 1. Install a web application server (for example, Tomcat) on your machine. 2. Create a new service folder in your webapps (or equivalent) directory of your newly installed application server for your application (for example, a folder called "myapp" located in C:\apache-tomcat-7.0.39\webapps). 3. Download the riaproxy.war file from Spectrum Technology Platform and copy it to your webapps (or equivalent) directory to install it. For information on how to download and install the RIA proxy, and on why you must use the proxy, see Using the RIA Proxy on page 35. For information on how to use the RIA proxy with your web application, see Using the RIA Proxy in your Web Application on page 38. 4. Restart your application server. 5. Create your application pages in the service folder that you created in the webapps (or equivalent) directory, using the functionality of the Spectrum Technology Platform JavaScript API. You can use the RIA examples that ship with Spectrum Technology Platform as a starting point for your application. View the page source of the examples here: http://localhost:8080/ria-examples/. a) Save the source to the myapp folder you created above. For example, to include searchnearest in your application, right-click in the Search Nearest content frame to display the source. b) Rename the.jsp file to index.htm. c) Edit proxy.properties to contain the following: trusted.base.url=https://<yourspectrumspatialserverhost_port> auth.type=basic anonymous_username=guest d) Restart Tomcat and browse to your application at http://localhost:8080/myapp Using the RIA Proxy Several RIA controls depend on a server side component to be fully functional. For example, the FeatureService calls a server in order to query spatial data that isn't directly available in the browser. However, due to security restrictions that are put in place by all modern browsers, it is not possible to call any arbitrary server on the web. The RIA controls require a proxy in order to work around those security restrictions. The following sections describe why this is necessary and how a proxy can be used for your own application development. Spectrum Spatial Developer Guide 35

Using the RIA Proxy Installing the RIA Proxy Spectrum Technology Platform ships with two proxy implementations, one for Java Servlet containers (2.4 and higher) and one for IIS. Decide which proxy to install, then verify the installation was successful. Java Servlet Proxy To install the Java Servlet proxy: 1. Download the proxy binary from your Spectrum Technology Platform installation at: http://localhost:8080/ria-examples/riaproxy/riaproxy.war. 2. Deploy the WAR file to a web application server of your choice. Refer to the documentation of the application server for details on deploying WAR files. If you are using Apache Tomcat, this involves copying the WAR file into the %CATALINA_HOME%\webapps directory. As long as automatic application deployment is enabled and you keep the WAR file name intact, the proxy will be made available under the default context path of riaproxy. Note: If you decide to deploy the proxy under a different context path, be sure to provide the correct value when following the step to define the path to the proxy in your web application. This step is defined in the section: Define the Path to your Proxy on page 38 3. Once the proxy has been installed, set a trusted base URL. URLs that do not start with this value will not be relayed by the proxy. This is necessary to prevent the proxy from being abused to request resources from other domains than the one required by the RIA controls. To configure this: a. Open the proxy.properties file located within the..\riaproxy\web-inf folder (for example, C:\apache-tomcat-7.0.39\webapps\riaproxy\WEB-INF). b. Set the value of the trusted.base.url property to http://servername, where servername is a placeholder for the hostname RIA is installed on; for example, trusted.base.url=http://localhost:8080. c. Restart the proxy application. 4. To enable HTTP Basic Authentication, set the following properties in the proxy.properties file, replacing username and password with the actual login credentials to be used by the proxy: a. auth.type=basic b. anonymous_username=username c. anonymous_password=password Note: This performs HTTP basic authentication against the RIA server-side component on behalf of but transparent to the client. Requests by the client to the proxy are not protected and additional steps have to be taken if that is necessary. Refer to the documentation of your application server for further details. IIS Proxy The IIS proxy requires IIS6 or IIS7. If IIS7 is installed, it is also necessary to install the IIS6 Compatibility Components. A description of how to install these components can be found here: http://technet.microsoft.com/en-us/library/bb397374(v=exchg.80).aspx. To install the IIS proxy: 1. Download the proxy binary from your Spectrum Technology Platform installation at: http://localhost:8080/ria-examples/riaproxy/riaproxy.zip. 2. Unzip the file and run setup.exe to install the proxy into IIS. You can deploy it to a web application server of your choice. Refer to the documentation of the application server for details on deploying WAR files. Note: The configuration of the IIS proxy is equivalent to the Java Servlet proxy, in that you need to configure the base URL and authentication. The only difference is the configuration file is 36 Spectrum Technology Platform 9.0

Chapter 5: Working with RIA Controls located at \ProxyService\Web.config. The Web.config file is an XML file and configuration properties are set with <add> elements nested inside the <appsettings> element of the file; for example, <add key= trusted.base.url value=http://localhost:8080/>. Verification Once you have installed the proxy and set it to forward the requests to the RIA application, you can test it by accessing the RIA JavaScript file, ria.js directly and through the proxy. Suppose RIA is installed on 'myserver' on port 8070 and the proxy is installed on the localhost using the default name of riaproxy on default port 80, the two URLs are as shown below: http://myserver:8070/ria/ria.js http://localhost/riaproxy/proxy.aspx?url=http%3a%2f%2fmyserver%3a8070%2fria%2fria.js Compare the pages loaded by the two URLs and make sure they are same. Why Use the RIA Proxy? The same-origin policy is a security restriction on what web content JavaScript code can interact with. Essentially, it dictates that a running script can only interact with data coming from the same origin as the server hosting the page or application upon which the code is running. This is especially important for applications using AJAX (Asynchronous JavaScript and XML) techniques like RIA controls as it means that our requests may only be made back to the host server. The RIA controls require a proxy in order to work around those security restrictions. The following sections describe why this is necessary and how a proxy can be used for your own application development. Origin Concept The origin in the same-origin policy means the same host, but there are a few specifics that should be noted. The following table illustrates whether the same origin when compared with a base origin of www.example.com: URL http://www.example.com/dir/page.html http://www.example.com/dir2/other.html http://www.example.com:81/dir2/other.html https://www.example.com/dir2/other.html http://en.example.com/dir2/other.html http://example.com/dir2/other.html http://v2.www.example.com/dir2/other.html Same-Origin true true false false false false false Note Same protocol and host Same protocol and host Same protocol and host but different port Different protocol Different host Different host (exact match required) Different host (exact match required) Why is this Important? In order to host applications on a different machine than directly on the server hosting RIA controls, we need a way to bypass the same-origin policy. This is particularly useful during application development, where developers typically want to run their code on a local machine. The local machine will typically use a hostname of localhost, or a machine name, and the server with the controls will have a different hostname, therefore and entirely different origin. To achieve this, a proxy has been provided that will forward requests to a remote host and appear to the browser to still be in the domain. The Java proxy can be deployed to any Java servlet container that implements the Servlet 2.4 specification or higher. The proxy simply takes a URL as a parameter and requests the page, passing the contents back to the requester. Given the proxy is installed on a server of a local machine on port 80, you can access the Spectrum Spatial Developer Guide 37

Using the RIA Proxy web page http://myserver:8765/some/path/example.html by calling http://localhost/riaproxy?url=http://myserver:8765/some/path/example.html. The result sent by the proxy will be the same as if the target URL was accessed directly. The important difference is the second URL will be seen by a browser as part of the local domain http://localhost/ instead of http://myserver:8765/. Please note that the URL parameter needs to be encoded properly to follow the syntax rules of Internet URLs (conf. RFC 1738: Uniform Resource Locators). Using the RIA Proxy in your Web Application This section describes how to use the RIA proxy in your web application. Import ria.js The first step is to import OpenLayers and the main RIA JavaScript library. This can be done as follows: <script type="text/javascript" src="http://localhost:8080/ria/openlayers/openlayers.js"></script> <script type="text/javascript" src="http://localhost:8080/ria/ria.js"></script> Replace localhost:8080 with the actual hostname and port number RIA is installed on. Define the Path to your Proxy To indicate that cross-domain calls should be routed through a proxy, the path to the proxy has to be registered like this: ria.restservice.addproxy("/riaproxy?url="); Rather than calling a URL to a different domain directly, the RIA library code will append the encoded URL to the end of the path registered above and use the result to perform the request. The proxy takes the URL from the request parameter (by default url), requests the resource associated with it and sends the result back to the RIA library code without any modifications. The exact path passed to the addproxy() method depends on which proxy is being used and how the proxy was deployed. Note: The path above is the default for the Java Servlet proxy. For the IIS proxy, use the path /riaproxy/proxy.aspx?url=. Code Sample A simple page for performing a Feature Search: <!DOCTYPE html> <html> <head> <script src="http://localhost:8080/ria/openlayers/openlayers.js"></script> <script src="http://localhost:8080/ria/ria.js"></script> </head> <body> <button onclick="search();">search</button> <script> ria.restservice.addproxy("/riaproxy?url="); function search() { var fs = new ria.search.featureservice( "http://localhost:8080/rest/spatial/featureservice"); var d = fs.searchnearest({ 38 Spectrum Technology Platform 9.0

Chapter 5: Working with RIA Controls 47.813155), table: "/Samples/NamedTables/WorldcapTable", geometry: new OpenLayers.Geometry.Point(12.875977, srs: "epsg:4326", attributes: ["Capital"], withindistance: "2000 mi", distanceattributename: "dist", maxfeatures: 10 ); d.addcallback(function(result) {alert(result.features.length + " result(s)")); </script> </body> </html Test this sample web application by viewing it in your browser and clicking Search. A dialog appears that displays the results of the Feature Search: In a web debugger such as Fiddler, you can see a listing of the 10 results: {"type":"featurecollection","metadata":[{"type":"string","name":"capital", {"type":"double","name":"dist"],"features":[{"type":"feature","properties" :{"Capital":"Ljubljana","dist":143.84489998699985,{"type":"Feature","properties" :{"Capital":"Vienna","dist":161.4848812627603,{"type":"Feature","properties" :{"Capital":"Vaduz","dist":163.332701859974,{"type":"Feature","properties" :{"Capital":"Prague","dist":173.87473824107374,{"type":"Feature","properties" :{"Capital":"Bratislava","dist":198.09553406882614,{"type":"Feature","properties" :{"Capital":"Zagreb","dist":201.31855154101802,{"type":"Feature","properties" :{"Capital":"Bern","dist":260.92616074609,{"type":"Feature","properties" :{"Capital":"San Marino","dist":267.4791030110629,{"type":"Feature","properties" Spectrum Spatial Developer Guide 39

Using the RIA Proxy :{"Capital":"Budapest","dist":290.00905102083885,{"type":"Feature","properties" :{"Capital":"Berlin","dist":325.56576583498344] 40 Spectrum Technology Platform 9.0

Working With REST Services 6 This chapter describes the REST services and how you can access them. In this section: What Are the REST Services?......................42 Mapping REST Interface...........................43 Feature REST Interface...........................66 Map Tiling REST Interface.........................80 Common Data Types.............................85

What Are the REST Services? What Are the REST Services? The REST services are a set of services you can call in your web application to access the functionality of Spectrum Technology Platform. There are three services that can be accessed using a REST API: The Mapping Service provides a simplified interface to perform Mapping Service rendering, legends, and resource queries. The Mapping Service provides both simple operations that are more frequently used, or more complex operations that require higher levels of customization. The Feature Service provides the ability to search spatial databases, and named resources within the repository. It provides a set of common operations that you can use to query content, regardless of the underlying data provider. The Map Tiling Service dynamically generates subsets of a map on a per-request basis. This subset is called a tile. The tiles generated from the MapTiling Service can be used individually, or combined to form larger maps, in applications for seamless map interaction. This service provides fast, simple, light-weight map rendering. REST Interfaces The REST interfaces are what you use to access the Spectrum Technology Platform functionality from within your web application. The following table describes which REST Interface you use to access a particular service. To access this service... Mapping Service Feature Service Map Tiling Service Use this REST Interface... Mapping REST Interface on page 43 Feature REST Interface on page 66 Map Tiling REST Interface on page 80 To get more detailed descriptions of the REST services, see the spatial REST interface WADL on your system: http://localhost:8080/rest/spatial?_wadl&_type=xml The REST API is essentially just a set of URLs your web application can send as HTTP GET requests. Each URL defines a request to a particular method of a particular interface. Your application then gets back a response, usually in the form of a JSON object or map image, from the corresponding REST Interface. The returned JSON object can be parsed by your web application to extract and process the requested information. Using the Spectrum Technology Platform REST API Using the REST API in your web application is a two-step process: 1. Build the URL you need to make an interface request (and send it via HTTP GET). 2. Process the contents of the JSON object or image returned in the interface response. The REST API defines the format of the URLs needed to make interface requests, and the format of the JSON objects returned in the response. Request URL Format The URL of a REST API request has the following general form: http://host:port/rest/spatial/servicename/pathparam;matrixparam&queryparam Where: 42 Spectrum Technology Platform 9.0

Chapter 6: Working With REST Services host is the hostname of the server hosting the services. port is the optional TCP port number (if the services do not receive requests via the default HTTP port). ServiceName is the name of the service you are requesting. For example MappingService, FeatureService, or MapTilingService. pathparams is the name of a resource or method or inline parameter you are requesting. matrixparam is a parameter being passed to the interface method to set an attribute. queryparam is a parameter used to modify the structure or information displayed in the output. Note: The example request URLs in this guide have been encoded with spaces (%20) and colons (%3A) for direct use. Mapping REST Interface This section introduces the Mapping REST API. It describes what the Mapping REST API is, and how you use the REST API to access the services provided by Spectrum Technology Platform. Methods This section describes the methods that are available in the Mapping REST Interface. List Named Maps Returns a list of named maps that are available within the repository. HTTP GET URL Format The following format is used for HTTP GET requests: HTTP GET /maps.rep;[l=locale] Parameters For information on the parameter types listed below, see Request URL Data Types on page 85. Parameter Type Required rep String yes The representation to be returned. Supported representation is JSON. l=locale String no The locale in which to return the map information. Uses the Java Locale format consisting of an ISO two letter language code and an ISO two letter country code. If not specified then assumes server default. Returns Returns a list of maps in the specified format. Spectrum Spatial Developer Guide 43

Mapping REST Interface Example This example returns a list of available maps in the repository, as an array of String values, in the Locale English (US). http://www.pbbi.com/rest/spatial/mappingservice/maps.json;l=en_us The following example shows the format of the JSON object returned in the response: { "Maps": [ "/Samples/NamedMaps/MapWithBarLayer", "/Samples/NamedMaps/CountriesWithShapeTable", "/Samples/NamedMaps/MapWithLayerStyle", "/Samples/NamedMaps/MapWithLayer", "/Samples/NamedMaps/MapWithPieLayer", "/Samples/NamedMaps/WorldMap", "/Samples/NamedMaps/WorldWithGradSymLayer", "/Samples/NamedMaps/MapWithTable" ] Describe Named Map Returns the metadata of a specified named map for the Mapping Service. HTTP GET URL Format The following format is used for HTTP GET requests: HTTP GET /maps/mapname.rep;[l=locale] Parameters For information on the parameter types listed below, see Request URL Data Types on page 85. Parameter Type Required mapname String yes The name of the named map to return the metadata for. The map is specified by a regex for the named map based on the location of the named map in the repository. The name of the named map is defined between the /maps portion of the URL and the.rep portion of the URL. For example, to get the metadata for a named map located in the /Samples/NamedMaps directory in the repository, the following URL would be used: http://.../maps/samples/namedmaps/mapname.json;... rep String yes The representation to be returned. Supported representation is JSON. 44 Spectrum Technology Platform 9.0

Chapter 6: Working With REST Services Parameter Type Required l=locale String no The locale in which to return the map information. Uses the Java Locale format consisting of an ISO two letter language code and an ISO two letter country code. If not specified then assumes server default. Returns Returns metadata for a named map in the repository. Example Returns the metadata for the map WorldMap located in the /Samples/NamedMaps directory in the repository, in the Locale English (US). http://www.pbbi.com/rest/spatial/mappingservice/maps/samples/namedmaps/worldmap.json;l=en_us The following example shows the JSON object returned in the response: { "Map":{ "Version":"1.0", "Name":"/Samples/NamedMaps/WorldMap", "Layers":[ { "NamedLayer":{ "Name":"/Samples/NamedLayers/WorldFeatureLayer", "":"World Countries", "NamedTableRef":"/Samples/NamedTables/WorldTable", "Renderable":true, ] Render Named Map Resource URLs specified in this class are relative to a root declared in the web.xml. Currently, the root is /rest. For example, to get an image of a named map the URL would look like: http://www.pbbi.com/rest/spatial/mappingservice/ maps/worldmap/image.png;w=640;h=480;z=2000%20mi;c=0,0,epsg%3a4326 Rendering a named map is used when you want to obtain a view of a named map as an image, by specifing the named map, the representation (e.g. gif), the dimensions of the raster and a view represented as either a center and zoom, a center and scale or a bounding box. Optionally, you may specify the locale, resolution (DPI), type of rendering (Speed or Quality), whether or not to ignore issues with rendering underlying layers, the background color and opacity, as well as provide authorization (security) information. Example Render the world countries with a translucent blue background: http://www.pbbi.com/rest/spatial/mappingservice/maps/namedmaps/countriesmap/image.png;w=256;h=256; b=-180,-90,180,90,epsg:4326;bc=0048ff;bo=.5 Spectrum Spatial Developer Guide 45

Mapping REST Interface Render the world with high quality and fail on exceptions: http://www.pbbi.com/rest/spatial/mappingservice/maps/namedmaps/worldmap/image.png;w=256;h=256; b=-180,-90,180,90,epsg:4326;rd=q; The following rules in priority order determine how the rendering view is created: if the center and zoom is specified then all other parameters governing the view are ignored if the center and scale is specified then all other parameters governing the view are ignored if the bbox is specified then that is used if none of these requirements are satisfied then an HTTP code of 404 (Not Found) will be returned The URL is specified with a regex for the named map to render. This is because the URL will be dynamic based on the location of the named map in the repository. The name of the named map occurs between the /maps portion of the URL and the /image.{rep portion of the URL. For example, to render a named map located at /earth/europe in the repository, the following URL would be used: http://www.pbbi.com/rest/spatial/mappingservice/maps/earth/europe/image.png;... Rendering named maps can be performed in the following ways: Render Named Map Given a Center and Zoom Returns an image of a map in the format specified at a specified location and zoom. HTTP GET URL Format The following format is used for HTTP GET requests: HTTP GET /maps/map name/image.image type;w=width;h=height;c=x,y,srs; z=zoom;[r=resolution];[l=locale]/ Parameters For information on the parameter types listed below, see Request URL Data Types on page 85. Parameter Type Required map name String yes The name of the map to render. The map is specified by a regex for the named map to render based on the location of the named map in the repository. The name of the named map is defined between the /maps portion of the URL and the /image.image type portion of the URL. For example, to render a named map located at /earth/europe in the repository, the following URL would be used: http://.../maps/earth/europe/image.png;... image type String yes The type of image to return (gif, png, jpg, bmp, jpeg, or tiff) w=width Integer yes Width of the image in pixels h=height Integer yes Height of the image in pixels c=x, y, srs Double, Double, String yes The center of the view in geographic coordinates consisting of a x, y position and the srs name (spatial reference system). 46 Spectrum Technology Platform 9.0

Chapter 6: Working With REST Services Parameter Type Required z=zoom Integer, String yes The Zoom, or distance across the view in linear units. The zoom is represented by a string with a number followed by one or more spaces followed by an linear unit abbreviation (e.g., mi, km, m, etc). r=resolution Integer no The DPI resolution of the map as an integer. DPI measures the resolution of map images in dots per inch (the number of individual dots that can be placed within the span of one linear inch). If not specified then assumes server default. l=locale String no The locale in which to render the map. Uses the Java Locale format consisting of an ISO two letter language code and an ISO two letter country code. If not specified then assumes server default. cx=continue on exception Boolean no Deprecated. Defines whether the issues with rendering of underlying layers should be ignored or not. By default, the layer issue will be ignored. Unlike the SOAP API, no details of the error are returned. rd=rendering String no The type of rendering to perform, which can be either s (Speed,without anti-aliasing) or q (Quality, with anti-aliasing). The default value is s. bc=background color String no The background color to use for the map image, as expressed in RRGGBB format. If not supplied, the background color will be transparent. Note: Unlike with the SOAP API, a leading # should not precede the hexadecimal web color. bo=background opacity Double no The opacity of the background color. If the background and backgroundopacity attributes are specified, these values will be used to draw the background. If the background is not used, then the background will be totally transparent regardless of the backgroundopacity attribute. If the background is used but no opacity is specified, then the background will be totally opaque. Returns Returns an image in the specified format. Example Render a named map as a PNG that is 640 x 480 pixels in dimension, the map is centered at (-2.5, 38.5) in WGS 84, the view is 500 miles across, the DPI is 96 and the Locale is English (US). http://www.pbbi.com/rest/spatial/mappingservice/maps/samples/namedmaps/worldmap/ image.png;w=640;h=480;c=-2.5,38.5,epsg%3a4326;z=500%20mi;r=96;l=en_us Spectrum Spatial Developer Guide 47

Mapping REST Interface Render Named Map Given a Center and Scale Returns an image of a map in the format specified at a specified location and scale value. HTTP GET URL Format The following format is used for HTTP GET requests: HTTP GET /maps/map name/image.image type;w=width;h=height;c=x,y,srs; s=scale;[r=resolution];[l=locale]/ Parameters For information on the parameter types listed below, see Request URL Data Types on page 85. Parameter Type Required map name String yes The name of the map to render. The map is specified by a regex for the named map to render based on the location of the named map in the repository. The name of the named map is defined between the /maps portion of the URL and the /image.image type portion of the URL. For example, to render a named map located at /earth/europe in the repository, the following URL would be used: http://.../maps/earth/europe/image.png;... image type String yes The type of image to return (gif, png, jpg, bmp, jpeg, or tiff) w=width Integer yes Width of the image in pixels h=height Integer yes Height of the image in pixels c=x, y, srs Double, Double, String yes The center of the view in geographic coordinates consisting of a x, y position and the srs name (spatial reference system). s=scale Integer yes The map view will be zoomed to the specified scale. The scale value is used to compare map and real world distance values. For example, if a value of 1000 is specified, the map scale is 1:1000 (1 map unit is equal to 1000 real world units). r=resolution Integer no The DPI resolution of the map as an integer. DPI measures the resolution of map images in dots per inch (the number of individual dots that can be placed within the span of one linear inch). If not specified then assumes server default. l=locale String no The locale in which to render the map. Uses the Java Locale format consisting of an ISO two letter language code and an ISO two letter country code. If not specified then assumes server default. cx=continue on exception Boolean no Deprecated. Defines whether the issues with rendering of underlying layers should be ignored 48 Spectrum Technology Platform 9.0

Chapter 6: Working With REST Services Parameter Type Required or not. By default, the layer issue will be ignored. Unlike the SOAP API, no details of the error are returned. rd=rendering String no The type of rendering to perform, which can be either s (Speed,without anti-aliasing) or q (Quality, with anti-aliasing). The default value is s. bc=background color String no The background color to use for the map image, as expressed in RRGGBB format. If not supplied, the background color will be transparent. Note: Unlike with the SOAP API, a leading # should not precede the hexadecimal web color. bo=background opacity Double no The opacity of the background color. If the background and backgroundopacity attributes are specified, these values will be used to draw the background. If the background is not used, then the background will be totally transparent regardless of the backgroundopacity attribute. If the background is used but no opacity is specified, then the background will be totally opaque. Returns Returns an image in the specified format. Example Render a named map as a PNG that is 640 x 480 pixels in dimension, the map is centered at (-2.5, 28.5) in WGS 84, the view has a scale of 10000000, the DPI is 96 and the Locale is English (US). http://www.pbbi.com/rest/spatial/mappingservice/maps/samples/namedmaps/worldmap/ image.png;w=640;h=480;c=-2.5,38.5,epsg%3a4326;s=10000000;r=96;l=en_us Render Named Map Given a Bounding Box Returns an image of a map in the format specified of a specified area defined by a box. HTTP GET URL Format The following format is used for HTTP GET requests: HTTP GET /maps/map name/image.image type;w=width;h=height;b=x1,y1,x2,y2,srs; [r=resolution];[l=locale]/ Parameters For information on the parameter types listed below, see Request URL Data Types on page 85. Spectrum Spatial Developer Guide 49

Mapping REST Interface Parameter Type Required map name String yes The name of the map to render. The map is specified by a Regex for the named map to render based on the location of the named map in the repository. The name of the named map is defined between the /maps portion of the URL and the /image.image type portion of the URL. For example, to render a named map located at /earth/europe in the repository, the following URL would be used: http://.../maps/earth/europe/image.png;... image type String yes The type of image to return (gif, png, jpg, bmp, jpeg, or tiff) w=width Integer yes Width of the image in pixels h=height Integer yes Height of the image in pixels b=x1, y1, x2, y2, srs Double, yes Double, Double, Double, String The bounding box that defines the entire view in real world coordinates using opposing x, y corner positions and the srs name (spatial reference system). r=resolution Integer no The DPI resolution of the map as an integer. DPI measures the resolution of map images in dots per inch (the number of individual dots that can be placed within the span of one linear inch). If not specified then assumes server default. l=locale String no The locale in which to render the map. Uses the Java Locale format consisting of an ISO two letter language code and an ISO two letter country code. If not specified then assumes server default. cx=continue on exception Boolean no Deprecated. Defines whether the issues with rendering of underlying layers should be ignored or not. By default, the layer issue will be ignored. Unlike the SOAP API, no details of the error are returned. rd=rendering String no The type of rendering to perform, which can be either s (Speed,without anti-aliasing) or q (Quality, with anti-aliasing). The default value is s. bc=background color String no The background color to use for the map image, as expressed in RRGGBB format. If not supplied, the background color will be transparent. Note: Unlike with the SOAP API, a leading # should not precede the hexadecimal web color. bo=background opacity Double no The opacity of the background color. If the background and backgroundopacity attributes are specified, these values will be used to draw the background. If the background is not used, then the background will be totally transparent regardless of the backgroundopacity attribute. If the background is used but no opacity is specified, then the background will be totally opaque. 50 Spectrum Technology Platform 9.0

Chapter 6: Working With REST Services Returns Returns an image in the specified format. Example Render a named map as a PNG that is 640 x 480 pixels in dimension, the map is centered at (0, 0) in WGS 84 (defined by the bounding box), the DPI is 72 and the Locale is English (US) http://www.pbbi.com/rest/spatial/mappingservice/maps/samples/namedmaps/worldmap/ image.png;w=640;h=480;b=-10,-10,10,10,epsg%3a4326;r=72;l=en_us Get Legend for a Named Map Returns the complete legend of a named map by specifying the named map, the swatch size, and mime type of the legends. The legend is returned as single swatch rows, including a base 64 encoded image (or URL) and text description, that make up a complete legend. For each layer in the named map, zero, one, or more legend entries will be returned. HTTP GET URL Format The following format is used for HTTP GET requests: HTTP GET /maps/map name/legend.type;w=width;h=height;t=image type; [r=resolution];[l=locale]?[inlineswatch=boolean] Parameters For information on the parameter types listed below, see Request URL Data Types on page 85. Parameter Type Required map name String yes The name of the map to return the legend. The map is specified by a regex for the named map to render based on the location of the named map in the repository. The name of the named map is defined between the /maps portion of the URL and the /legend.legend type portion of the URL. For example, to render a named map located at /earth/europe in the repository, the following URL would be used: http://www.pbbi.com/rest/spatial/the name of the map to return the legend.mappingservice /maps/earth/europe/legend.png;... type String yes The type of information to return the legend (e.g., JSON) w=width Integer yes Width of the individual legend swatch in pixels h=height Integer yes Height of the individual legend swatch in pixels t=image type String yes The type of images to return for the legend swatches(e.g., gif, png, etc) Spectrum Spatial Developer Guide 51

Mapping REST Interface Parameter Type Required r=resolution Integer no The DPI resolution of the legend swatches as an integer. DPI measures the resolution of images in dots per inch (the number of individual dots that can be placed within the span of one linear inch). If not specified then assumes server default. l=locale String no The locale in which to render the legend. Uses the Java Locale format consisting of an ISO two letter language code and an ISO two letter country code. If not specified then assumes server default. inlineswatch=boolean Boolean no Determines if the swatch images are returned as data or URL to the image location on the server. By default all swatch images are returned as base64 encoded images in the JSON response (inlineswatch=true). To return swatch image URLs to the images located on the server, specify inlineswatch=false. Returns Returns an array of String values returned in a JSON response object that represent all the legend swatches for the named map. For each layer in the named map, zero, one, or more legend entries will be returned. The following response is one swatch description for a single layer in the named map. The image is returned as the default base64 encoded image. { "layername": "World Capitals", "rows": [ { "description": "Point", "swatch": "data:image/png,ivborw0kggoaaaans...y7+ftjg4yrzmuapmylgaanl52ml+8yeiaaaaasuvork5cyii=" ], "title": "World Capitals", "type": "CARTOGRAPHIC" The following response is the same swatch as above; however, a URL to the generated swatch image is returned (setting the inlineswatch parameter to false). { "layername": "World Capitals", "rows": [ { "description": "Point", "swatch": "http://www.pbbi.com/mappingservice/services/rest/maps/samples/namedmaps/mapwithlayer/ legends/0/rows/0/swatch/16x32.png" ], "title": "World Capitals", "type": "CARTOGRAPHIC" 52 Spectrum Technology Platform 9.0

Chapter 6: Working With REST Services Example Return the legend (swatches and information) for the MapWithLayer named map, located in the /Samples/NamedMaps directory in the repository, in JSON format. The swatches will be 32 x 16, in PNG format, and returned as base64 encoded images. http://www.pbbi.com/rest/spatial/mappingservice/maps/samples/namedmaps/mapwithlayer/ legends.json;w=16;h=32;t=png Return the legend (swatches and information) for the MapWithLayer named map, located in the /Samples/NamedMaps directory in the repository, in JSON format. The swatches will be 32 x 32, in gif format, and returned as URLs to the images located on the server. http://www.pbbi.com/rest/spatial/mappingservice/maps/samples/namedmaps/mapwithlayer/ legends.json;w=32;h=32;t=gif?inlineswatch=false Get a Swatch for a Layer Returns an individual swatch for a layer of a named map by creating the swatch URL that contains the named map, the legend (layer) and row index within the map, the swatch size, and mime type of the swatch. The swatch is returned as the actual inline image for the swatch on the server. HTTP GET URL Format The following format is used for HTTP GET requests: HTTP GET /maps/map name/legends/legend index/rows/row index/swatch/widthxheight.image type; [r=resolution];[l=locale] Parameters For information on the parameter types listed below, see Request URL Data Types on page 85. Parameter Type Required map name String yes The name of the map to return the swatch. The map is specified by a regex for the named map to render based on the location of the named map in the repository. The name of the named map is defined between the /maps portion of the URL and the /legends portion of the URL. For example, to render a named map located at /earth/europe in the repository, the following URL would be used: http://pbbi.com/rest/spatial/mappingservice/ maps/earth/europe/legends/... legend index Integer yes The legend to get the swatch from in the named map. Since most maps have multiple layers, you need to specify in which legend Spectrum Spatial Developer Guide 53

Mapping REST Interface Parameter Type Required the swatch is located. The first legend entry would be legend index 0 (zero). row index Integer yes The swatch location (row) within the legend. Since some layers have multiple swatches within a single legend, you need to specify the row for the specific swatch. The first swatch entry (row) in the legend will be 0 (zero). width Integer yes Width of the individual legend swatch in pixels height Integer yes Height of the individual legend swatch in pixels image type String yes The type of image to return the swatch(e.g., gif, png, etc) r=resolution Integer no The DPI resolution of the swatch as an integer. DPI measures the resolution of images in dots per inch (the number of individual dots that can be placed within the span of one linear inch). If not specified then assumes server default. l=locale String no The locale in which to render the swatch. Uses the Java Locale format consisting of an ISO two letter language code and an ISO two letter country code. If not specified then assumes server default. Returns Returns the specified swatch image. Example Return the swatch for the first legend and first row of the WorldMap named map, located in the /Samples/NamedMaps directory in the repository. The swatch will be 32 x 32 pixels, in PNG format, and a resolution of 96 DPI. http://www.pbbi.com/rest/spatial/mappingservice/maps/samples/namedmaps/worldmap/legends/0/ rows/0/swatch/32x32.png;r=96 Render Map Returns an image of a map, in the format specified, defined by the inline JSON map definition and the request parameters. The RenderMap method is very similar to the RenderNamedMap method, except you do not specify a named map in the URL, rather define the map in the JSON body of the REST request. Rendering an inline defined map is used when you want to obtain a view of a map as an image, by specifying the representation (e.g. gif), the dimensions of the raster and a view represented as either a center and zoom, a center and scale or a bounding box. Optionally, you may specify the locale and resolution (DPI) and well as provide authorization (security) information. The following rules in priority order determine how the rendering view is created: 54 Spectrum Technology Platform 9.0

Chapter 6: Working With REST Services if the center and zoom is specified then all other parameters governing the view are ignored. For center and zoom you must specify the c and z parameters in the request. if the center and scale is specified then all other parameters governing the view are ignored. For center and scale you must specify the c and s parameters in the request. if the bbox is specified then the bounding box is used to define the view. For bounding box you must specify the b parameter in the request. if none of these requirements are satisfied then an HTTP code of 404 (Not Found) will be returned HTTP POST URL Format The following format is used for HTTP POST requests: HTTP POST: /maps/image.image type; POST DATA: w=width;h=height;c=x,y,srs;z=zoom;s=scale;b=x1,y1,x2,y2,srs; [r=resolution];[l=locale];[rd=rendering];[bc=background color];[bo=background opacity]; POST BODY: Content-Type:application/json {map definition Parameters For information on the parameter types listed below, see Request URL Data Types on page 85. Parameter Type Required image type String yes The type of image to return (gif, png, jpg, bmp, jpeg, or tiff) w=width Integer yes Width of the image in pixels h=height Integer yes Height of the image in pixels c=x, y, srs Double, Double, String Only required if defining the view using center and zoom, or center and scale The center of the view in geographic coordinates consisting of a x, y position and the srs name (spatial reference system). z=zoom s=scale Integer, String Integer Only required The Zoom, or distance across the view in linear if defining the units. The zoom is represented by a string with a view using number followed by one or more spaces followed center and by an linear unit abbreviation (e.g., mi, km, m, etc). zoom Only required if defining the The map view will be zoomed to the specified scale. The scale value is used to compare map and real view using world distance values. For example, if a value of center and 1000 is specified, the map scale is 1:1000 (1 map scale unit is equal to 1000 real world units). b=x1, y1, x2, y2, srs Double, Double, Double, Double, String Only required if defining the The bounding box that defines the entire view in real world coordinates using opposing x, y corner view using a positions and the srs name (spatial reference bounding box system). r=resolution Integer no The DPI resolution of the map as an integer. DPI measures the resolution of map images in dots per inch (the number of individual dots that can be Spectrum Spatial Developer Guide 55

Mapping REST Interface Parameter Type Required placed within the span of one linear inch). If not specified then assumes server default. l=locale String no The locale in which to render the map. Uses the Java Locale format consisting of an ISO two letter language code and an ISO two letter country code. If not specified then assumes server default. cx=continue on exception Boolean no Deprecated. Defines whether the issues with rendering of underlying layers should be ignored or not. By default, the layer issue will be ignored. Unlike the SOAP API, no details of the error are returned. rd=rendering String no The type of rendering to perform, which can be either s (Speed,without anti-aliasing) or q (Quality, with anti-aliasing). The default value is s. bc=background color String no The background color to use for the map image, as expressed in RRGGBB format. If not supplied, the background color will be transparent. Note: Unlike with the SOAP API, a leading # should not precede the hexadecimal web color. bo=background opacity Double no The opacity of the background color. If the background and backgroundopacity attributes are specified, these values will be used to draw the background. If the background is not used, then the background will be totally transparent regardless of the backgroundopacity attribute. If the background is used but no opacity is specified, then the background will be totally opaque. Returns Returns an image of the map in the specified format. Example At the simplest form, the render map can define a single named layer, and return the image. In this instance, the map is returned as a PNG that is 400 x 400 pixels in dimension, the map view is defined by the bounding box in EPSG 27700. The map is defined using a single layer defined in the JSON body. http://www.pbbi.com/rest/spatial/mappingservice/maps/image.png; w=400;h=400;b=-140012,3087,736671,1193876,epsg%3a27700 { 'layers':[ { 'type':'namedlayer', 'name':'/samples/namedlayers/uk_regns_layer' ] The following examples show how various JSON map descriptions are defined: 56 Spectrum Technology Platform 9.0

Chapter 6: Working With REST Services Center and Zoom with Multiple Layers Bounding Box with a Single Layer Center and Scale with Multiple Layers Setting Layer Renderability Map with Pie Layer Overlay Equal Count Range Theme with MapBasic Styles Feature Layer with Bi-Quantile Range Theme Graduation Bar Layer Line Chart Layer Line Linkage Layer with Metric Expression Example Example Example Example Example Example Example Example Example Example Example Render a map with a translucent blue background: http://www.pbbi.com/rest/spatial/mappingservice/maps/image.png;w=256;h=256;b=-180,-90,180,90,epsg:4326;bc=0048ff;bo=.5 Render a map with high quality and fail on exceptions: http://www.pbbi.com/rest/spatial/mappingservice/maps/image.png;w=256;h=256;b=-180,-90,180,90,epsg:4326;rd=q; Render Map REST Examples The following are render map REST examples: Center and Zoom with Multiple Layers http://localhost:8080/rest/spatial/mappingservice/maps/image.png; w=400;h=400;c=8,42,epsg%3a4269;z=2800%20mi { 'layers':[ { 'type':'namedlayer', 'name':'/samples/namedlayers/worldcapfeaturelayer', { 'type':'namedlayer', 'name':'/samples/namedlayers/uk_regns_layer', { 'type':'namedlayer', 'name':'/samples/namedlayers/worldfeaturelayer' ] Bounding Box with a Single Layer http://localhost:8080/rest/spatial/mappingservice/maps/image.png; w=400;h=400;b=-140012,3087,736671,1193876,epsg%3a27700 { Spectrum Spatial Developer Guide 57

Mapping REST Interface 'layers':[ { 'type':'com.mapinfo.midev.service.mapping.v1.namedlayer', 'name':'/samples/namedlayers/uk_regns_layer' ] Center and Scale with Multiple Layers http://localhost:8080/rest/spatial/mappingservice/maps/image.png; w=400;h=400;c=8,42,epsg%3a4269;s=8500000 { 'layers':[ { 'type':'namedlayer', 'name':'/samples/namedlayers/worldcapfeaturelayer', { 'type':'namedlayer', 'name':'/samples/namedlayers/uk_regns_layer', { 'type':'namedlayer', 'name':'/samples/namedlayers/worldfeaturelayer' ] Setting Layer Renderability http://localhost:8080/rest/spatial/mappingservice/maps/image.png; w=400;h=400;b=-140012,3087,736671,1193876,epsg%3a27700 { 'layers':[ { 'type':'namedlayer', 'name':'/samples/namedlayers/worldcapfeaturelayer', 'renderable':'false', { 'type':'namedlayer', 'name':'/samples/namedlayers/uk_regns_layer', "renderable":'true', { 'type':'namedlayer', 'name':'/samples/namedlayers/worldfeaturelayer', "renderable":'true' ] Map with Pie Layer Overlay http://localhost:8080/rest/spatial/mappingservice/maps/image.png; 58 Spectrum Technology Platform 9.0

Chapter 6: Working With REST Services w=800;h=600;c=-101.0,42.0,epsg%3a4269;z=3000%20mi { "name":"mapwithpielayer", "layers":[ { "type":"pielayer", "depthfactor":"0.50", "verticalalignment":"middle", "wedgerenderdirection":"clockwise", "startangle":"180.0", "horizontalalignment":"center", "charteffecttype":"as3d", "charttype":"full", "diameter":{ "uom":"inch", "value":"1.0", "piebasesize":{ "usescale":"true", "mapscale":"2.28096e7", "opacity":"1.0", "categories":[ { "expression":"pop_2000", "description":"pop_2000", "style":{ "type":"namedstyle", "name":"/samples/namedstyles/areastyleblue", { "expression":"pop_male", "description":"pop_male", "style":{ "type":"namedstyle", "name":"/samples/namedstyles/areastylegreen", { "expression":"pop_female", "description":"pop_female", "style":{ "type":"namedstyle", "name":"/samples/namedstyles/areastylered" ], "spatialexpression":"obj", "table":{ "type":"namedtable", "name":"/samples/namedtables/usa", "border":{ "type":"namedstyle", "name":"/samples/namedstyles/linestylesolid", "graduation":{ "graduationmethod":"square_root", "valueatsize":"250000000", { "type":"namedlayer", "name":"/samples/namedlayers/layerwithtable" ] Spectrum Spatial Developer Guide 59

Mapping REST Interface Equal Count Range Theme with MapBasic Styles http://localhost:8080/rest/spatial/mappingservice/maps/image.png; w=800;h=600;c=-101.0,42.0,epsg%3a4269;z=3000%20mi { "layers":[ { "type":"featurelayer", "table":{ "type":"namedtable", "name":"/samples/namedtables/usa", "themes":[ { "type":"rangetheme", "endstyle":{ "type":"mapbasicareastyle", "mapbasicbrush":{ "pattern":"66", "foregroundcolor":"blue", "rangethemeproperties":{ "type":"rangethemeproperties", "expression":"pop_2000", "rangetype":"equalcount", "numranges":"6", "startstyle":{ "type":"mapbasicareastyle", "mapbasicbrush":{ "pattern":"66", "foregroundcolor":"yellow" ] ] Feature Layer with Bi-Quantile Range Theme http://localhost:8080/rest/spatial/mappingservice/maps/image.png; w=400;h=400;b=-125,23,-66,49,epsg%3a4269 { 'layers':[ { "type":"featurelayer", "Table":{ "type":"namedtable", "name":"/samples/namedtables/usa", "ThemeList":{ "type":"themelist", "Theme":[ { "type":"rangetheme", "StartStyle":{ "type":"namedstyle", "name":"/samples/namedstyles/areastyleblue", "EndStyle":{ "type":"namedstyle", 60 Spectrum Technology Platform 9.0

Chapter 6: Working With REST Services ] ] "name":"/samples/namedstyles/areastylered", "RangeThemeProperties":{ "type":"rangethemeproperties", "rangetype":"biquantile", "expression":"pop_male", "quantileexpression":"pop_female", "numranges":6 Bar Layer with Constant Graduation http://localhost:8080/rest/spatial/mappingservice/maps/image.png; w=400;h=400;b=-125,23,-66,49,epsg%3a4269 { 'layers':[ { "type":"barlayer", "verticalalignment":"bottom", "horizontalalignment":"center", "charteffecttype":"as3d", "Table":{ "type":"namedtable", "name":"/samples/namedtables/usa", "Graduation":{ "type":"graduation", "graduationmethod":"constant", "valueatsize":7000000, "Border":{ "type":"namedstyle", "name":"/samples/namedstyles/linestylesolid", "CategoryList":{ "type":"categorylist", "Category":[ { "type":"category", "expression":"pop_2000", "description":"pop_2000", "Style":{ "type":"namedstyle", "name":"/samples/namedstyles/areastyleblue", { "type":"category", "expression":"pop_male", "description":"pop_male", "Style":{ "type":"namedstyle", "name":"/samples/namedstyles/areastyleblue", { "type":"category", "expression":"pop_female", "description":"pop_female", "Style":{ Spectrum Spatial Developer Guide 61

Mapping REST Interface ], { "type":"namedstyle", "name":"/samples/namedstyles/areastyleblue" ], "BarBaseSize":{ "type":"basesize", "mapscale":2.28096e7, "usescale":true "type":"featurelayer", "Table":{ "type":"namedtable", "name":"/samples/namedtables/usa" Line Chart Layer http://localhost:8080/rest/spatial/mappingservice/maps/image.png; w=800;h=600;c=-101.0,42.0,epsg%3a4269;z=550%20mi { "layers":[ { "type":"linechartlayer", "line":{ "type":"namedstyle", "name":"/samples/namedstyles/linestylesolid", "chartheight":{ "uom":"pixel", "value":"300", "categories":[ { "expression":"pop_2000", "description":"pop_2000", { "expression":"pop_male", "description":"pop_male", { "expression":"pop_female", "description":"pop_female" ], "table":{ "type":"namedtable", "name":"/samples/namedtables/usa", "chartwidth":{ "uom":"pixel", "value":"300", { "type":"featurelayer", "table":{ "type":"namedtable", "name":"/samples/namedtables/usa" 62 Spectrum Technology Platform 9.0

Chapter 6: Working With REST Services ] Line Linkage Layer with Metric Expression http://localhost:8080/rest/spatial/mappingservice/maps/image.png; w=800;h=600;c=-.3,.3,epsg%3a4326;z=20000%20mi { "layers":[ { "type":"linelinkagelayer", "relationshipexpression":"country", "sourceexpression":"source_airport", "destinationexpression":"destination_airport", "metricexpression":"metric", "sourcepointstyle":{ "type":"namedstyle", "name":"/samples/namedstyles/pointstylepin", "destinationpointstyle":{ "type":"namedstyle", "name":"/samples/namedstyles/pointstylestar", "linkagetable":{ "type":"namedtable", "name":"/samples/namedtables/flightstable", "themelist":{ "theme":[ { "type":"customrangetheme", "expression":"metric", "allothers":{ "type":"namedstyle", "name":"/samples/namedstyles/linestylesolid", "rangebinlist":{ "rangebin":[ { "style":{ "type":"namedstyle", "name":"/samples/namedstyles/linestyledash", "lowerbound":{ "type":"doublevalue", "value":"1", "upperbound":{ "type":"doublevalue", "value":"8", { "style":{ "type":"namedstyle", "name":"/samples/namedstyles/linestylesolid", "lowerbound":{ "type":"doublevalue", "value":"9", "upperbound":{ "type":"doublevalue", Spectrum Spatial Developer Guide 63

Mapping REST Interface ], { "value":"20" ] ], "geometrytable":{ "type":"namedtable", "name":"/samples/namedtables/worldtable" "type":"featurelayer", "table":{ "type":"namedtable", "name":"/samples/namedtables/worldtable" Render Legend for a Map Returns the complete legend of a map specifying the map definition as JSON, the swatch size, and mime type of the legends. The legend is returned as single swatch rows, including a base64 encoded image (or URL) and text description, that make up a complete legend. For each layer in the map definition, zero, one, or more legend entries will be returned. When inlineswatch is passed as false, the map definition's JSON is used to create a unique key. This key, along with the path(legends/{legendindex/rows/{rowindex), is put into the cache. This key can be used in the getswatch operation to retrieve the legend from the cache. HTTP POST URL Format The following format is used for HTTP POST requests: HTTP POST: /maps/image.image type; POST DATA: w=width;h=height;t=image type; [r=resolution];[l=locale]?[inlineswatch=boolean] POST BODY: Content-Type:application/json {map definition Parameters For information on the parameter types listed below, see Request URL Data Types on page 85. Parameter Type Required type String yes The type of information to return the legend (e.g., JSON) w=width Integer yes Width of the individual legend swatch in pixels h=height Integer yes Height of the individual legend swatch in pixels t=image type String yes The type of images to return for the legend swatches (e.g., gif, png, etc) 64 Spectrum Technology Platform 9.0

Chapter 6: Working With REST Services Parameter Type Required r=resolution Integer no The DPI resolution of the legend swatches as an integer. DPI measures the resolution of images in dots per inch (the number of individual dots that can be placed within the span of one linear inch). If not specified then assumes server default. l=locale String no The locale in which to render the legend. Uses the Java Locale format consisting of an ISO two letter language code and an ISO two letter country code. If not specified then assumes server default. inlineswatch=boolean Boolean no Determines if the swatch images are returned as data or URL to the image location on the server. By default all swatch images are returned as base64 encoded images in the JSON response (inlineswatch=true). To return swatch image URLs to the images located on the server, specify inlineswatch=false. Returns Returns an array of string values returned in a JSON response object that represent all the legend swatches for a map. For each layer in the map, zero, one, or more legend entries will be returned. In the following response, inlineswatch is true. The image is returned as the default base64 encoded image. { "LegendResponse":[{"layerName":"UK REGNS", "rows":[{ "description":"region","swatch":"data:image/png;base64,ivborw0kggoaaaansuheugaaadiaaaay CAYAAAAeP4ixAAAASUlEQVR42u3PQRUAAAREQf3TacRBCszu+wEm4tjqQAPJxQcBAQEBAQEBAQEBAQEBAQEB AQEBAQEBAQEBAQEBAQEBAQEBeQHZXgPRVfdw38uLQQAAAABJRU5ErkJggg==" ], "title":"uk REGNS", "type":"cartographic"] The following response is the same swatch as above; however, a URL to the generated swatch image is returned (setting the inlineswatch parameter to false). { "LegendResponse":[{"layerName":"UK REGNS", rows":[{ "description":"region","swatch":"http://localhost:8080/rest/spatial/mappingservice/maps/ ae16d6e47ab63e2a840f8b1f205e12bb/legends/0/rows/0/swatch/50x50.png"], "title":"uk REGNS","type":"CARTOGRAPHIC"] Spectrum Spatial Developer Guide 65

Feature REST Interface Example Return the legend (swatches and information) for the MapWithLayer map, located in the /Samples/NamedMaps directory in the repository, in JSON format. The swatches will be 32 x 16, in PNG format, and returned as base64 encoded images. The map is defined using a single layer defined in the JSON body. http://www.pbbi.com/rest/spatial/mappingservice/maps/mapwithlayer/ legends.json;w=16;h=32;t=png { 'layers':[ { 'type':'namedlayer', 'name':'/samples/namedlayers/uk_regns_layer' ] Feature REST Interface This section introduces the Feature REST API. It describes what the Feature REST API is, and how you use the REST API to access the services provided by Spectrum Technology Platform. Methods This section describes the methods that are available in the Feature REST Interface. List all Available Tables Returns a list of named tables that are available within the repository. HTTP GET URL Format The following format is used for HTTP GET requests: HTTP GET /tables.rep;[l=locale] Parameters For information on the parameter types listed below, see Request URL Data Types on page 85. Parameter Type Required rep String yes The representation to be returned. Supported representation is json. l=locale String no The locale in which to return the table information. Uses the Java Locale format consisting of an ISO two letter language code and an ISO two letter country code. If not specified then assumes server default. 66 Spectrum Technology Platform 9.0

Chapter 6: Working With REST Services Returns Returns a list of tables in the specified format. Example Returns a list of available tables in the repository, as a comma delimited list, in the Locale English (US) http://www.pbbi.com/rest/spatial/featureservice/tables.json;l=en_us Total number of all Available Tables Returns the total count of named tables that are available within the repository. HTTP GET URL Format The following format is used for HTTP GET requests: HTTP GET /tables/count;[l=locale] Parameters For information on the parameter types listed below, see Request URL Data Types on page 85. Parameter Type Required l=locale String no The locale in which to return the table information. Uses the Java Locale format consisting of an ISO two letter language code and an ISO two letter country code. If not specified then assumes server default. Returns Returns the total count of tables in the specified format. Example Returns the count of available tables in the repository, in the Locale English (US) http://www.pbbi.com/rest/spatial/featureservice/tables/count;l=en_us Number of Features in a Table Returns the number of features within a named table. This method can also use a search at point query parameter to return the number of features at a given point, using a distance tolerance around the point. Here are some basic rules for the searchatpoint method when returning feature count: The q attribute must be the query type searchatpoint. Spectrum Spatial Developer Guide 67

Feature REST Interface The default tolerance radius is 300 meters. HTTP GET URL Format The following format is used for HTTP GET requests: HTTP GET /tables/tablename/features/count&q=searchatpoint&point=point,srs&[tolerance=distance unit] &[geometryattributename=geomname]&[l=locale] Parameters For information on the parameter types listed below, see Request URL Data Types on page 85. Parameter Type Required tablename String yes The name of the table to return feature metadata. The table is specified by a Regex for the named table to render based on the location of the named table in the Repository. The name of the named table is defined between the /tables portion of the URL and the /metadata.rep portion of the URL. For example, to return the feature metadata for a named table located at /Samples/NamedTables/WorldTable in the Repository, the following URL would be used:.../featureservice/tables/samples/ NamedTables /WorldTable/features/count;... q=searchatpoint String no The query method to perform. This must be searchatpoint. point=point,srs String no The point used as the starting location for the search. The point must include the x/y positions and the spatial reference system for the geometry. For example: point=-75.651157,45.374245,epsg:4326 tolerance=distance unit String no The distance to search around the point. By default the tolerance is 300 meters. When specified, the tolerance must include the distance value and distance unit. The distance values returned in the response will be in the units specified in the request (default is meters). geometryattributename= geomname String no The geometry definition attribute from the table that should be used for processing the spatial query. This attribute is only required for tables that contain more than one geometry attribute definition. l=locale String no The locale in which to return the table information. Uses the Java Locale format consisting of an ISO two letter language code 68 Spectrum Technology Platform 9.0

Chapter 6: Working With REST Services Parameter Type Required and an ISO two letter country code. If not specified then assumes server default. Returns Returns metadata for a named table in the repository. Examples Returns the total number of features that are in the WorldTable. http://www.pbbi.com/rest/spatial/featureservice/tables/samples/namedtables/worldtable/features/count Returns the total number of features from the WorldTable that are within 1000 miles from the specified point. http://midw7x64:8080/rest/spatial/featureservice/tables/samples/namedtables/worldtable/features/count? q=searchatpoint&point=-75.651157,45.374245,epsg:4326&tolerance=1000%20mi Describe a Table's Metadata Returns metadata for a named table in the repository. Information in the response includes the table coordinate reference system, bounding box, columns and their types. HTTP GET URL Format The following format is used for HTTP GET requests: HTTP GET /tables/tablename/metadata.rep;[l=locale] Parameters For information on the parameter types listed below, see Request URL Data Types on page 85. Parameter Type Required tablename String yes The name of the table to return metadata. The table is specified by a Regex for the named table to render based on the location of the named table in the Repository. The name of the named table is defined between the /tables portion of the URL and the /metadata.rep portion of the URL. For example, to return the metadata for a named table located at /Samples/NamedTables/WorldTable in the Repository, the following URL would be used: Spectrum Spatial Developer Guide 69

Feature REST Interface Parameter Type Required.../FeatureService/tables/Samples/NamedTables /WorldTable/metadata.json;... rep String yes The representation to be returned. Supported representation is json. l=locale String no The locale in which to return the table information. Uses the Java Locale format consisting of an ISO two letter language code and an ISO two letter country code. If not specified then assumes server default. Returns Returns metadata for a named table in the repository. Example Returns the metadata for the table WorldTable located in the /Samples/NamedTables directory in the Repository, in the Locale English (US) http://www.pbbi.com/rest/spatial/featureservice/tables/samples/namedtables/worldtable/ metadata.json;l=en_us Insert a Feature into a Table Inserts one or more records into a table. The body of the request contains the JSON representation of the feature collection, although certain elements are not necessary to specify. Each of these features contains zero or more column values. If a column is not specified, a null value will be inserted. A column value must be specified if it is part of a primary key whose value is not handled by the database (i.e. via an auto-increment constraint or sequence). To determine the primary key, examine the key definition in the describetable response. The response contains the primary keys of features that were successfully inserted. Note: Insert is supported on PostGIS, PostGres, Oracle, and generic JDBC tables. The table must have a primary key or it will be considered a read-only table. HTTP POST URL Format The following format is used for HTTP POST requests: HTTP POST: /tables/tablename/features.rep POST Data: action=insert;[commitinterval=c] POST BODY: Content-Type:application/json {table insert The table insert is POST json body (Content-Type: application/json) for the table insert containing one or multiple features to be inserted. Parameters For information on the parameter types listed below, see Request URL Data Types on page 85. 70 Spectrum Technology Platform 9.0

Chapter 6: Working With REST Services Parameter Type Required tablename String yes The name of the table to insert the features. The table is specified by a fully qualified name for the named table based on the location of the named table in the Repository. The name of the named table is defined between the /tables portion of the URL and the /features.rep portion of the URL. For example, to insert a feature in a named table located at /Samples/NamedTables/WorldTable in the Repository, the following URL would be used:.../featureservice/tables/samples/ NamedTables /WorldTable/features.json;... rep String yes The representation to be returned. Supported representation is json. action=insert String yes The action to insert the features into the table. commitinterval=c Integer no The number of inserts that will be processed in a transaction. For instance, if you are inserting 50 features into a table, and the commitinterval is set to 20, then you will have three transactions (20, 20, 10). The default value is 50. Returns Returns the primary key of each added feature to the table. Example Adds two new feature to the MyTable consisting of points in the geometry column, values of 456 and 123 to Column1, and values of "four five six" and "one two three" to Column2. http://www.pbbi.com/rest/spatial/featureservice/tables/mytable/features.json action=insert;commitinterval=1 { "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "Point", "coordinates": [-73, 41], "properties": { "Column1": 456; "Column2": "four five six", { "type": "Feature", "geometry": { "type": "Point", "coordinates": [-72, 42], "properties": { "Column1": 123; "Column2": "one two three" Spectrum Spatial Developer Guide 71

Feature REST Interface ] Search a Table for Features at a Point Searches a named table within the repository for features that are at a specified point, within a certain tolerance. You have the options of returning all of the attribute data, specific attribute data, and ording the returned data by an attribute. Here are some basic rules for the searchatpoint method: Returns a feature collection plus the attributes. Returns the distance in the unit specified in the tolerance. Returns results, by default, closest to farthest The q attribute must be the query type searchatpoint. When specifying attribute and orderby Matrix parameters you can list more than one using a comma separated list. The default tolerance radius is 300 meters. When using the orderby matrix parameter you must specify the sort direction as either D for descending or A for ascending. HTTP GET URL Format The following format is used for HTTP GET requests: HTTP GET /tables/tablename/features.rep;[attributes=attname];[orderby=attname dir] &q=searchatpoint&point=point,srs&[tolerance=distance unit]&[geometryattributename=geomname] &[l=locale]&[page=pagenumber]&[pagelength=pagelength] Parameters For information on the parameter types listed below, see Request URL Data Types on page 85. Parameter Type Required tablename String yes The name of the table to return metadata. The table is specified by a Regex for the named table to render based on the location of the named table in the Repository. The name of the named table is defined between the /tables portion of the URL and the /metadata.rep portion of the URL. For example, to return the metadata for a named table located at /Samples/NamedTables/WorldTable in the Repository, the following URL would be used:.../featureservice/tables/samples/namedtables /WorldTable/metadata.json;... rep String yes The representation to be returned. Supported representation is json. 72 Spectrum Technology Platform 9.0

Chapter 6: Working With REST Services Parameter Type Required attributes=attname String no The attribute names of the table to be returned in the response. By default all attributes are returned. More than one attribute is defined by a comma separated list. This is a simple way of limiting the amount of information in the response to include only the information requested. Each feature in the resulting feature collection will only contain the specified attributes. For example, if the table contains four attributes, but only two are required in the response, those two attribute names can be specified here (separated by a comma) and the values for the other two will not be returned. orderby=attname dir String no The attribute name and direction to order the returned results. By default the results are ordered from closest to farthest based on the distance from the specified point. When specifing an attribute to order the results, you must include both the attribute name and the ording direction (A for ascending(low to high) or D for descending(high to low)). q=searchatpoint String yes The query method to perform. This must be searchatpoint. point=point,srs String yes The point used as the starting location for the search. The point must include the x/y positions and the spatial reference system for the geometry. For example: point=-75.651157,45.374245,epsg:4326 tolerance=distance unit String no The distance to search around the point. By default the tolerance is 300 meters. When specified, the tolerance must include the distance value and distance unit. The distance values returned in the response will be in the units specified in the request (default is meters). geometryattributename= geomname String no The geometry definition attribute from the table that should be used for processing the spatial query. This attribute is only required for tables that contain more than one geometry attribute definition. l=locale String no The locale in which to return the table information. Uses the Java Locale format consisting of an ISO two letter language code and an ISO two letter country code. If not specified then assumes server default. page=pagenumber String no The page number to return. pagelength= pagelength String no The number of features returned on each page. If the page paramter is specified in the request, you must define pagelength. Spectrum Spatial Developer Guide 73

Feature REST Interface Returns Returns metadata for a named table in the repository. Examples Returns the world capitals that are within 1000 miles from the specified point. All attributes for features found in the WorldcapTable will be returned. http://www.pbbi.com/rest/spatial/featureservice/tables/samples/namedtables/worldcaptable/ features.json?q=searchatpoint&point=-75.651157,45.374245,epsg%3a4326&tolerance=1000%20mi Returns the world capitals that are within 500 miles from the specified point. Only the Country and Cap_Pop attributes for features found in the WorldcapTable will be returned. http://www.pbbi.com/rest/spatial/featureservice/tables/samples/namedtables/worldcaptable/ features.json;attributes=country,cap_pop?q=searchatpoint&point=-75.651157,45.374245, EPSG%3A4326&tolerance=500%20mi Returns the world capitals that are within 500 miles from the specified point. Only the Country attribute will be returned, and order on the Country attibute in descending order, for features found in the WorldcapTable. http://www.pbbi.com/rest/spatial/featureservice/tables/samples/namedtables/worldcaptable/features.json; attributes=country;orderby=country%20d?q=searchatpoint&point=-75.651157,45.374245, EPSG%3A4326&tolerance=500%20mi&l=en_US Search a Table for Features Nearest to a Geometry Searches a named table within the repository for features that are nearest to a specfified geometry, within a certain distance. You have the options of returning all of the attribute data, specific attribute data, and ording the returned data by an attribute. Here are some basic rules for the searchnearest method: Returns a feature collection plus the attributes. Returns the distance value in the response using the distanceattributename parameter specfified in the request. Returns the distance in the unit specified in the withindistance. If not specified the default distance is 300 meters. Returns results, by default, closest to farthest The q attribute must be the query type searchnearest. Maximum number of features returned is defined using the maxfeatures parameter in the request or using the maxcandidates parameter in the Feature Service configuration. By default this value is 1000 features. When specifying attribute and orderby Matrix parameters you can list more than one using a comma separated list. 74 Spectrum Technology Platform 9.0

Chapter 6: Working With REST Services When using the orderby matrix parameter you must specify the sort direction as either D for descending or A for ascending. HTTP GET URL Format The following format is used for HTTP GET requests: HTTP GET /tables/tablename/features.rep;[attributes=attname];[orderby=attname dir] &q=searchnearest&geometry=geom,srs&[withindistance=distance unit] &[distanceattributename=distanceattributename]&[geometryattributename=geomname] &[l=locale]&[page=pagenumber]&[pagelength=pagelength]&[maxfeatures=maxfeatures] Parameters For information on the parameter types listed below, see Request URL Data Types on page 85. Parameter Type Required tablename String yes The name of the table to return metadata. The table is specified by a Regex for the named table to render based on the location of the named table in the Repository. The name of the named table is defined between the /tables portion of the URL and the /metadata.rep portion of the URL. For example, to return the metadata for a named table located at /Samples/NamedTables/WorldTable in the Repository, the following URL would be used:.../featureservice/tables/samples/namedtables /WorldTable/metadata.json;... rep String yes The representation to be returned. Supported representation is json. attributes=attname String no The attribute names of the table to be returned in the response. By default all attributes are returned. More than one attribute is defined by a comma separated list. This is a simple way of limiting the amount of information in the response to include only the information requested. Each feature in the resulting feature collection will only contain the specified attributes. For example, if the table contains four attributes, but only two are required in the response, those two attribute names can be specified here (separated by a comma) and the values for the other two will not be returned. orderby=attname dir String no The attribute name and direction to order the returned results. By default the results are ordered from closest to farthest based on the distance from the specified point. When specifing an attribute to order the results, you must include both the attribute name and the Spectrum Spatial Developer Guide 75

Feature REST Interface Parameter Type Required ording direction (A for ascending(low to high) or D for descending(high to low)). q=searchnearest String yes The query method to perform. This must be searchnearest. geometry=geom,srs String yes The geometry used as the starting location for the search. The geometry must include the geometry type, cooridinates and the spatial reference system for the geometry. For example: geometry={"type":"polygon", "coordinates":[[[-96.8,30.5],[-97.7,30.5], [-97.7,29.9],[-96.8,29.9],[-96.8,30.5]]], "crs":{"type":"name", "properties":{"name":"epsg:4231" withindistance= distanceunit String no The distance to search around the geometry. By default the search distance is 300 meters. When specified, the distance must include the distance value and distance unit. The distance values returned in the response will be in the units specified in the request (default is meters). distanceattributename= geomname String no The name of the distance attribute to be returned in the response. This attribute is used to return the distance value from the geometry to the found nearest features. If the distanceattributename parameter is not specified, the distance value to each feature will not be returned in the response. geometryattributename= geomname String no The geometry definition attribute from the table that should be used for processing the spatial query. This attribute is only required for tables that contain more than one geometry attribute definition. l=locale String no The locale in which to return the table information. Uses the Java Locale format consisting of an ISO two letter language code and an ISO two letter country code. If not specified then assumes server default. page=pagenumber String no The page number to return. pagelength=pagelength String no The number of features returned on each page. If the page paramter is specified in the request, you must define pagelength. maxfeatures= maxfeatures String no The total number of features returned in the response. If the maxfeatures paramter is not specified in the request, the maxcandidates parameter in the Feature Service configuration is used. By default this value is 1000 features. 76 Spectrum Technology Platform 9.0

Chapter 6: Working With REST Services Returns Returns metadata for a named table in the repository. Examples Returns the nearest world capitals that are within 5000 miles from the specified point geometry. http://www.pbbi.com/rest/spatial/featureservice/tables/samples/namedtables/worldcaptable/features.json? q=searchnearest&geometry={"type":"point","coordinates":[-97.672598,30.252092],"crs": {"type":"name","properties":{"name":"epsg:4231"&withindistance=5000%20mi Returns the closest three state capitals in the USA that are within 5000 miles from the specified geometry. http://www.pbbi.com/rest/spatial/featureservice/tables/samples/namedtables/usa_caps/features.json? q=searchnearest&geometry={"type":"polygon","coordinates":[[[-96.8,30.5],[-97.7,30.5], [-97.7,29.9],[-96.8,29.9],[-96.8,30.5]]],"crs":{"type":"name","properties":{"name":"epsg:4231" &withindistance=5000%20mi&maxfeatures=3 Returns the closest three state capitals in the USA that are within 1000 miles from the specified point geometry. The distance to each feature will be returned in the withindistancefromgeometry attribute in the response and the calculation will be based on the geometries in the GEOLOC column in the USA_CAPS named table. http://www.pbbi.com/rest/spatial/featureservice/tables/samples/namedtables/usa_caps/features.json? q=searchnearest&geometry={"type":"point","coordinates":[-97.672598,30.252092], "crs":{"type":"name","properties":{"name":"epsg:4231"&withindistance=1000 mi&maxfeatures=3&distanceattributename=withindistancefromgeometry&geometryattributename=geoloc Search for Features by ID Returns features in a named table in the repository defined by its ID. By default, all information in the response is included. Specify attributes to return a subset of the features. HTTP GET URL Format The following format is used for HTTP GET requests: HTTP GET /tables/tablename/features.rep;[attributes=attname];[l=locale]/key Parameters For information on the parameter types listed below, see Request URL Data Types on page 85. Spectrum Spatial Developer Guide 77

Feature REST Interface Parameter Type Required tablename String yes The name of the table to return features for. The table is specified by a Regex for the named table to render based on the location of the named table in the Repository. The name of the named table is defined between the /tables portion of the URL and the /features.rep portion of the URL. For example, to return the features for a named table located at /Samples/NamedTables/WorldTable in the Repository, the following URL would be used:.../featureservice/tables/samples/namedtables /WorldTable/features.json;... rep String yes The representation to be returned. Supported representation is json. attributes=attname String no The attribute names of the feature to be returned in the response. By default all attributes are returned. More than one attribute is defined by a comma separated list. This is a simple way of limiting the amount of information in the response to include only the information requested. Each feature in the resulting feature collection will only contain the specified attributes. For example, if the table contains four attributes, but only two are required in the response, those two attribute names can be specified here (separated by a comma) and the values for the other two will not be returned. key String yes The ID of the feature to be returned. This is either the ID (for.tab files) or the primary key (for dbms) of the feature in the table. l=locale String no The locale in which to return the table information. Uses the Java Locale format consisting of an ISO two letter language code and an ISO two letter country code. If not specified then assumes server default. Returns Returns specified features in a named table in the repository. { "type":"featurecollection","metadata":[{"type":"string","name":"country", {"type":"string","name":"capital",{"type":"string","name":"continent"], "features":[{"type":"feature","id":"43","properties":{"country":"china","capital":"beijing", "Continent":"Asia"] 78 Spectrum Technology Platform 9.0

Chapter 6: Working With REST Services Examples Returns all the features for record ID=43 (China) for the table WorldTable located in the /Samples/NamedTables directory in the Repository, in the Locale English (US) http://www.pbbi.com/rest/spatial/featureservice/tables/samples/namedtables/ WorldTable/features.json;l=en_us/43 Returns a subset (Country, Capital, and Continent) of the features for record ID=43 (China) for the table WorldTable located in the /Samples/NamedTables directory in the Repository, in the Locale English (US) http://www.pbbi.com/rest/spatial/featureservice/tables/samples/namedtables/ WorldTable/features.json;attributes=Country,Capital,Continent;l=en_us/43 Search for Features Using SQL Queries Returns features in a named table in the repository based on a SQL query. HTTP GET URL Format The following format is used for HTTP GET requests: HTTP GET /tables/features.rep;[q=sql query];[l=locale]&[page=pagenumber]&[pagelength=pagelength] Parameters For information on the parameter types listed below, see Request URL Data Types on page 85. Parameter Type Required rep String yes The representation to be returned. Supported representation is json. q String yes The query to perform in SQL format. l=locale String no The locale in which to return the table information. Uses the Java Locale format consisting of an ISO two letter language code and an ISO two letter country code. If not specified then assumes server default. page=pagenumber String no The page number to return. pagelength=pagelength String no The number of features returned on each page. If the page paramter is specified in the request, you must define pagelength. Spectrum Spatial Developer Guide 79

Map Tiling REST Interface Returns Returns specified features in a named table in the repository. { "type":"featurecollection","metadata":[{"type":"geometry","name":"obj", "style":{,"stylecolumn":"mi_style",{"type":"string","name":"country", {"type":"string","name":"capital",{"type":"string","name":"continent", {"type":"integer","name":"numeric_code",{"type":"string","name":"fips", {"type":"string","name":"iso_2",{"type":"string","name":"iso_3", {"type":"integer","name":"pop_1994",{"type":"decimal","name":"pop_grw_rt", "fractionaldigits":1,"totaldigits":6,{"type":"integer","name":"pop_male", {"type":"integer","name":"pop_fem",{"type":"integer","name":"pop_0_14", {"type":"integer","name":"pop_15_64",{"type":"integer","name":"pop_65plus", {"type":"integer","name":"male_0_14",{"type":"integer","name":"male_15_64", {"type":"integer","name":"male_65plus",{"type":"integer","name":"fem_0_14", {"type":"integer","name":"fem_15_64",{"type":"integer","name":"fem_65plus", {"type":"integer","name":"pop_urban",{"type":"integer","name":"pop_rural", {"type":"integer","name":"pop_urb_male",{"type":"integer","name":"pop_urb_fem", {"type":"integer","name":"pop_rur_male",{"type":"integer","name":"pop_rur_fem", {"type":"decimal","name":"arable_pct","fractionaldigits":1,"totaldigits":6, {"type":"decimal","name":"literacy","fractionaldigits":1,"totaldigits":4, {"type":"decimal","name":"inflat_rate","fractionaldigits":1,"totaldigits":4, {"type":"decimal","name":"unempl_rate","fractionaldigits":1,"totaldigits":4, {"type":"decimal","name":"indust_growth","fractionaldigits":1,"totaldigits":4, {"type":"integer","name":"colorcode",{"type":"style","name":"mi_style"] Example Returns the features for the records where the country is CANADA for the table WorldTable located in the /Samples/NamedTables directory in the Repository. http://www.pbbi.com/rest/spatial/featureservice/tables/features.json?q=select * FROM "/Samples/NamedTables/WorldTable" WHERE Country='CANADA' Map Tiling REST Interface This section introduces the Map Tiling REST API. It describes what the Map Tiling REST API is, and how you use the REST API to access the services provided by Spectrum Technology Platform. Methods This section describes the methods that are available in the Map Tiling REST Interface. MapList Returns the list of available named maps for the Map Tiling Service. Only the maps listed in the response can have tiles generated. Note: Before sending any requests to the Map Tiling Service, it is good practice to send a MapList request to determine the available maps of the service. 80 Spectrum Technology Platform 9.0

Chapter 6: Working With REST Services HTTP GET URL Format The following format is used for HTTP GET requests: HTTP GET /maplist.json Parameters The maplist method does not have any input parameters. You only need to specify maplist.json as the REST parameter. Returns An array of String values returned in a JSON response object. This is the list of available named maps for the MapTiling Service. Example http://www.pbbi.com/rest/spatial/maptilingservice/maplist.json The following example shows the format of the JSON object returned in the response: {"Response":["WorldCap","World"] Returns the metadata of a specified named map for the Map Tiling Service. HTTP GET URL Format The following format is used for HTTP GET requests: HTTP GET /mapname/description.json Parameters For information on the parameter types listed below, see Request URL Data Types on page 85. Parameter Type Required mapname String yes The name of the named map to return the metadata for. Returns A Map object. See Map on page 84. Spectrum Spatial Developer Guide 81

Map Tiling REST Interface Example http://www.pbbi.com/rest/spatial/maptilingservice/world/description.json The following example shows the format of the JSON object returned in the response: {"Response":{"numberOfLevels":20,"coordSys":"epsg:41001","description":"Map Of The World", "mapname":"world","tilewidth":256,"tileheight":256,"bounds":{"maxx":2.0e7,"maxy":2.0e7, "minx":-2.0e7,"miny":-2.0e7,"outputtypes":["image/png","image/jpeg","image/gif"], "mapresolution":110,"maprendering":"speed" Tile Returns generated map tiles from the Map Tiling Service based on the input parameters specified. HTTP GET URL Format The following format is used for HTTP GET requests: HTTP GET /mapname/level/x:y/tile.image type Parameters For information on the parameter types listed below, see Request URL Data Types on page 85. Parameter Type Required mapname String yes The name of the named map to generate the tile from. level Integer yes Determines the zoom level of the tile to be returned. The level shows how close the map image is to the Earth. Level 1 is the furthest away and is composed of one tile that the entire map will be drawn into. Level 2 is composed of 4 tiles, 2 across and 2 down. Each tile is a quarter of the entire map. Level 3 is composed of 16 tiles, 4 across and 4 down, and so on. The higher the level specified, the closer to the Earth the map image appears. For example, levels 1 to 3 usually show global or hemispheric detail, levels 4 to 15 show county/state/province level of detail and some larger cities, levels greater that 15 show street level views. What the levels actually display is dependent on the named map published to the Map Tile Service. For example, if you published a map of New York, Toronto, or London then level 1 would be a street level map of Toronto while high levels would be more detailed. 82 Spectrum Technology Platform 9.0

Chapter 6: Working With REST Services Parameter Type Required This parameter must be set to a value greater than or equal to the minlevel value and less than or equal to the maxlevel value for the named map. x Integer yes Specifies the column of the tile, based on the level parameter specified. y Integer yes Specifies the row of the tile, based on the level parameter specified. image type Image Mime yes Specifies the response image format. Must be png, gif, or jpeg. Returns A map image. A JSON error will be returned if one of the following conditions are met: The mapname parameter is not specified. The name specified is not an available named map on the Tiling Service. The level parameter is less than the minlevel defined in the metadata for the specified map. The level parameter is greater than the maxlevel defined in the metadata for the specified map. The x parameter is less than 1. The x parameter is greater than what the level dictates the map can provide. The y parameter is less than 1 The y parameter is greater than what the level dictates the map can provide. Example http://www.pbbi.com/rest/spatial/maptilingservice/world/5/2%3a4/tile.png The following example shows the image output returned in the response: Objects This section describes the JSON objects that are returned in the response to a Map Tiling REST Interface request. Spectrum Spatial Developer Guide 83

Map Tiling REST Interface Map A Map object defines the metadata for a named map. Fields A Map object contains the following fields: Field Name numberoflevels coordsys description name tilewidth tileheight bounds outputtypes Type Integer CoordSys String String Integer Integer Bounds object Array of Strings The maximum number of levels (zoom in) that you can request for the map. Level 1 is the furthest away and is composed of one tile that the entire map will be drawn into. Level 2 is composed of 4 tiles, 2 across and 2 down. Each tile is a quarter of the entire map. Level 3 is composed of 16 tiles, 4 across and 4 down, and so on. The higher the level specified, the closer to the Earth the map image appears (zoom in). The coordinate system of the projection defining the map tiles. A textural description of the named map. The name of the named map. The width of the tiles in pixels. The height of the tiles in pixels. The geographical extent of the map's bounding box in the map's projection as specified by the coordsys field. See Bounds on page 85. The list of supported tile image formats that can be rendered for the map. Example { "numberoflevels": 20, "coordsys": "epsg:41001", "description": "Map of the World", "name": "World", "tilewidth": 256, "tileheight": 256, "bounds":{ "minx": -3.756380109844111E7, "miny": -4.497601034176671E7, "maxx": 3.773376466605809E7 "maxy": 4.49763662218225E7,, "outputtypes": [ "png" "jpeg" "gif" ] 84 Spectrum Technology Platform 9.0

Chapter 6: Working With REST Services Bounds A Bounds object defines the geographical extent of a map. Fields A Bounds object contains the following fields: Field Name minx miny maxx maxy Type Float Float Float Float The x value of the lower left point. The y value of the lower left point. The x value of the upper right point. The y value of the upper right point. Example { "minx": -3.756380109844111E7, "miny": -4.497601034176671E7, "maxx": 3.773376466605809E7, "maxy": 4.49763662218225E7 Common Data Types This section describes the data types that can be passed as URL parameters to a REST interface method. Request URL Data Types The following table lists the common data types for URL parameters to a service method. Although the method parameters (like all URL parameters) are essentially just strings, this table shows how the various types of data must be formatted in the URL of the method call. Note: The 'value' portion of a method parameter 'name=value' pair is case sensitive. Name Format Example Bounds A comma-separated array of four numbers of type Float. float,float,float,float view=-180,-90,180,90 CoordSys A geographical coordinate system. EPSG format coordsys=epsg:4269 Country An ISO country code. 2 or 3 character ISO country code country=ca Double A double-precision floating point number. [sign]integer.integer radius=6.25 Integer An integer number. [sign]integer maxcandidates=10 Spectrum Spatial Developer Guide 85

Common Data Types Name Format Example Language The language used for the service method response. [ISO language code]_[iso country code] language=en_ca LinearUnit A unit of measure for distance. One of the following values: M, DM, KM, FT, YD, or MI. distanceunit=km Point A point in 2D geometry. An x and y value pair separated by a space. Both x and y are Float values. In the service request URL, the space separator is encoded as '%20'. point=3.57%20-1.89 Polygon A polygon geometry. An array of Points. Points in the array are separated by a comma character. polygon=1.23%202.34, 3.45%204.56,..., 5.67%206.78 Rectangle A rectangle geometry. An array of two Points. The two Points in the array are separated by a comma character. rectangle=1.23%202.34, 3.45%204.56 String A string of characters that is not required to be formatted as one of the other data types in this table. An arbitrary string value. Any string of valid URL-encoded characters. city=new%20york 86 Spectrum Technology Platform 9.0

Understanding Tables 7 Tables are collections of features from a data source. Tables hold rows and columns of information that describe the features, including their geometry, style, and attributes. In this section: Supported Data Sources..........................88 Uses for Tables..................................88

Supported Data Sources Supported Data Sources The Location Intelligence Module supports spatial and non-spatial tables from a variety of data sources including MapInfo native tables (.TAB), relational database management systems (Oracle, SQL Server, PostGres/GIS), ESRI ShapeFiles and View tables. Specialty tables include raster, grid, and seamless versions of.tab, raster and grid. A View table is a subset of information from one or more data sources, including other view tables. Views are created with an MI SQL Select statement. Spatial tables contain a geometry column that allows the table to be rendered on a map or used in spatial queries. The spatial information can be stored in a MapCatalog that Location Intelligence Module reads to understand the data types. If a MapCatalog does not exist for the database, the Location Intelligence Module will derive the data types directly from the data source. Non-spatial tables containing columns for X and Y coordinates that represent a location (i.e., a point) can be expressed as a spatial table composed entirely of point geometries. The metadata to represent the non-spatial table can either come from the MapCatalog or be part of the Named Table definition in Management Console. Named Tables are explained in the Resources and Data section in the Spectrum Technology Platform Spectrum Spatial Guide on support.pb.com. The Location Intelligence Module also supports an extensible data provider API for accessing custom data sources. Refer to the Download section on support.pb.com. Uses for Tables In order for to Spectrum Technology Platform to access data sources, the associated table must first be included in the repository as a Named Table. If the table is from a database management system, it must also have a Named Connection defined. For instructions, see Adding or Modifying a JDBC Named Connection on page 183. Named tables can be used in Spectrum Technology Platform in the following ways: In the Feature Service or WFS to search for features that meet some criteria In a Named Map, indirectly through layers In a RenderMap request on the Mapping Service In a RenderNamedMapWithOverlay that includes layers In Dataflows and Stages, such as Read Spatial Data 88 Spectrum Technology Platform 9.0

Understanding Layers 8 A layer is a map component that hold features, themes, and labels. This section describes the supported layer types and provides examples of layer definitions. In this section: Feature Layer...................................90 Line Linkage Layer...............................92 Label Layer.....................................95 Graduated Symbol Layer..........................97 Bar Chart Layer.................................100 Pie Chart Layer.................................102 Line Chart Layer................................105 Grid Layer.....................................108 Modifying the Style with a FeatureStyleModifier......111

Feature Layer Feature Layer A feature layer is layer that displays features contained in a table. FeatureLayers can come from native.tab data, remote RDB (Oracle, PostGIS, MS SQL Server), seamless, raster and grid data and in-memory tables. To modify the style of a FeatureLayer, add a FeatureStyleModifier. A FeatureStyleModifier is a construct that modifies the appearance of a feature in a table using specified criteria or algorithms. FeatureStyleModifiers are discussed later in this chapter. Styles are discussed in Using Styles on page 123. A FeatureLayer is represented in Spectrum Technology Platform in four ways: Embedded inline in a named map As a named layer In a SOAP request as an overlay In a REST request as an overlay with an in-memory table. FeatureLayer in Named Map Example This is an example of a named map with three FeatureLayers (World Capitals, Grid and Ocean). The FeatureLayers are defined by their visibility and a reference to the data source. The World layer is a named layer that references a named table. <?xml version="1.0" encoding="utf-8"?> <NamedMapDefinition version="mxp_namedresource_1_5" xmlns="http://www.mapinfo.com/mxp" xmlns:gml="http://www.opengis.net/gml"> <ConnectionSet /> <DataSourceDefinitionSet> <TABFileDataSourceDefinition id="id1" readonly="false"> <DataSourceName>grid15</DataSourceName> <FileName>E:\Spectrum/server/modules/spatial/samples/data/world/grid15.tab</FileName> </TABFileDataSourceDefinition> <TABFileDataSourceDefinition id="id4" readonly="false"> <DataSourceName>worldcap</DataSourceName> <FileName>E:\Spectrum/server/modules/spatial/samples/data/world/worldcap.tab</FileName> </TABFileDataSourceDefinition> <TABFileDataSourceDefinition id="id2" readonly="false"> <DataSourceName>ocean</DataSourceName> <FileName>E:\Spectrum/server/modules/spatial/samples/data/world/ocean.tab</FileName> </TABFileDataSourceDefinition> </DataSourceDefinitionSet> <MapDefinition id="id5" name="mymap" alias=""> <DisplayConditions> <MapSize uom="mapinfo:imagesize pixel"> <ImageWidth>960</ImageWidth> <ImageHeight>800</ImageHeight> </MapSize> <ZoomAndCenter> <MapZoom uom="mapinfo:length mi">28014.44036</mapzoom> <gml:point srsname="mapinfo:coordsys 12,62,7,0"> <gml:coordinates>-5.4419258777052164,0</gml:coordinates> 90 Spectrum Technology Platform 9.0

Chapter 8: Understanding Layers </gml:point> </ZoomAndCenter> <DisplayCoordSys> <SRSName>mapinfo:coordsys 12,62,7,0</SRSName> </DisplayCoordSys> <ResizeMethod>preserveZoom</ResizeMethod> <RasterConditions dither="halftone" rasterreprojectionresampling="cubicconvolution" rasterreprojection="none" truecolor="true" optimizerasterlayers="screen" optimizevectorlayers="screen"/> <RenderingOptions enableopacity="true" enableantialias="true"/> </DisplayConditions> <LayerList> <FeatureLayer id="id7" name="world Capitals" alias="worldcap" volatile="unknown"> <Visibility visible="true"> <VisibleRange enabled="false"> <ZoomRange uom="mapinfo:length mi">0 0</ZoomRange> </VisibleRange> </Visibility> <DataSourceRef ref="id4" /> </FeatureLayer> <FeatureLayer id="id8" name="grid" alias="grid15" volatile="unknown"> <Visibility visible="true"> <VisibleRange enabled="false"> <ZoomRange uom="mapinfo:length mi">0 0</ZoomRange> </VisibleRange> </Visibility> <DataSourceRef ref="id1" /> </FeatureLayer> <NamedLayerRef name="world" resourceid="/samples/namedlayers/worldfeaturelayer"/> <FeatureLayer id="id10" name="ocean (Robinson)" alias="ocean" volatile="unknown"> <Visibility visible="true"> <VisibleRange enabled="false"> <ZoomRange uom="mapinfo:length mi">0 0</ZoomRange> </VisibleRange> </Visibility> <DataSourceRef ref="id2" /> </FeatureLayer> </LayerList> </MapDefinition> </NamedMapDefinition> Named Layer Example This is an example of a named layer definition for a FeatureLayer. In this example, the definition defines the attributes of a feature layer named World Countries. The data for this feature layer is contained in a file named worldcap.tab on the local file system. <?xml version="1.0" encoding="utf-8"?> <NamedLayer version="mxp_namedresource_1_5" xmlns="http://www.mapinfo.com/mxp"> <ConnectionSet/> <DataSourceDefinitionSet> <TABFileDataSourceDefinition id="id4" readonly="false"> <DataSourceName>worldcap</DataSourceName> Spectrum Spatial Developer Guide 91

Line Linkage Layer <FileName>@INSTALLDIR@/Mapping/world/worldcap.tab</FileName> </TABFileDataSourceDefinition> </DataSourceDefinitionSet> <FeatureLayer id="id9" name="world Countries" alias="world" volatile="unknown"> <Visibility visible="true"> <VisibleRange enabled="false"> <ZoomRange uom="mapinfo:length mi">0 0</ZoomRange> </VisibleRange> </Visibility> <DataSourceRef ref="id4"/> </FeatureLayer> </NamedLayer> FeatureLayer as an Overlay FeatureLayer can also be used as an overlay in a SOAP or REST request. For a demo of the SOAP request, go to the Mapping Service Demo Page and choose Render Named Map with Overlay and Render Named Map with FeatureLayer Overlay. Line Linkage Layer Maps using line linkages enable you to examine the relationship between points by connecting them with a line based on a common variable between them. A good example of a line linkage map is to display the flights in and out of airports and show the connections between each airport. These linkage maps represent the lines drawn on the map from a source geometry (centroid) to a destination geometry (centroid) based on a relationship expression/column. Figure 1: Line Linkage Map Example You can customize the color of each point as well as the lines connecting each point. To style the point, a simple style can be applied. To style the line, a metric theme can be applied to group values. There are various ways to create line linkage maps; using a named layer, using a named map with an overlay using named tables, using an inline defined line linkage in a map. However, they all have the 92 Spectrum Technology Platform 9.0

Chapter 8: Understanding Layers same basic structure. All linkage maps require two tables, a geometry and a linkage table. And all linkage maps need to define the relationship, metric, source, and destination expressions. The geometry table contains two important columns; a relationship and a geometry column. The relationship column is the column that contains the records that will be linked to the records in the source and destination columns in the linkage table. The values in the columns need to be the same. The geometry column is the column that contains the geometries to render the points for both the source and destination columns. The linkage table contains three important columns: a source, a destination, and a metric column. The source column is the starting location for a linkage, while the destination column is the end location for a linkage. These two columns must contain the same type of information as the relationship column in the geometry table. The metric column defines the actual linkage between the two points, and contains values that represent the line. This column is used to add themes or stylize the line. For example, the metric column might contain values of the number of flights between two cities. In this case you may want to make the connecting line thicker/thinner or styled differently depending on the number of flights. A LineLinkageLayer is represented in Spectrum Technology Platform in four ways: Embedded inline in a named map As a named layer In a SOAP request as an overlay In a REST request as an overlay with an in-memory table. LineLinkageLayer in Named Map Example This is an example of a named map with a LinkLinkageLayer named World Countries. <NamedMapDefinition version="mxp_namedresource_1_5" xmlns:gml="http://www.opengis.net/gml" xmlns="http://www.mapinfo.com/mxp" > <ConnectionSet/> <DataSourceDefinitionSet> <NamedDataSourceDefinitionRef id="id1" resourceid="/samples/namedtables/worldtable"/> <NamedDataSourceDefinitionRef id="id2" resourceid="/samples/namedtables/flightstable"/> </DataSourceDefinitionSet> <MapDefinition id="id3" name="mymap" alias=""> <DisplayConditions> <MapSize uom="mapinfo:imagesize pixel"> <ImageWidth>960</ImageWidth> <ImageHeight>800</ImageHeight> </MapSize> <ZoomAndCenter> <MapZoom uom="mapinfo:length mi">28014.44036</mapzoom> <gml:point srsname="mapinfo:coordsys 12,62,7,0"> <gml:coordinates>-5.4419258777052164,0</gml:coordinates> </gml:point> </ZoomAndCenter> <DisplayCoordSys> <SRSName>mapinfo:coordsys 12,62,7,0</SRSName> </DisplayCoordSys> <ResizeMethod>preserveZoom</ResizeMethod> <RasterConditions dither="halftone" rasterreprojectionresampling="cubicconvolution" rasterreprojection="none" truecolor="true" optimizerasterlayers="screen" optimizevectorlayers="screen"/> <RenderingOptions enableopacity="true" enableantialias="true"/> </DisplayConditions> <LayerList> <LineLinkageLayer id="id5" name="world Countries" alias="world_linelinkage" volatile="unknown"> Spectrum Spatial Developer Guide 93

Line Linkage Layer <Visibility visible="true"> <VisibleRange enabled="false"> <ZoomRange uom="mapinfo:length mi">0 0</ZoomRange> </VisibleRange> </Visibility> <GeometryTable> <DataSourceRef ref="id1" /> </GeometryTable> <LinkageTable> <DataSourceRef ref="id2" /> </LinkageTable> <SourcePointStyle> <NamedStyleRef resourceid="/samples/namedstyles/pointstylepin"/> </SourcePointStyle> <DestinationPointStyle> <NamedStyleRef resourceid="/samples/namedstyles/pointstylestar"/> </DestinationPointStyle> <RelationshipExpression>Country</RelationshipExpression> <MetricExpression>Metric</MetricExpression> <SourceExpression>Source_Airport</SourceExpression> <DestinationExpression>Destination_Airport</DestinationExpression> </LineLinkageLayer> <FeatureLayer id="id4" name="world" alias="world_feature" volatile="unknown"> <DataSourceRef ref="id1"/> </FeatureLayer> </LayerList> </MapDefinition> </NamedMapDefinition> Layer With Line Linkage Example This is an example of a named layer definition that contains a line linkage layer connecting the centroids of two points. <?xml version="1.0" encoding="utf-8"?> <NamedLayer version ="MXP_WorkSpace_1_5" xmlns="http://www.mapinfo.com/mxp"> <ConnectionSet /> <DataSourceDefinitionSet> <NamedDataSourceDefinitionRef id="id4" resourceid="/samples/namedtables/worldtable"/> <NamedDataSourceDefinitionRef id="id5" resourceid="/samples/namedtables/flightstable"/> </DataSourceDefinitionSet> <LineLinkageLayer id="id9" name="world Countries" alias="world" volatile="unknown"> <Visibility visible="true"> <VisibleRange enabled="false"> <ZoomRange uom="mapinfo:length mi">0 0</ZoomRange> </VisibleRange> </Visibility> <GeometryTable> <DataSourceRef ref="id4" /> </GeometryTable> <LinkageTable> <DataSourceRef ref="id5" /> </LinkageTable> <SourcePointStyle> <PointStyle> <FontSymbol text="#" size="12" size-unit="mapinfo:length pt" 94 Spectrum Technology Platform 9.0

Chapter 8: Understanding Layers stroke="rgb(0,0,0)" stroke-opacity="1" family="mapinfo 3.0 Compatible"/> </PointStyle> </SourcePointStyle> <DestinationPointStyle> <PointStyle> <FontSymbol text="#" size="12" size-unit="mapinfo:length pt" stroke="rgb(0,0,0)" stroke-opacity="1" family="mapinfo 3.0 Compatible"/> </PointStyle> </DestinationPointStyle> <RelationshipExpression>Country</RelationshipExpression> <MetricExpression>Metric</MetricExpression> <SourceExpression>Source_Airport</SourceExpression> <DestinationExpression>Destination_Airport</DestinationExpression> </LineLinkageLayer> </NamedLayer> Label Layer A label layer contain the definition of labels based on the features in one or more data sources. Labels typically contain the name of feature, but can also contain derived information as the result of an expression. Each label source controls the visibility, base label properties and themes applied to a label layer. An optional attribute "maxlabels" limits the total number of labels that actually display. If more than one data source exists, a LabelSourceList determines the default priority of label layers: the bottommost label source on the list has the lowest priority. Label properties determine the visibility, style, placement, and priority of the labels. Themes control how the label properties are applied: LabelOverrideTheme - applies a single LabelProperties to every feature label in the label source. LabelRangeTheme - applies LabelProperties to each feature label in the data source based on the mapping of the feature to a range bin. LabelIndividualValueTheme - applies a LabelProperties to every feature label in the data source that matches a specific scalar value. LabelSelectionTheme - applies LabelProperties to the label of every feature that satisfies one or more selection conditions. The display size of the labels in a label theme can be scaled to a specific view based on a reference scale. For example, 16 pt labels at 1:50:000 would display as 32 pt labels when scaled at 1:25:000. Object themes, such as graduated symbols, can be applied to labels to show relative size based on a feature attribute. A Label Layer is represented in Spectrum Technology Platform in four ways: Embedded inline in a named map (table and styles can be modified) As a named layer (table and styles can be modified) In a SOAP request as an overlay (label properties cannot be modified) In a REST request as an overlay with an in-memory table (label properties cannot be modified). Layer With Labels Example This is an example of a named layer definition that contains labels. Spectrum Spatial Developer Guide 95

Label Layer <?xml version="1.0" encoding="utf-8"?> <NamedLayer version="mxp_namedresource_1_5" xmlns="http://www.mapinfo.com/mxp"> <ConnectionSet /> <DataSourceDefinitionSet> <TABFileDataSourceDefinition id="id4" readonly="false"> <DataSourceName>worldcap</DataSourceName> <FileName>E:\Spectrum/server/modules/spatial/samples/data/world/worldcap.tab</FileName> </TABFileDataSourceDefinition> </DataSourceDefinitionSet> <LabelLayer id="id6" name="labels" alias="layer2" volatile="unknown"> <Visibility visible="true"> <VisibleRange enabled="false"> <ZoomRange uom="mapinfo:length mi">0 0</ZoomRange> </VisibleRange> </Visibility> <LabelSourceList> <LabelSource maxlabels="2147483647" name="world Countries"> <Visibility visible="true"> <VisibleRange enabled="true"> <ZoomRange uom="mapinfo:length mi">0 6000</ZoomRange> </VisibleRange> </Visibility> <DataSourceRef ref="id4" /> <BaseLabelProperties> <LabelProperties> <LabelVisibility visible="true" allowoverlap="true" allowduplicates="all" allowoutofview="false"> <VisibleRange enabled="false"> <ZoomRange uom="mapinfo:length mi">0 100000 </ZoomRange> </VisibleRange> </LabelVisibility> <LabelText justification="center"> <BaseLabelStyle> <FontStyle family="microsoft Sans Serif" font-style="normal" effect="white" effect-opacity="1" effect-type="none" font-weight="normal" text-decoration="none" text-case="default" shadow="false" expand="false" size="12" size-unit="mapinfo:length pt" stroke="black"/> </BaseLabelStyle> <StringTokenList> <StringToken> <StringValueExpression> <AttributeName>Country</AttributeName> </StringValueExpression> </StringToken> </StringTokenList> <LabelCharacterLimit spacing="1">2147483647</labelcharacterlimit> </LabelText> <LabelCallout visible="false" end="arrow"> <LineStyle stroke="black" stroke-opacity="1" width="1" width-unit="mapinfo:imagesize pixel"> <Pen>mapinfo:pen 2</Pen> </LineStyle> </LabelCallout> <LabelReferencePosition recalculate="outofview"> <LineLabelPositionInterval>0</LineLabelPositionInterval> </LabelReferencePosition> <LabelLayout> <Alignment> <HorizontalAlignment>center</HorizontalAlignment> <VerticalAlignment>center</VerticalAlignment> </Alignment> <Offset uom="mapinfo:imagesize pixel"> <XOffset>0</XOffset> 96 Spectrum Technology Platform 9.0

Chapter 8: Understanding Layers <YOffset>0</YOffset> </Offset> <LabelAngle uom="degrees" origin="referencepoint">0</labelangle> </LabelLayout> <LabelBaseSize usescale="false"> <MapScale>0</MapScale> </LabelBaseSize> <LabelPriority> <MajorPriority> <NumericValueExpression> <MapinfoNumericExpression/> </NumericValueExpression> </MajorPriority> <MinorPriority> <NumericValueExpression> <MapinfoNumericExpression/> </NumericValueExpression> </MinorPriority> </LabelPriority> </LabelProperties> </BaseLabelProperties> <LabelThemeList/> </LabelSource> </LabelSourceList> </LabelLayer> </NamedLayer> Graduated Symbol Layer Graduated symbol layers are object themes that use symbols to represent different values. You can use graduated symbols regardless of the type of map object with which you are working. Graduated symbols maps work best when you use numeric data. Symbols can be displayed for positve and negative values. You can also specify the scale of the view at which a symbol is rendered. This means the symbol will be scaled up or down depending on the scale of the view relative to the reference scale on the Graduated Symbol layer. SymbolBaseSize is available both in the Graduated Symbol layer in the Repository as a Named Layer and also available in the GraduatedSymbolLayer overlay used on the Mapping Service s RenderNamedMapWithOverlay and RenderMap methods. Spectrum Spatial Developer Guide 97

Graduated Symbol Layer A GraduatedSymbolLayer is represented in Spectrum Technology Platform in four ways: Embedded inline in a named map As a named layer In a SOAP request as an overlay In a REST request as an overlay with an in-memory table. Graduated Symbol Theme Definition This is an example of a definition for a graduated symbol theme: <ObjectThemeLayer id="id5" name="graduated Symbol Theme" alias="graduated Symbol Theme id5"> <DataSourceRef ref="id4" /> <FeatureGraduatedSymbolTheme id="id7"> <Alignment> <HorizontalAlignment>center</HorizontalAlignment> <VerticalAlignment>center</VerticalAlignment> </Alignment> <SymbolBaseSize usescale="false"> <MapScale>1</MapScale> <DataValueAtSize>23</DataValueAtSize> <PositiveSymbol> <PointStyle> <FontSymbol text=""" size="36" size-unit="mapinfo:length pt" stroke="rgb(255,0,0)" stroke-opacity="1" family="mapinfo 3.0 Compatible" /> </PointStyle> </PositiveSymbol> <SymbolGraduation>sqrt</SymbolGraduation> </SymbolBaseSize> 98 Spectrum Technology Platform 9.0

Chapter 8: Understanding Layers <SymbolLayout /> <NumericValueExpression> <AttributeName>Indust_Growth</AttributeName> </NumericValueExpression> </FeatureGraduatedSymbolTheme> </ObjectThemeLayer> Graduated Symbol Theme SOAP Request This is an example of a SOAP mapping service request for a map containing a graduated symbol theme where a reference scale of 10,000,000 has been set using SymbolBaseSize. For a demo of the request, go to the Mapping Service Demo Page. Notice the size of the graduated symbols. If you change the ZoomLevel from 3000 to 1500, and re-submit the request, the resulting graduated symbols will appear about twice as large as the original request. <?xml version="1.0"?> <S:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://www.mapinfo.com/midev/service/mapping/v1" xmlns:ns2="http://www.mapinfo.com/midev/service/geometries/v1" xmlns:ns3="http://www.mapinfo.com/midev/service/featurecollection/v1" xmlns:ns4="http://www.mapinfo.com/midev/service/style/v1" xmlns:ns5="http://www.mapinfo.com/midev/service/table/v1" xmlns:ns7="http://www.mapinfo.com/midev/service/theme/v1" xmlns:ns8="http://www.mapinfo.com/midev/service/mappingcommon/v1" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <S:Header/> <S:Body> <v1:rendermaprequest imagemimetype="image/png" returnimage="false"> <v1:mapview xsi:type="v1:zoomandcentermapview"> <v1:width>800.0</v1:width> <v1:height>600.0</v1:height> <v1:zoomlevel uom="mile">3000</v1:zoomlevel> <v1:mapcenter srsname="epsg:4269"> <ns2:pos> <ns2:x>-100</ns2:x> <ns2:y>42</ns2:y> </ns2:pos> </v1:mapcenter> </v1:mapview> <v1:map> <v1:layer xsi:type="v1:graduatedsymbollayer" valueatsize="200000" spatialexpression="obj" valueexpression="pop_1990" SymbolBaseSize="5000" graduationmethod="constant"> <ns5:table xsi:type="ns5:namedtable" name="/samples/namedtables/usa_caps"/> <v1:positivesymbol xsi:type="ns4:namedstyle" name="/samples/namedstyles/pointstylestar"/> <v1:symbolbasesize usescale= true > <v1:mapscale>10000000</v1:mapscale> </v1:symbolbasesize> </v1:layer> <v1:layer xsi:type="v1:featurelayer"> <ns5:table xsi:type="ns5:namedtable" name="/samples/namedtables/usa"/> </v1:layer> </v1:map> </v1:rendermaprequest> </S:Body> </S:Envelope> Spectrum Spatial Developer Guide 99

Bar Chart Layer Bar Chart Layer A bar chart layer contains an object theme that allows you to examine more than one variable per record at a time. A bar chart is built for every map object at the centroid of the object, enabling you to analyze the thematic variables in a particular chart by comparing the height of the bars. You can also examine the same variable across all the charts in your map. You can also change the type of bar chart. You can create a multi-bar chart, where each thematic variable has its own bar. Alternatively, you can create a stacked bar chart with each thematic variable on top of one another, or a graduated bar chart, where the bars are graduated in size based on some value. You can also scale the bars in a multi-bar chart independently from one another. Bar charts can be flat or three-dimensional. To show negative values in a bar chart map, the bars extend in the opposite direction to the chart's orientation. Note that negative values do not display in stacked bar charts. Bar Chart Theme Definition This is an example of a definition for a bar chart theme: <ObjectThemeLayer id="id5" name="bar Theme" alias="bar Theme id5"> <DataSourceRef ref="id4" /> <FeatureBarTheme id="id7"> <Alignment> <HorizontalAlignment>center</HorizontalAlignment> <VerticalAlignment>bottom</VerticalAlignment> </Alignment> <BarBaseSize usescale="true"> <MapScale>40653992.6</MapScale> <DataValueAtSize>6800000</DataValueAtSize> <Height uom="mapinfo:length in">1</height> 100 Spectrum Technology Platform 9.0

Chapter 8: Understanding Layers <Width uom="mapinfo:length in">0.5</width> <BarGraduation>const</BarGraduation> </BarBaseSize> <BarLayout> <BarBaselineAngle uom="degrees">0</barbaselineangle> <SideBySideBars independentsize="false" order="lefttoright" /> </BarLayout> <BarDefinitionList> <BarDefinition> <NumericValueExpression> <AttributeName>Pop_Lt_15</AttributeName> </NumericValueExpression> <AreaStyle> <Interior fill-opacity="1" fill="rgb(255,0,0)" /> </AreaStyle> </BarDefinition> <BarDefinition> <NumericValueExpression> <AttributeName>Pop_16_64</AttributeName> </NumericValueExpression> <AreaStyle> <Interior fill-opacity="1" fill="rgb(0,255,0)" /> </AreaStyle> </BarDefinition> <BarDefinition> <NumericValueExpression> <AttributeName>Pop_65Plus</AttributeName> </NumericValueExpression> <AreaStyle> <Interior fill-opacity="1" fill="rgb(0,0,255)" /> </AreaStyle> </BarDefinition> </BarDefinitionList> </FeatureBarTheme> </ObjectThemeLayer> Bar Chart Theme SOAP Request This is an example of a SOAP mapping service request for a map containing a bar chart theme. For a demo of the request, go to the Mapping Service Demo Page. <?xml version="1.0"?> <S:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://www.mapinfo.com/midev/service/mapping/v1" xmlns:ns3="http://www.mapinfo.com/midev/service/geometries/v1" xmlns:ns5="http://www.mapinfo.com/midev/service/table/v1" xmlns:ns4="http://www.mapinfo.com/midev/service/style/v1" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <S:Header/> <S:Body> <v1:rendermaprequest imagemimetype="image/png" returnimage="false"> <v1:mapview xsi:type="v1:zoomandcentermapview"> <v1:width>800.0</v1:width> <v1:height>600.0</v1:height> <v1:zoomlevel uom="mile">3000</v1:zoomlevel> <v1:mapcenter srsname="epsg:4269"> <ns3:pos> <ns3:x>-101.0</ns3:x> <ns3:y>42.0</ns3:y> </ns3:pos> </v1:mapcenter> </v1:mapview> Spectrum Spatial Developer Guide 101

Pie Chart Layer <v1:map> <v1:layer xsi:type="v1:barlayer" verticalalignment="bottom" horizontalalignment="center" charteffecttype="as3d"> <ns5:table xsi:type="ns5:namedtable" name="/samples/namedtables/usa"/> <v1:graduation graduationmethod="constant"> <v1:valueatsize>7000000</v1:valueatsize> </v1:graduation> <v1:border xsi:type="ns4:namedstyle" name="/samples/namedstyles/linestylesolid"/> <v1:categorylist> <v1:category expression="pop_2000" description="pop_2000"> <ns4:style xsi:type="ns4:namedstyle" name="/samples/namedstyles/areastyleblue"/> </v1:category> <v1:category expression="pop_male" description="pop_male"> <ns4:style xsi:type="ns4:namedstyle" name="/samples/namedstyles/areastylegreen"/> </v1:category> <v1:category expression="pop_female" description="pop_female"> <ns4:style xsi:type="ns4:namedstyle" name="/samples/namedstyles/areastylered"/> </v1:category> </v1:categorylist> <v1:barbasesize usescale="true"> <v1:mapscale>2.28096e7</v1:mapscale> </v1:barbasesize> </v1:layer> <v1:layer xsi:type="v1:featurelayer"> <ns5:table xsi:type="ns5:namedtable" name="/samples/namedtables/usa"/> </v1:layer> </v1:map> </v1:rendermaprequest> </S:Body> </S:Envelope> Pie Chart Layer A pie chart layer contains an object theme that enables you to examine more than one variable per record at a time. Like comparing the height of the bars in bar charts, in pie charts you compare the wedges in a single pie, or examine a particular wedge across all pies. Pie charts enable you to compare parts of a whole. Both pie and bar charts are particularly useful for analyzing demographic data. For example, you have a table of demographic information for the United States. Your table shows the populations of several major demographic groups. Using pie charts, you can show the population of each demographic group, and see what fraction of the pie it makes up in each pie. This enables you to see the distribution of demographic groups on a per state basis, or across the entire United States. You can also look at one demographic group and see how the population of the group varies in different states. For best results, use no more than four to six pie wedges per pie chart in your analysis. 102 Spectrum Technology Platform 9.0

Chapter 8: Understanding Layers Pie Chart Theme Definition This is an example of a definition for a pie chart theme: <ObjectThemeLayer id="id5" name="pie Theme" alias="pie Theme id5"> <DataSourceRef ref="id4" /> <FeaturePieTheme id="id7"> <Alignment> <HorizontalAlignment>center</HorizontalAlignment> <VerticalAlignment>center</VerticalAlignment> </Alignment> <PieBaseSize usescale="true"> <MapScale>40653992.6</MapScale> <DataValueAtSize>11000000</DataValueAtSize> <Diameter uom="mapinfo:length in">1</diameter> <PieGraduation>sqrt</PieGraduation> </PieBaseSize> <PieLayout graduatedsize="true"> <PieStartAngle uom="degrees">180</piestartangle> <PieDirection>clockwise</PieDirection> <PieArea>full</PieArea> </PieLayout> <WedgeDefinitionList> <WedgeDefinition> <NumericValueExpression> <AttributeName>Pop_Lt_15</AttributeName> </NumericValueExpression> <AreaStyle> <LineStyle stroke="rgb(0,0,0)" stroke-opacity="1" width="1" width-unit="mapinfo:imagesize pixel"> <Pen>mapinfo:pen 2</Pen> </LineStyle> <Interior fill-opacity="1" fill="rgb(255,0,0)" /> </AreaStyle> </WedgeDefinition> <WedgeDefinition> <NumericValueExpression> <AttributeName>Pop_16_64</AttributeName> </NumericValueExpression> Spectrum Spatial Developer Guide 103

Pie Chart Layer <AreaStyle> <LineStyle stroke="rgb(0,0,0)" stroke-opacity="1" width="1" width-unit="mapinfo:imagesize pixel"> <Pen>mapinfo:pen 2</Pen> </LineStyle> <Interior fill-opacity="1" fill="rgb(0,255,0)" /> </AreaStyle> </WedgeDefinition> <WedgeDefinition> <NumericValueExpression> <AttributeName>Pop_65Plus</AttributeName> </NumericValueExpression> <AreaStyle> <LineStyle stroke="rgb(0,0,0)" stroke-opacity="1" width="1" width-unit="mapinfo:imagesize pixel"> <Pen>mapinfo:pen 2</Pen> </LineStyle> <Interior fill-opacity="1" fill="rgb(0,0,255)" /> </AreaStyle> </WedgeDefinition> </WedgeDefinitionList> </FeaturePieTheme> </ObjectThemeLayer> Pie Chart Theme SOAP Request This is an example of a SOAP mapping service request for a map containing a pie chart theme. For a demo of the request, go to the Mapping Service Demo Page. <?xml version="1.0"?> <S:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://www.mapinfo.com/midev/service/mapping/v1" xmlns:ns3="http://www.mapinfo.com/midev/service/geometries/v1" xmlns:ns4="http://www.mapinfo.com/midev/service/style/v1" xmlns:ns5="http://www.mapinfo.com/midev/service/table/v1" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <S:Header/> <S:Body> <v1:rendermaprequest imagemimetype="image/png" returnimage="false"> <v1:mapview xsi:type="v1:zoomandcentermapview"> <v1:width>800.0</v1:width> <v1:height>600.0</v1:height> <v1:zoomlevel uom="mile">3000.0</v1:zoomlevel> <v1:mapcenter srsname="epsg:4269"> <ns3:pos> <ns3:x>-100.0</ns3:x> <ns3:y>42.0</ns3:y> </ns3:pos> </v1:mapcenter> </v1:mapview> <v1:map name="/samples/namedmaps/mapwithpielayer"> <v1:layer xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:type="v1:pielayer" depthfactor="0.50" verticalalignment="middle" horizontalalignment="center" charteffecttype="as3d" charttype="full" startangle="180.0" wedgerenderdirection="clockwise"> <ns5:table xsi:type="ns5:namedtable" name="/samples/namedtables/usa"/> 104 Spectrum Technology Platform 9.0

Chapter 8: Understanding Layers <v1:categorylist> <v1:category expression="pop_2000" description="pop_2000"> <ns4:style xsi:type="ns4:namedstyle" name="/samples/namedstyles/areastyleblue"/> </v1:category> <v1:category expression="pop_male" description="pop_male"> <ns4:style xsi:type="ns4:namedstyle" name="/samples/namedstyles/areastylegreen"/> </v1:category> <v1:category expression="pop_female" description="pop_female"> <ns4:style xsi:type="ns4:namedstyle" name="/samples/namedstyles/areastylered"/> </v1:category> </v1:categorylist> <v1:border xsi:type="ns4:namedstyle" name="/samples/namedstyles/linestylesolid"/> <v1:diameter uom="inch">1.0</v1:diameter> <v1:opacity>1.0</v1:opacity> <v1:graduation graduationmethod="square_root"> <v1:valueatsize>250000000</v1:valueatsize> </v1:graduation> <v1:spatialexpression>obj</v1:spatialexpression> <v1:piebasesize usescale="true"> <v1:mapscale>2.28096e7</v1:mapscale> </v1:piebasesize> </v1:layer> <v1:layer xsi:type="v1:namedlayer" name="/samples/namedlayers/layerwithtable" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"/> </v1:map> </v1:rendermaprequest> </S:Body> </S:Envelope> Line Chart Layer A line chart layer contains an object theme that displays information as a series of data points connected by line segments. Like bar and pie charts, this enables you to examine more than one variable per record at a time. Line charts are composed of a chart with horizontal and vertical axes that represent the range of data values. The line connects the data points at the appropriate locations along the axes. A grid pattern is provided to aid in visualization. Spectrum Spatial Developer Guide 105

Line Chart Layer Line Chart Theme Definition This is an example of a definition for a FeatureLineChartTheme. This would be included in a named layer defintion. <ObjectThemeLayer id="id5" name="world LineChart Layer" alias="worldlinechartlayer"> <DataSourceRef ref="id1" /> <FeatureLineChartTheme id="id7"> <ChartBaseSize usescale="true"> <MapScale>40653992.6</MapScale> <Height uom="mapinfo:length in">1</height> <Width uom="mapinfo:length in">0.5</width> </ChartBaseSize> <ChartLayout visibleoutline="true"> <AreaStyle> <LineStyle stroke="rgb(0,0,0)" stroke-opacity="1" width="1" width-unit="mapinfo:imagesize pixel"> <Pen>mapinfo:pen 2</Pen> </LineStyle> <Interior fill-opacity="1" fill="(#id8)"> <Defs> <Pattern id="id8"> <Bitmap uri="mapinfo:brush 1"> <ColorAdjustmentSet> <ColorAdjustment color-1="nonwhite" color-2="rgb(153,204,255)" opacity="1" /> <ColorAdjustment color-1="rgb(153,204,255)" color-2="rgb(153,204,255)" opacity="1" /> </ColorAdjustmentSet> </Bitmap> </Pattern> </Defs> </Interior> </AreaStyle> </ChartLayout> <ChartLine> <LineStyle stroke="rgb(0,0,0)" stroke-opacity="1" width="1" width-unit="mapinfo:imagesize pixel"> <Pen>mapinfo:pen 2</Pen> </LineStyle> </ChartLine> <LineChartDefinitionList> <LineChartDefinition> <NumericValueExpression> <AttributeName>Pop_Male</AttributeName> </NumericValueExpression> 106 Spectrum Technology Platform 9.0

Chapter 8: Understanding Layers <LegendRowOverride visible="false" /> </LineChartDefinition> <LineChartDefinition> <NumericValueExpression> <AttributeName>Pop_Fem</AttributeName> </NumericValueExpression> <LegendRowOverride> <Text>Legend 1</Text> </LegendRowOverride> </LineChartDefinition> <LineChartDefinition> <NumericValueExpression> <AttributeName>Pop_1994</AttributeName> </NumericValueExpression> <LegendRowOverride visible="true"> <Text>Legend 2</Text> </LegendRowOverride> </LineChartDefinition> </LineChartDefinitionList> </FeatureLineChartTheme> </ObjectThemeLayer> Line Chart Theme SOAP Request This is an example of a SOAP mapping service request for a map containing a line chart theme. For a demo of the request, go to the Mapping Service Demo Page. <?xml version="1.0"?> <S:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://www.mapinfo.com/midev/service/mapping/v1" xmlns:ns3="http://www.mapinfo.com/midev/service/geometries/v1" xmlns:ns5="http://www.mapinfo.com/midev/service/table/v1" xmlns:ns4="http://www.mapinfo.com/midev/service/style/v1" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <S:Header/> <S:Body> <v1:rendermaprequest imagemimetype="image/png" returnimage="false" > <v1:mapview xsi:type="v1:zoomandcentermapview"> <v1:width>800.0</v1:width> <v1:height>600.0</v1:height> <v1:zoomlevel uom="mile">1000</v1:zoomlevel> <v1:mapcenter srsname="epsg:4269"> <ns3:pos> <ns3:x>-98.0</ns3:x> <ns3:y>43.0</ns3:y> </ns3:pos> </v1:mapcenter> </v1:mapview> <v1:map> <v1:layer xsi:type="v1:linechartlayer"> <ns5:table xsi:type="ns5:namedtable" name="/samples/namedtables/usa"/> <!-- line customization --> <v1:line xsi:type="ns4:namedstyle" name="/samples/namedstyles/linestylesolid"/> <!-- dataset --> <v1:categorylist> <v1:category expression="pop_2000" description="pop_2000" applystyle="false"> <ns4:style xsi:type="ns4:namedstyle" name="/samples/namedstyles/pointstylepin"/> </v1:category> <v1:category expression="pop_male" description="pop_male"> Spectrum Spatial Developer Guide 107

Grid Layer <ns4:style xsi:type="ns4:namedstyle" name="/samples/namedstyles/compositestyle"/> </v1:category> <v1:category expression="pop_female" description="pop_female"> <ns4:style xsi:type="ns4:namedstyle" name="/samples/namedstyles/pointstylestar"/> </v1:category> </v1:categorylist> <v1:chartwidth uom="pixel">300</v1:chartwidth> <v1:chartheight uom="pixel">300</v1:chartheight> <v1:opacity>0.5</v1:opacity> <!-- Scaling support --> <v1:chartbasesize usescale="true"> <v1:mapscale>0.28096e7</v1:mapscale> </v1:chartbasesize> <!-- Domain axis customization --> <v1:domainaxis visible="true" label="true"> <ns4:style xsi:type="ns4:namedstyle" name="/samples/namedstyles/linestyledash"/> </v1:domainaxis> <!-- Range axis customization --> <v1:rangeaxis visible="true" label="true"> <ns4:style xsi:type="ns4:namedstyle" name="/samples/namedstyles/linestyledash"/> </v1:rangeaxis> <!-- line chart plot customization --> <v1:chart visibleoutline="false"> <ns4:style xsi:type="ns4:namedstyle" name="/samples/namedstyles/compositestyle"/> <v1:domaingrid visible="true" > <ns4:style xsi:type="ns4:namedstyle" name="/samples/namedstyles/linestyledash"/> </v1:domaingrid> <v1:rangegrid visible="true" > <ns4:style xsi:type="ns4:namedstyle" name="/samples/namedstyles/linestyledash"/> </v1:rangegrid> </v1:chart> </v1:layer> <v1:layer xsi:type="v1:featurelayer"> <ns5:table xsi:type="ns5:namedtable" name="/samples/namedtables/usa"/> </v1:layer> </v1:map> </v1:rendermaprequest> </S:Body> </S:Envelope> Grid Layer A grid is an overlay layer that shows a continuous gradation of color to represent interpolated values from the underlying data. In Spectrum Technology Platform user-controlled properties of a grid include brightness, contrast, opacity, grayscale, transparency, and an inflection collection (how the colors are defined and spread). See Supported Raster Formats on page 166 for further information. A grid is a raster that is generated from a sparse set of points and their values. A raster is made up of pixels, each with a value. During the interpolation process, every pixel value is assigned an estimated value influenced by the known data values, interpolator weighting algorithm and aggregation method. Once the grid is created, the known and interpolated values are grouped into inflections (bins) and 108 Spectrum Technology Platform 9.0

Chapter 8: Understanding Layers assigned colors. When the grid is displayed, the colors are spread evenly to reflect the gradation of values. Grids are created on the fly as part of a mapping service request. They are not stored in the repository as a named layer. Additionally, previously created grids from grid creation tools can be displayed as the results of a service request. Spectrum Technology Platform supports grids in the following formats: MapInfo Grid (.mig), Vertical Mapper Continuous (.grd), Vertical Mapper Classified (.grc, view only) and Defense Digital Terrain Elevation Data (DTED dt0,.dt1,.dt2,.dt3). Spectrum Technology Platform supports the IDW interpolator (inverse distance weighting) that is suitable for most grid applications, including sparse data sets. For more information on the schema elements for grids, see GridLayer Elements on page 169 Related Links Rasters and Grids on page 165 Grid Example The following Java code shows how to create a GridLayer and use it in a request for a named map. This sample is available in the JAXB_Samples.zip in the mapping folder. For an explanation of the GridLayer elements, see GridLayer Elements. public class RenderNamedMapWithGridLayerOverlay { public static void main(string[] args) { try { MappingServiceInterface mapping = Preference.getServiceinterface(); Point mapcenter = BuildGeometry.buildPoint("mapinfo:coordsys 12, 62, 7, 0.0", 0, 0, null); MapView mapview = MappingView.getZoomAndCenterMapView(mapCenter,MappingUtility.buildDistance(19000, DistanceUnit.KILOMETER)); NamedTable namedtable = new NamedTable(); namedtable.setname("/namedtables/worldcaptable"); Distance cellwidth = MappingUtility.buildDistance(50, DistanceUnit.MILE); IDWInterpolator interpolator = new IDWInterpolator(); interpolator.setaggregationmethod(aggregationmethod.average); interpolator.setexponent(2); Spectrum Spatial Developer Guide 109

Grid Layer interpolator.setmaxpoints(25); interpolator.setsearchradius(100); CustomInflectionCollection inflectioncollection = new CustomInflectionCollection(); inflectioncollection.setinflectionmethod(inflectionmethod.equal_count); inflectioncollection.setroundby(0.1); InflectionColorBinList inbinlist = new InflectionColorBinList(); InflectionColorBin red = new InflectionColorBin(); red.setcolor("red"); inbinlist.getinflectioncolorbin().add(red); InflectionColorBin yellow = new InflectionColorBin(); yellow.setcolor("yellow"); inbinlist.getinflectioncolorbin().add(yellow); InflectionColorBin green = new InflectionColorBin(); green.setcolor("green"); inbinlist.getinflectioncolorbin().add(green); InflectionColorBin rgb = new InflectionColorBin(); rgb.setcolor("rgb(0,255,255)"); inbinlist.getinflectioncolorbin().add(rgb); InflectionColorBin blue = new InflectionColorBin(); blue.setcolor("blue"); inbinlist.getinflectioncolorbin().add(blue); inflectioncollection.setinflectioncolorbinlist(inbinlist); //Creating GridEnvelope List<Pos> pointlist = new ArrayList<Pos>(2); pointlist.add(buildgeometry.buildpos(-1.6190368438028984e7, -5501153.098687401, null)); pointlist.add(buildgeometry.buildpos(1.6606614137907444e7, 6743291.671893631, null)); Envelope gridenvelope = BuildGeometry.buildEnvelope("mapinfo:coordsys 12, 62, 7, 0.0", pointlist); //Creating GridLayer Layer gridlayer = MappingUtility.buildGridLayer(namedTable, null, cellwidth, "Cap_Pop", "Obj", interpolator, inflectioncollection, gridenvelope); RenderNamedMapWithOverlayRequest request = MappingServiceRequestBuilder.createRenderNamedMapOverlayRequest ("RenderNamedMapWithGridLayerOverlay","/NamedMaps/WorldMap", mapview, gridlayer); RenderNamedMapWithOverlayResponse response = mapping.rendernamedmapwithoverlay(request); PrintMappingResponse.printRenderNamedMapWithOverlayResponse(response); catch (ServiceException se) { PrintMappingResponse.printError(se); catch (Exception e) { e.printstacktrace(); 110 Spectrum Technology Platform 9.0

Chapter 8: Understanding Layers Modifying the Style with a FeatureStyleModifier To modify the style of a FeatureLayer or a LineLinkageLayer before it is drawn, use a FeatureStyleModifier. A FeatureStyleModifier is a construct that modifies the appearance of a feature in a table using specified criteria or algorithms. There are four types of style modifiers: Table 1: Modifier Style override Range Individual Value Dot Density A simple FeatureStyleModifier that applies a style to the layer without condition. Applies a style to each feature geometry based on the placement of the feature's numeric data value in a set of numeric ranges. The numeric data value may be the contents of a single numeric valued attribute or the result of evaluating a numeric valued expression. Also contains optional data that defines the constraints used to calculate the bins and styles and an associated legend. Applies a style to a feature geometry based on an equality match against the feature's data value. The data value may be the value of a single attribute or the result of evaluating an expression. Also contains optional data that defines an associated legend. Uses the density of placement of a "dot" to represent a numeric value associated with a feature. The number of dots that display is the ratio of the feature's numeric value to the value that each dot represents (DensityValueExpression/ValuePerDot). The numeric value may be the contents of a single numeric attribute or the result of evaluating a numeric valued expression. Also contains optional data that defines the associated legend. Style Override A style override applies a single style to all features in a layer. FeatureStyleOverrideTheme Definition This is an example of a definition for a style override. It replaces the style of every feature in the table with this style. <FeatureStyleOverrideTheme id="id6" name="style Override" alias="featurestylemodifier2"> <CompositeStyle> <AreaStyle> <LineStyle width="1" width-unit="mapinfo:imagesize pixel"> <Pen>mapinfo:pen 9</Pen> </LineStyle> <Interior fill-opacity="1" fill="(#id8)"> <Defs> Spectrum Spatial Developer Guide 111

Modifying the Style with a FeatureStyleModifier <Pattern id="id8"> <Bitmap uri="mapinfo:brush 2"> <ColorAdjustmentSet> <ColorAdjustment color-1="nonwhite" color-2="rgb(224,255,176)" opacity="1"/> <ColorAdjustment color-1="white" color-2="white" opacity="1"/> </ColorAdjustmentSet> </Bitmap> </Pattern> </Defs> </Interior> </AreaStyle> <PointStyle> <FontSymbol size="18" size-unit="mapinfo:length pt" stroke="red" stroke-opacity="1" text="c" family="mapinfo Symbols"/> </PointStyle> <MapinfoTextObjectStyle> <FontStyle family="microsoft Sans Serif" font-style="normal" effect="white" effect-opacity="1" effect-type="none" font-weight="normal" text-decoration="none" text-case="default" shadow="false" expand="false" size="12" size-unit="mapinfo:length pt" stroke="black"/> <LineStyle stroke="black" stroke-opacity="1" width="1" width-unit="mapinfo:imagesize pixel"> <Pen>mapinfo:pen 2</Pen> </LineStyle> </MapinfoTextObjectStyle> </CompositeStyle> </FeatureStyleOverrideTheme> Style Override SOAP Request Example This is an example of a SOAP mapping service request for a map containing an override theme for a style override. To see the result of this request, copy and paste the XML into the Mapping Service Demo Page and click Submit. <?xml version="1.0"?> <S:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://www.mapinfo.com/midev/service/mapping/v1" xmlns:ns2="http://www.mapinfo.com/midev/service/table/v1" xmlns:ns3="http://www.mapinfo.com/midev/service/geometries/v1" xmlns:ns5="http://www.mapinfo.com/midev/service/theme/v1" xmlns:ns6="http://www.mapinfo.com/midev/service/style/v1" xmlns:ns7="http://www.mapinfo.com/midev/service/featurecollection/v1" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <S:Header /> <S:Body> <v1:rendermaprequest imagemimetype="image/png" returnimage="false"> <v1:mapview xsi:type="v1:zoomandcentermapview"> <v1:width>800.0</v1:width> <v1:height>600.0</v1:height> <v1:zoomlevel uom="mile">3700.0</v1:zoomlevel> <v1:mapcenter srsname="epsg:4269"> <ns3:pos> <ns3:x>-74.0</ns3:x> <ns3:y>42.0</ns3:y> </ns3:pos> </v1:mapcenter> </v1:mapview> <v1:map> <v1:layer xsi:type="v1:featurelayer"> <ns2:table xsi:type="ns2:namedtable" name="/samples/namedtables/usa"> </ns2:table> 112 Spectrum Technology Platform 9.0

Chapter 8: Understanding Layers <v1:themelist> <ns5:theme xsi:type="ns5:overridetheme" > <ns6:style xsi:type="ns6:namedstyle" name="/samples/namedstyles/areastylered" /> </ns5:theme> </v1:themelist> </v1:layer> </v1:map> </v1:rendermaprequest> </S:Body> </S:Envelope> Range Theme When you create a range thematic map, all records are grouped into ranges and each record's object is assigned the color, symbol, or line for its corresponding range. For example, if you wanted to visualize the population of the world by growth rate, you would shade countries according to their reported growth rate amounts. The growth rate amounts are grouped into ranges. All records are assigned to a range and then assigned a color based on that range. Types of Ranged Values You can create ranges using five methods: Equal Count Equal Ranges Natural Break (Standard Deviation) Quantile Custom Spectrum Spatial Developer Guide 113

Modifying the Style with a FeatureStyleModifier Equal Count Equal Count has the same number of records in each range. If you want to group 100 records into 4 ranges using Equal Count, the Equal Count method computes the ranges so that approximately 25 records fall into each range, depending on the rounding factor you set. When using Equal Count (or any other range method), it's important to watch out for any extreme data values that might affect your thematic map (in statistics, these values are referred to as outliers). Equal Ranges Equal Ranges divides records across ranges of equal size. For example, you have a field in your table with data values ranging from 1 to 100. You want to create a thematic map with four equal size ranges. The Equal Ranges method produces ranges 1-25, 25-50, 50-75, and 75-100. (Since ranges use "=>" and "<=", they need to overlap.) Keep in mind that the Equal Ranges method may create ranges with no data records, depending on the distribution of your data. Natural Break (Standard Deviation) Natural Break creates ranges according to an algorithm that uses the average of each range to distribute the data more evenly across the ranges. It distributes the values so that the average of each range is as close as possible to each of the range values in that range. This ensures that the ranges are well-represented by their averages, and that data values within each of the ranges are fairly close together. The Natural Break algorithm is based on the procedure described by Jenks and Caspall in their article "Error on Choroplethic Maps: Definition, Measurement, Reduction" from the Annals of American Geographers, June 1971. When you create ranges using Standard Deviation, the middle range breaks at the mean of your values, and the ranges above and below the middle range are one standard deviation above or below the mean. Quantile Quantiling enables you to build ranges that determine the distribution of a thematic variable across a segment of your data. For example, you can quantile state population by urban population to illustrate how urban population is distributed across the United States. Your map legend will not indicate that you have used Quantile to build your ranges. You can customize the map legend so that it shows which field you used to quantile the table. Custom Ranges Spectrum Technology Platform also suppports creating custom ranges. To set ranges manually, use Custom. FeatureStyleRangeTheme Example This is an example of a definition for a ranged theme: <FeatureStyleRangeTheme id="id6" alias="ranged Theme id6" name="ranges by Pop_1980"> <RangeValueExpression> <NumericValueExpression> <AttributeName>Pop_1980</AttributeName> </NumericValueExpression> </RangeValueExpression> <RangeThemeBaseStyle applystylepart="all"> <AreaStyle> <LineStyle 114 Spectrum Technology Platform 9.0

Chapter 8: Understanding Layers stroke="rgb(0,0,0)" stroke-opacity="1" width="1" width-unit="mapinfo:imagesize pixel"> <Pen>mapinfo:pen 2</Pen> </LineStyle> <Interior fill-opacity="1" fill="(#id7)"> <Defs> <Pattern id="id7"> <Bitmap uri="mapinfo:brush 42"> <ColorAdjustmentSet> <ColorAdjustment color-1="nonwhite" color-2="rgb(255,0,0)" opacity="1"/> <ColorAdjustment color-1="rgb(255,255,255)" color-2="rgb(255,255,255)" opacity="1"/> </ColorAdjustmentSet> </Bitmap> </Pattern> </Defs> </Interior> </AreaStyle> </RangeThemeBaseStyle> <RangeThemeBinSet> <RangeThemeBin> <NumericRange>400000 1900000</NumericRange> <CompositeStyle> <LineStyle stroke="rgb(0,0,0)" stroke-opacity="1" width="1" width-unit="mapinfo:imagesize pixel"> <Pen>mapinfo:pen 2</Pen> </LineStyle> <AreaStyle> <LineStyle stroke="rgb(0,0,0)" stroke-opacity="1" width="1" width-unit="mapinfo:imagesize pixel"> <Pen>mapinfo:pen 2</Pen> </LineStyle> <Interior fill-opacity="1" fill="(#id8)"> <Defs> <Pattern id="id8"> <Bitmap uri="mapinfo:brush 3"> <ColorAdjustmentSet> <ColorAdjustment color-1="nonwhite" color-2="rgb(0,0,0)" opacity="1"/> <ColorAdjustment color-1="rgb(255,255,255)" color-2="rgb(255,255,255)" opacity="1"/> </ColorAdjustmentSet> </Bitmap> </Pattern> </Defs> </Interior> </AreaStyle> <PointStyle> <FontSymbol text=""" size="12" size-unit="mapinfo:length pt" Spectrum Spatial Developer Guide 115

Modifying the Style with a FeatureStyleModifier color-1="rgb(255,255,255)" color-2="rgb(255,255,255)" stroke="rgb(0,0,0)" stroke-opacity="1" family="mapinfo 3.0 Compatible"/> </PointStyle> </CompositeStyle> </RangeThemeBin> <RangeThemeBin> <NumericRange>1900000 4600000</NumericRange> <CompositeStyle> <LineStyle stroke="rgb(128,0,0)" stroke-opacity="1" width="1" width-unit="mapinfo:imagesize pixel"> <Pen>mapinfo:pen 2</Pen> </LineStyle> <AreaStyle> <LineStyle stroke="rgb(0,0,0)" stroke-opacity="1" width="1" width-unit="mapinfo:imagesize pixel"> <Pen>mapinfo:pen 2</Pen> </LineStyle> <Interior fill-opacity="1" fill="rgb(128,0,0)"/> </AreaStyle> <PointStyle> <FontSymbol text=""" size="12" size-unit="mapinfo:length pt" stroke="rgb(128,0,0)" stroke-opacity="1" family="mapinfo 3.0 Compatible"/> </PointStyle> </CompositeStyle> </RangeThemeBin> <RangeThemeBin> <NumericRange>4600000 23700000</NumericRange> <CompositeStyle> <LineStyle stroke="rgb(255,0,0)" stroke-opacity="1" width="1" width-unit="mapinfo:imagesize pixel"> <Pen>mapinfo:pen 2</Pen> </LineStyle> <AreaStyle> <LineStyle stroke="rgb(0,0,0)" stroke-opacity="1" width="1" width-unit="mapinfo:imagesize pixel"> <Pen>mapinfo:pen 2</Pen> </LineStyle> <Interior fill-opacity="1" fill="(#id9)"> <Defs> <Pattern id="id9"> <Bitmap uri="mapinfo:brush 42"> <ColorAdjustmentSet> <ColorAdjustment color-1="nonwhite" color-2="rgb(255,0,0)" opacity="1"/> <ColorAdjustment 116 Spectrum Technology Platform 9.0

Chapter 8: Understanding Layers opacity="1"/> </ColorAdjustmentSet> </Bitmap> </Pattern> </Defs> </Interior> </AreaStyle> <PointStyle> <FontSymbol text=""" size="12" size-unit="mapinfo:length pt" stroke="rgb(255,0,0)" stroke-opacity="1" family="mapinfo 3.0 Compatible"/> </PointStyle> </CompositeStyle> </RangeThemeBin> <AllOthersStyle> <CompositeStyle> <LineStyle stroke="rgb(255,255,255)" stroke-opacity="1" width="1" width-unit="mapinfo:imagesize pixel"> <Pen>mapinfo:pen 2</Pen> </LineStyle> <AreaStyle> <LineStyle stroke="rgb(0,0,0)" stroke-opacity="1" width="1" width-unit="mapinfo:imagesize pixel"> <Pen>mapinfo:pen 2</Pen> </LineStyle> <Interior fill-opacity="1" fill="rgb(255,255,255)"/> </AreaStyle> <PointStyle> <FontSymbol text="(" size="12" size-unit="mapinfo:length pt" stroke="rgb(255,255,255)" stroke-opacity="1" family="mapinfo 3.0 Compatible"/> </PointStyle> </CompositeStyle> </AllOthersStyle> </RangeThemeBinSet> <RangeThemeBinValueConstraints> <RangeSpreadMethod allowemptyranges="false">equalcount</rangespreadmethod> <RoundTo>100000</RoundTo> </RangeThemeBinValueConstraints> <RangeThemeBinStyleConstraints spreadmethod="color"> <ColorSpreadMethod>rgb</ColorSpreadMethod> <SizeSpreadMethod>sqrt</SizeSpreadMethod> </RangeThemeBinStyleConstraints> </FeatureStyleRangeTheme> Spectrum Spatial Developer Guide 117

Modifying the Style with a FeatureStyleModifier Range Theme SOAP Request Example This is an example of a SOAP mapping service request for a map containing a range theme. For a demo of the request, go to the Mapping Service Demo Page. <?xml version="1.0"?> <S:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://www.mapinfo.com/midev/service/mapping/v1" xmlns:ns2="http://www.mapinfo.com/midev/service/table/v1" xmlns:ns3="http://www.mapinfo.com/midev/service/geometries/v1" xmlns:ns5="http://www.mapinfo.com/midev/service/theme/v1" xmlns:ns6="http://www.mapinfo.com/midev/service/style/v1" xmlns:ns7="http://www.mapinfo.com/midev/service/featurecollection/v1" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <S:Header /> <S:Body> <v1:rendermaprequest imagemimetype="image/png" returnimage="false"> <v1:mapview xsi:type="v1:zoomandcentermapview"> <v1:width>800.0</v1:width> <v1:height>600.0</v1:height> <v1:zoomlevel uom="mile">3000.0</v1:zoomlevel> <v1:mapcenter srsname="epsg:4269"> <ns3:pos> <ns3:x>-101.2345</ns3:x> <ns3:y>42.1345</ns3:y> </ns3:pos> </v1:mapcenter> </v1:mapview> <v1:map> <v1:layer xsi:type="v1:featurelayer"> <ns2:table xsi:type="ns2:namedtable" name="/samples/namedtables/usa" /> <v1:themelist> <ns5:theme xsi:type="ns5:rangetheme"> <ns5:startstyle xsi:type="ns6:namedstyle" name="/samples/namedstyles/areastyleblue" /> <ns5:endstyle xsi:type="ns6:namedstyle" name="/samples/namedstyles/areastylered" /> <ns5:rangethemeproperties xsi:type="ns5:rangethemeproperties" rangetype="equalcount" expression="pop_2000" numranges="6" /> </ns5:theme> </v1:themelist> </v1:layer> </v1:map> </v1:rendermaprequest> </S:Body> </S:Envelope> Individual Value Theme Individual value themes show points, lines, or boundaries that are shaded by individual values contained in a particular field or the result of an expression. You can use both numerical and nominal values in individual values maps. Each unique value is given its own color or symbol. When an individual values map uses symbol types, the symbols are taken from the base table. If you are shading your points, lines or boundaries using nominal data, you can shade only by individual values. Nominal data is either non-numerical data (name, type of cuisine served, or brand of automobile sold) or numeric data where the numbers represent non-numeric data like an ID number. Dates are considered numeric data and can be used in both ranged and individual values maps. 118 Spectrum Technology Platform 9.0

Chapter 8: Understanding Layers Individual Value Theme SOAP Request This is an example of a SOAP mapping service request for a map containing an individual value theme. For a demo of the request, go to the Mapping Service Demo Page. <?xml version="1.0"?> <S:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://www.mapinfo.com/midev/service/mapping/v1" xmlns:ns2="http://www.mapinfo.com/midev/service/table/v1" xmlns:ns3="http://www.mapinfo.com/midev/service/geometries/v1" xmlns:ns5="http://www.mapinfo.com/midev/service/theme/v1" xmlns:ns6="http://www.mapinfo.com/midev/service/style/v1" xmlns:ns7="http://www.mapinfo.com/midev/service/featurecollection/v1" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <S:Header/> <S:Body> <v1:rendermaprequest imagemimetype="image/png" returnimage="false"> <v1:mapview xsi:type="v1:zoomandcentermapview"> <v1:width>800.0</v1:width> <v1:height>600.0</v1:height> <v1:zoomlevel uom="mile">3000.0</v1:zoomlevel> <v1:mapcenter srsname="epsg:4269"> <ns3:pos> <ns3:x>-101.2345</ns3:x> <ns3:y>42.1345</ns3:y> </ns3:pos> </v1:mapcenter> </v1:mapview> <v1:map> <v1:layer xsi:type="v1:featurelayer"> <ns2:table xsi:type="ns2:namedtable" name="/samples/namedtables/usa"/> <v1:themelist> <ns5:theme expression="state" xsi:type="ns5:individualvaluetheme"> <ns5:binlist> <ns5:bin> <ns5:value xsi:type="ns7:stringvalue"> <ns7:value>ca</ns7:value> </ns5:value> <ns6:style xsi:type="ns6:namedstyle" name="/samples/namedstyles/areastyleblue"/> </ns5:bin> <ns5:bin> <ns5:value xsi:type="ns7:stringvalue"> <ns7:value>tx</ns7:value> </ns5:value> <ns6:style xsi:type="ns6:namedstyle" name="/samples/namedstyles/areastylegreen"/> </ns5:bin> </ns5:binlist> <ns5:allothers xsi:type="ns6:namedstyle" name="/samples/namedstyles/areastylered"/> </ns5:theme> Spectrum Spatial Developer Guide 119

Modifying the Style with a FeatureStyleModifier </v1:themelist> </v1:layer> </v1:map> </v1:rendermaprequest> </S:Body> Dot Density Theme Dot density themes use dots to represent the data value associated with a boundary or region. The total number of dots in a region represents that region's data value. If you have 10,000 senior citizens in a county, and each dot represents 100 senior citizens, there would be 100 dots in the county boundary. Dot density is particularly useful for showing raw data where one dot represents a large number of something: population, number of fast food restaurants, number of distributors who carry a brand of soda, etc. Distribution of dots is random within the region. If you shade states according to population, the dots for New York are spread out throughout the state; they are not concentrated in New York City, where the majority of the state's population lives. Named Layer with Dot Density Theme A dot density theme is a style modifier theme called a FeatureStyleDotDensityTheme. The schema is contained in MXP_MapTheme_1_5.xsd. A dot density theme is stored in the Spectrum Spatial repository as part of a named layer. The theme is defined by an expression whose value is the density for each feature; a value per dot, and a dot style. Dot density themes contain optional data for defining an associated legend, including style overrides and controlling visibility. For the schema see MXP_MapLegend_1_5.xsd. Dot Density Theme Definition This is an example of a definition for a dot density theme: <FeatureLayer id="id5" name="usa" alias="usa" volatile="unknown"> <DataSourceRef ref="id4"/> <FeatureStyleModifierThemeList> <FeatureStyleDensityTheme id="id6" alias="dot Density Theme id6" name="dot Density with Pop_1990"> <DensityValueExpression> <NumericValueExpression> <AttributeName>Pop_1990</AttributeName> 120 Spectrum Technology Platform 9.0

Chapter 8: Understanding Layers </NumericValueExpression> </DensityValueExpression> <ValuePerDot>600000</ValuePerDot> <DotStyle> <PointStyle> <FontSymbol text=""" size="4" size-unit="mapinfo:length pt" stroke="rgb(255,0,0)" stroke-opacity="1" family="mapinfo 3.0 Compatible"/> </PointStyle> </DotStyle> </FeatureStyleDensityTheme> </FeatureStyleModifierThemeList> </FeatureLayer> Dot Density Theme SOAP Request This is an example of a SOAP mapping service request for a map containing a dot density theme. <?xml version="1.0"?> <S:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://www.mapinfo.com/midev/service/mapping/v1" xmlns:ns3="http://www.mapinfo.com/midev/service/geometries/v1" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <S:Header/> <S:Body> <v1:rendermaprequest imagemimetype="image/png" returnimage="false"> <v1:mapview xsi:type="v1:zoomandcentermapview"> <v1:width>800.0</v1:width> <v1:height>600.0</v1:height> <v1:zoomlevel uom="mile">3700.0</v1:zoomlevel> <v1:mapcenter srsname="epsg:4269"> <ns3:pos> <ns3:x>-100.0</ns3:x> <ns3:y>42.0</ns3:y> </ns3:pos> </v1:mapcenter> </v1:mapview> <v1:map> <v1:layer xsi:type="v1:namedlayer" name="/test/dotdensity/usdotslayer" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"/> </v1:map> </v1:rendermaprequest> </S:Body> </S:Envelope> Spectrum Spatial Developer Guide 121

Using Styles 9 This section describes how to specify styles in requests, and how to define named styles. In this section: About Styles...................................124 MapBasic Styles................................125 Named Styles..................................132 Pattern Codes..................................161 Symbol Codes..................................162

About Styles About Styles Styles enable you to control the visual appearance of your maps by specifying the visual characteristics of various map elements, such as lines, filled areas, and symbols. You specify the styles you want to use to display a map when you submit the XML request for the map. Specifying Styles There are two ways to specify styles when you submit an XML request for a map. The first way is to specify the styles for lines, filled areas, and so on, by listing them directly in the XML request. See Specifying MapBasic Styles on page 124 for more information. The second way is to define a named style in a file, then add the file to a JCR repository that is accessible to the Repository Service. You can then refer to the named style file in your XML request. See Specifying Named Styles on page 124 for more information. Specifying MapBasic Styles MapBasic styles are based on the style clauses for Pen, Brush and Symbol available in the MapBasic language. To specify a MapBasic style when requesting a map, you add the MapBasic style settings directly into the XML request. For example, to display a ranged theme using a <MapBasicPen> style, your XML request would contain lines such as the following: <ns5:startstyle xsi:type="ns6:mapbasiclinestyle"> <ns6:mapbasicpen> <ns6:width>1</ns6:width> <ns6:pattern>81</ns6:pattern> <ns6:color>red</ns6:color> </ns6:mapbasicpen> </ns5:startstyle> For information about the MapBasic style elements you can add to an XML request, see MapBasic Styles on page 125. Specifying Named Styles A named style is a collection of related style settings that have been placed in a file. The file, in turn, is added to a JCR content repository that is accessible to the Repository Service. When you are requesting a map, and you want the map to use a named style, you add a reference to the file that contains the named style in the XML request. For example, to display a map overlay using an <AreaStyle> that is contained in a file named AreaStyleGreen and which has been added to a JCR repository under a directory named NamedStyles, your XML request would contain a line such as the following: <v3:style xsi:type="v3:namedstyle" name="/namedstyles/areastylegreen" xmlns:v3="http://www.mapinfo.com/midev/service/style/v1"/> For information about the elements you can add to a named style, see Named Styles on page 132. 124 Spectrum Technology Platform 9.0

Chapter 9: Using Styles Defining Named Styles To define a named style: 1. Add the relevant named style elements, and the desired content for each element, into an XML file. Note: The root element of the XML file must be <NamedStyle version="mxp_workspace_1_5" xmlns="http://www.mapinfo.com/mxp">. 2. Add the file into a JCR repository that is accessible to the Repository Service. An example of a typical named style file is shown here: <?xml version="1.0" encoding="utf-8"?> <NamedStyle version="mxp_workspace_1_5" xmlns="http://www.mapinfo.com/mxp"> <LineStyle stroke="black" stroke-opacity="1" width="1" width-unit="mapinfo:imagesize pixel"> <Pen>mapinfo:pen 9</Pen> </LineStyle> </NamedStyle> After you have added the named style file to the repository, you can reference the named style in your XML request by specifying the path and filename of the XML file. MapBasic Styles When you want to specify MapBasic style elements in an XML request, you provide your style element (such as a <StartStyle> element) with a type attribute that has one of the following values: MapBasicLineStyle MapBasicAreaStyle MapBasicPointStyle MapBasicTextStyle MapBasicCompositeStyle For example: <ns5:startstyle xsi:type="ns6:mapbasiclinestyle"> <ns6:mapbasicpen> <ns6:width>1</ns6:width> <ns6:pattern>81</ns6:pattern> <ns6:color>red</ns6:color> </ns6:mapbasicpen> </ns5:startstyle> Spectrum Spatial Developer Guide 125

MapBasic Styles MapBasicLineStyle A style of type MapBasicLineStyle specifies the visual characteristics of a line. The style can contain a MapBasicPen element. MapBasicPen The MapBasicPen element defines a style for a linear object such as a line, polyline arc, or the border of a region. Elements Table 2: Elements on page 126 lists the elements that can be contained by a MapBasicPen element. Table 2: Elements Element Width Pattern Color An integer value from 0 to 7 specifying the thickness of the line (in pixels). To create an invisible line style, specify a width of 0 and a pattern value of 1. An integer value from 1 to 118 specifying the line pattern. The available line patterns, and corresponding pattern codes, are shown in Line Pattern Codes on page 161. A string value specifying the color of the pen stroke. The value can be any valid CSS color. (See http://www.w3.org/tr/rec-css1#color-units.) Example This example specifies a solid red line that is two pixels wide. <ns6:mapbasicpen> <ns6:width>2</ns6:width> <ns6:pattern>2</ns6:pattern> <ns6:color>red</ns6:color> </ns6:mapbasicpen> MapBasicAreaStyle A style of type MapBasicAreaStyle specifies the visual characteristics of a filled area. The style can contain a MapBasicPen element or a MapBasicBrush element or both. 126 Spectrum Technology Platform 9.0

Chapter 9: Using Styles MapBasicPen The MapBasicPen element defines a style for a linear object such as a line, polyline arc, or the border of a region. Elements Table 3: Elements on page 127 lists the elements that can be contained by a MapBasicPen element. Table 3: Elements Element Width Pattern Color An integer value from 0 to 7 specifying the thickness of the line (in pixels). To create an invisible line style, specify a width of 0 and a pattern value of 1. An integer value from 1 to 118 specifying the line pattern. The available line patterns, and corresponding pattern codes, are shown in Line Pattern Codes on page 161. A string value specifying the color of the pen stroke. The value can be any valid CSS color. (See http://www.w3.org/tr/rec-css1#color-units.) Example This example specifies a solid red line that is two pixels wide. <ns6:mapbasicpen> <ns6:width>2</ns6:width> <ns6:pattern>2</ns6:pattern> <ns6:color>red</ns6:color> </ns6:mapbasicpen> MapBasicBrush The MapBasicBrush element defines a style for a filled object, such as a circle or region. Elements Table 4: Elements on page 127 lists the elements that can be contained by a MapBasicBrush element. Table 4: Elements Element Pattern An integer value from 1 to 8 and from 12 to 175 specifying the fill pattern. Spectrum Spatial Developer Guide 127

MapBasic Styles Element Note: Pattern codes 9 to 11 are reserved. The available fill patterns, and corresponding pattern codes, are shown in Fill Pattern Codes on page 162. ForegroundColor BackgroundColor A string value specifying the foreground color. The value can be any valid CSS color. (See http://www.w3.org/tr/rec-css1#color-units.) A string value specifying the background color. The value can be any valid CSS color. (See http://www.w3.org/tr/rec-css1#color-units.) Note: Omitting this element will yield a transparent background. Example This example specifies a fill pattern of blue horizontal lines on a yellow background. <ns6:mapbasicbrush> <ns6:pattern>3</ns6:pattern> <ns6:foregroundcolor>blue</ns6:foregroundcolor> <ns6:backgroundcolor>yellow</ns6:backgroundcolor> </ns6:mapbasicbrush> MapBasicPointStyle A style of type MapBasicPointStyle specifies the visual characteristics of a symbol. The style can contain a MapBasicSymbol element. MapBasicSymbol The MapBasicSymbol element has a type attribute that specifies one of the following types of symbol. MapBasic30Symbol MapBasicFontSymbol MapBasicBitmapSymbol MapBasic30Symbol A MapBasicSymbol element of type MapBasic30Symbol specifies the size, color, and code of a symbol taken from the MapInfo 3.0 symbol set. Elements Table 5: Elements on page 129 lists the elements that can be contained by a MapBasicSymbol element of type MapBasic30Symbol. 128 Spectrum Technology Platform 9.0

Chapter 9: Using Styles Table 5: Elements Element Shape Color Size An integer value from 31 to 67 specifying the symbol code to use from the MapInfo 3.0 symbol set. The MapInfo 3.0 symbol set, and corresponding code for each symbol, is shown in MapInfo 3.0 Symbol Codes on page 163. A string value specifying the color of the symbol. The value can be any valid CSS color. (See http://www.w3.org/tr/rec-css1#color-units.) An integer value from 1 to 255 specifying the point size of the symbol. Example <ns6:mapbasicsymbol xsi:type="ns6:mapbasic30symbol"> <ns6:shape>56</ns6:shape> <ns6:color>blue</ns6:color> <ns6:size>12</ns6:size> </ns6:mapbasicsymbol> MapBasicFontSymbol A MapBasicSymbol element of type MapBasicFontSymbol specifies the character code of a symbol taken from a TrueType symbol font, as well as various other attributes of the symbol. Elements Table 6: Elements on page 129 lists the elements that can be contained by a MapBasicSymbol element of type MapBasicFontSymbol. Table 6: Elements Element Shape An integer value of 32 or larger specifying the character to use from a TrueType symbol font. Note: To specify an invisible symbol, use 32 (the space character). Color Size FontName A string value specifying the color of the symbol. The value can be any valid CSS color. (See http://www.w3.org/tr/rec-css1#color-units.) An integer value from 1 to 255 specifying the point size of the symbol. A string value specifying the name of the TrueType symbol font to use (for example, "WingDings"). Spectrum Spatial Developer Guide 129

MapBasic Styles Element Bold A boolean value (true or false) specifying whether the symbol should be bold (true) or plain (false). The default value is false. Border An enumeration value specifying the type of border to draw around the symbol. Possible values are: normal halo The value normal draws a regular black border around the symbol. The value halo draws a white halo border around the symbol. DropShadow Rotation A boolean value (true or false) specifying whether to have a drop-shadow drawn behind the symbol. A value of false (the default) specifies no drop-shadow. A floating-point value from 0 to 360 specifying the rotation angle of the symbol in degrees. Example <ns6:mapbasicsymbol xsi:type="ns6:mapbasicfontsymbol"> <ns6:shape>32</ns6:shape> <ns6:color>blue</ns6:color> <ns6:size>12</ns6:size> <ns6:fontname>wingdings</ns6:fontname> <ns6:bold>true</ns6:bold> <ns6:border>normal</ns6:border> <ns6:rotation>45</ns6:rotation> </ns6:mapbasicsymbol> MapBasicBitmapSymbol A MapBasicSymbol element of type MapBasicBitmapSymbol specifies the name of a bitmap symbol file, as well as the size and color of the symbol. Elements Table 7: Elements on page 130 lists the elements that can be contained by a MapBasicSymbol element of type MapBasicBitmapSymbol. Table 7: Elements Element URI Color A string value specifying the URI of the bitmap image file. A string value specifying the color of the symbol. Any non-white pixels in the bitmap are set to this color. 130 Spectrum Technology Platform 9.0

Chapter 9: Using Styles Element The value can be any valid CSS color. (See http://www.w3.org/tr/rec-css1#color-units.) Size An integer value from 1 to 255 specifying the point size of the symbol. If this element is omitted, the image is rendered at its native width and height in pixels. Transparent A boolean value (true or false) specifying whether white pixels in the bitmap should be set to transparent (true) or left as opaque white (false). The default value is true. MapBasicTextStyle A style of type MapBasicTextStyle specifies the visual characteristics of a text style. The complextype style contains the element MapBasicFontStyle. MapBasicFontStyle The MapBasicFontStyle element defines the font style portion of a MapBasicTextStyle. Elements Table 8: Elements on page 131 lists the elements that can be contained by a MapBasicFontStyle element. Table 8: Elements Element FontName Style Identifies the name of the font to use. For example, Arial or MapInfo Symbols, etc. MapInfo Fonts are installed with the product while other fonts are used from the system. Controls text attributes, according to the following list: 0 - Plain 1 - Bold 2 - Italic 4 - Underline 8 - Strikethrough 32 - Shadow 256 - Halo 512 - All Caps 1024 - Expanded Size ForegroundColor The height of the characters in points. A string value specifying the foreground color of the text. The value can be any valid CSS color. (See http://www.w3.org/tr/rec-css1#color-units.) Spectrum Spatial Developer Guide 131

Named Styles Element BackgroundColor A string value specifying the background color of the text. The value can be any valid CSS color. (See http://www.w3.org/tr/rec-css1#color-units.) Example This example specifies a font style: Verdana 12 pt italic, black with red background. <ns6:mapbasicfontstyle> <ns6:fontname>verdana</ns6:fontname> <ns6:size>12</ns6:size> <ns6:style>2</ns6:style> <ns6:foregroundcolor>black</ns6:foregroundcolor> <ns6:backgroundcolor>red</ns6:backgroundcolor> </ns6:mapbasicfontstyle> MapBasicCompositeStyle A style of type MapBasicCompositeStyle specifies the visual characteristics of a mixed set of geometry types such as lines and areas. The style can contain any or all of the following elements: LineStyle, AreaStyle, and PointStyle. LineStyle The LineStyle element is used within a style of type MapBasicCompositeStyle to contain a MapBasicPen element. AreaStyle The AreaStyle element is used within a style of type MapBasicCompositeStyle to contain a MapBasicPen element or a MapBasicBrush element or both. PointStyle The PointStyle element is used within a style of type MapBasicCompositeStyle to contain a MapBasicSymbol element. Named Styles A named style enables you to give a name to a group of style settings, then refer to the style by name in your XML request. Line Styles A line style specifies the visual characteristics of a line. 132 Spectrum Technology Platform 9.0

Chapter 9: Using Styles LineStyle The LineStyle element defines a style for a line. Context Table 9: Context on page 133 lists the elements that can contain, or be contained by, a LineStyle element. Table 9: Context Contained by NamedStyle or CompositeStyle or AreaStyle Element LineStyle Contains Pen Attributes Table 10: Attributes on page 133 lists the attributes of a LineStyle element. Table 10: Attributes Attribute id name stroke stroke-opacity width width-unit miterlimit A unique identifier for the element. A descriptive name for the element. A string value specifying the color of the line. The value can be any valid CSS color. (See http://www.w3.org/tr/rec-css1#color-units.) The stroke attribute is optional. The default value is black. A floating-point value from 0 to 1 specifying the opacity of the line. A value of 0 means that the line is totally transparent. A value of 1 means that the line is totally opaque. A value of 0.5 means that the line is 50% translucent. The stroke-opacity attribute is optional. The default value is 1. An integer value specifying the width of the line. The width attribute is optional. The default value is 1. A reference to an imagesize in the mapinfo codespace, which specifies a width unit. The width-unit attribute is optional. The default value is mapinfo:imagesize pixel. A limit on the ratio of the miter length to the line width for linejoins of type miter. When two line segments meet at a sharp angle and miter joins have been specified for linejoin, it is possible for the miter to extend far beyond the thickness of the line stroking the path. The miterlimit attribute is optional. The default value is 10. Spectrum Spatial Developer Guide 133

Named Styles Attribute linecap An enumeration value specifying the decorative shape to be used at the end of open subpaths when they are stroked. Possible values are: butt round square The value butt means no decoration is used. The value round means the line ends with a semicircle whose radius is half the line width. The value square means the line ends with a rectangle whose length is half the line width. The linecap attribute is optional. The default value is round. linejoin An enumeration value specifying the shape to be used at the corners of paths or basic shapes when they are stroked. Possible values are: miter bevel round The value miter means the outer edges of lines extend until they intersect. If the miter is longer than the miterlimit, the type bevel is substituted. The value bevel means lines are joined by connecting the outer edges of their ends. The value round means each line segment is ended with a semicircle whose radius is half the line width. The linejoin attribute is optional. The default value is round. marker-placement An enumeration value specifying the placement style for markers. Possible values are: LEFT CENTER RIGHT HORIZONTAL MATCH_SEGMENT none Note: Currently only none is supported for marker placement. Markers can be placed at the start, end, or middle nodes of line segments and can be drawn along line segments continuously. The values LEFT, CENTER, and RIGHT specify the horizontal justification for a multi-line text marker. The values HORIZONTAL and MATCH_SEGMENT specify the rotational orientation of a symbol marker relative to the line segment. The marker-placement attribute is optional. The default value is none. dasharray An array of comma or whitespace delimited integer values that specify the lengths (in pixels) of alternating dashes and spaces for a dashed line. For example, 10 20 30 10 or 10,20,30,10. The array must contain an even number of positive integers, or the special value none. The first integer in the array specifies the length of the first dash, the second integer specifies the length of the first space, and so on through the array. 134 Spectrum Technology Platform 9.0

Chapter 9: Using Styles Attribute For example, the following value 10,20,30,10 specifies a dashed line in which the first dash is 10 pixels long, followed by a space 20 pixels long, followed by a dash 30 pixels long, followed by a space 10 pixels long. The pattern then repeats for the length of the dashed line. The dasharray attribute is optional. The default value is none, which is equivalent to the array 1,1. dashoffset A positive integer value specifying the number of units (in pixels) from the start of the line segment at which the first dash of a dashed line will be drawn. The dashoffset attribute is optional. The default value is 0. Example This example specifies a dashed black line that is one pixel wide. <?xml version="1.0" encoding="utf-8"?> <NamedStyle version="mxp_workspace_1_5" xmlns="http://www.mapinfo.com/mxp"> <LineStyle stroke="black" stroke-opacity="1" width="1" width-unit="mapinfo:imagesize pixel"> <Pen>mapinfo:pen 9</Pen> </LineStyle> </NamedStyle> Pen The content of the Pen element is a reference to a pen in the mapinfo codespace, which specifies a line pattern code. For example: mapinfo:pen 5 The available line patterns, and corresponding pattern codes, are shown in Line Pattern Codes on page 161. Context Table 11: Context on page 135 lists the elements that can contain, or be contained by, a Pen element. Table 11: Context Contained by LineStyle Element Pen Contains (text) Spectrum Spatial Developer Guide 135

Named Styles Attributes The Pen element has no attributes. Example This example specifies a dashed black line that is one pixel wide. <?xml version="1.0" encoding="utf-8"?> <NamedStyle version="mxp_workspace_1_5" xmlns="http://www.mapinfo.com/mxp"> <LineStyle stroke="black" stroke-opacity="1" width="1" width-unit="mapinfo:imagesize pixel"> <Pen>mapinfo:pen 9</Pen> </LineStyle> </NamedStyle> Fill Styles A fill style specifies the visual characteristics of a filled area. Interior The Interior element defines a style for a filled area. Context Table 12: Context on page 136 lists the elements that can contain, or be contained by, an Interior element. Table 12: Context Contained by NamedStyle or AreaStyle Element Interior Contains Defs or Pattern Attributes Table 13: Attributes on page 136 lists the attributes of an Interior element. Table 13: Attributes Attribute id name A unique identifier for the element. A descriptive name for the element. 136 Spectrum Technology Platform 9.0

Chapter 9: Using Styles Attribute fill The fill color or pattern. The value can be one of five different forms of defining a color, or the id of an underlying Pattern element, or the special value none to indicate no value. Examples: blue #F80 #EE97A2 rgb(255,0,30) rgb(21.5%, 90%, 3.1%) (#id20) none The fill attribute is optional. The default value is black. fill-opacity A floating-point value from 0 to 1 specifying the opacity of the fill. A value of 0 means that the fill is totally transparent. A value of 1 means that the fill is totally opaque. A value of 0.5 means that the fill is 50% translucent. The fill-opacity setting is multiplicative to any opacity setting in an underlying ColorAdjustment element. For example, if the Interior element has a fill-opacity setting of 0.5, and an underlying ColorAdjustment element has an opacity setting of 0.4, then the final opacity would be 0.5 0.4, or 0.2. The fill-opacity attribute is optional. The default value is 1. Example This example specifies a solid fill pattern. <?xml version="1.0" encoding="utf-8"?> <NamedStyle version="mxp_workspace_1_5" xmlns="http://www.mapinfo.com/mxp"> <Interior fill-opacity="1" fill="(#id7)"> <Defs> <Pattern id="id7"> <Bitmap uri="mapinfo:brush 2"> <ColorAdjustmentSet> <ColorAdjustment color-1="nonwhite" color-2="rgb(224,255,176)" opacity="1"/> <ColorAdjustment color-1="white" color-2="white" opacity="1"/> </ColorAdjustmentSet> </Bitmap> </Pattern> </Defs> </Interior> </NamedStyle> Spectrum Spatial Developer Guide 137

Named Styles Defs The Defs element serves as a container for a Pattern element that is referred to by an Interior element. Context Table 14: Context on page 138 lists the elements that can contain, or be contained by, a Defs element. Table 14: Context Contained by Interior Element Defs Contains Pattern Attributes The Defs element has no attributes. Example This example shows a Pattern element contained within a Defs element, which is in turn contained within an Interior element. Note how the Interior element's fill attribute refers to the underlying Pattern element by its id attribute. <?xml version="1.0" encoding="utf-8"?> <NamedStyle version="mxp_workspace_1_5" xmlns="http://www.mapinfo.com/mxp"> <Interior fill-opacity="1" fill="(#id7)"> <Defs> <Pattern id="id7"> <Bitmap uri="mapinfo:brush 2"> <ColorAdjustmentSet> <ColorAdjustment color-1="nonwhite" color-2="rgb(224,255,176)" opacity="1"/> <ColorAdjustment color-1="white" color-2="white" opacity="1"/> </ColorAdjustmentSet> </Bitmap> </Pattern> </Defs> </Interior> </NamedStyle> Pattern The Pattern element defines a pattern used to fill an area. 138 Spectrum Technology Platform 9.0

Chapter 9: Using Styles Context Table 15: Context on page 139 lists the elements that can contain, or be contained by, a Pattern element. Table 15: Context Contained by Interior or Defs Element Pattern Contains Bitmap Attributes Table 16: Attributes on page 139 lists the attributes of a Pattern element. Table 16: Attributes Attribute id A unique identifier for the element. Note: This attribute is required. name A descriptive name for the element. Example This example specifies a solid fill pattern. <?xml version="1.0" encoding="utf-8"?> <NamedStyle version="mxp_workspace_1_5" xmlns="http://www.mapinfo.com/mxp"> <Interior fill-opacity="1" fill="(#id7)"> <Defs> <Pattern id="id7"> <Bitmap uri="mapinfo:brush 2"> <ColorAdjustmentSet> <ColorAdjustment color-1="nonwhite" color-2="rgb(224,255,176)" opacity="1"/> <ColorAdjustment color-1="white" color-2="white" opacity="1"/> </ColorAdjustmentSet> </Bitmap> </Pattern> </Defs> </Interior> </NamedStyle> Bitmap The Bitmap element specifies a particular bitmap image, and the image's width and height. Spectrum Spatial Developer Guide 139

Named Styles Context Table 17: Context on page 140 lists the elements that can contain, or be contained by, a Bitmap element. Table 17: Context Contained by Pattern or PointStyle Element Bitmap Contains ColorAdjustmentSet Attributes Table 18: Attributes on page 140 lists the attributes of a Bitmap element. Table 18: Attributes Attribute id name uri A unique identifier for the element. A descriptive name for the element. Any of the following: A network protocol, and the network location of a bitmap image to fetch using that protocol. The available protocols are: ftp, http, file, or the URI scheme name of a custom protocol. A reference to a brush in the mapinfo codespace, which specifies a fill pattern code. For example: mapinfo:brush 71. The available fill patterns, and corresponding pattern codes, are shown in Fill Pattern Codes on page 162. The filename of a bitmap image. The image file must be contained in a JAR file that is in the CLASSPATH. If the image file is located in the top-level internal directory of the JAR file, then the attribute value is the image filename only. If the image file is located in a lower-level internal directory in the JAR file, then the attribute value is the internal path to the image file within the JAR file, with a forward slash used to separate each directory level. Note that in either case, you do not use a forward slash at the beginning of the attribute value. height width unit A floating-point value specifying with height of the bitmap image. Alternatively, the special value native can be used to specify the native height of the bitmap image. A floating-point value specifying with width of the bitmap image. Alternatively, the special value native can be used to specify the native width of the bitmap image. A reference to an imagesize in the mapinfo codespace, which specifies a unit. The unit attribute is optional. The default value is mapinfo:imagesize pixel. 140 Spectrum Technology Platform 9.0

Chapter 9: Using Styles Example This example uses a reference to a brush in the mapinfo codespace to specify a solid fill pattern. <?xml version="1.0" encoding="utf-8"?> <NamedStyle version="mxp_workspace_1_5" xmlns="http://www.mapinfo.com/mxp"> <Interior fill-opacity="1" fill="(#id7)"> <Defs> <Pattern id="id7"> <Bitmap uri="mapinfo:brush 2"> <ColorAdjustmentSet> <ColorAdjustment color-1="nonwhite" color-2="rgb(224,255,176)" opacity="1"/> <ColorAdjustment color-1="white" color-2="white" opacity="1"/> </ColorAdjustmentSet> </Bitmap> </Pattern> </Defs> </Interior> </NamedStyle> ColorAdjustmentSet The ColorAdjustmentSet element serves as a container for one or more ColorAdjustment elements. Context Table 19: Context on page 141 lists the elements that can contain, or be contained by, a ColorAdjustmentSet element. Table 19: Context Contained by Bitmap Element ColorAdjustmentSet Contains ColorAdjustment Attributes The ColorAdjustmentSet element has no attributes. Example This example shows a ColorAdjustmentSet element that contains two ColorAdjustment elements. <?xml version="1.0" encoding="utf-8"?> <NamedStyle version="mxp_workspace_1_5" xmlns="http://www.mapinfo.com/mxp"> Spectrum Spatial Developer Guide 141

Named Styles <Interior fill-opacity="1" fill="(#id7)"> <Defs> <Pattern id="id7"> <Bitmap uri="mapinfo:brush 2"> <ColorAdjustmentSet> <ColorAdjustment color-1="nonwhite" color-2="rgb(224,255,176)" opacity="1"/> <ColorAdjustment color-1="white" color-2="white" opacity="1"/> </ColorAdjustmentSet> </Bitmap> </Pattern> </Defs> </Interior> </NamedStyle> ColorAdjustment The ColorAdjustment element replaces color-1 with color-2 at the given opacity. If color-2 is absent, the only effect is to change the opacity of color-1. If opacity is absent, the effect is to change color-1 to color-2 and retain the opacity. If both color-2 and opacity are absent, this element has no effect. Context Table 20: Context on page 142 lists the elements that can contain, or be contained by, a ColorAdjustment element. Table 20: Context Contained by ColorAdjustmentSet Element ColorAdjustment Contains (empty) Attributes Table 21: Attributes on page 142 lists the attributes of a ColorAdjustment element. Table 21: Attributes Attribute color-1 A string value specifying the color to be changed to the value of color-2, or whose opacity is to be changed to the value of opacity. The value can be any valid CSS color. (See http://www.w3.org/tr/rec-css1#color-units.) Alternatively, the special value nonwhite can be used to specify every color except white (rgb(255,255,255)). Note: This attribute is required. 142 Spectrum Technology Platform 9.0

Chapter 9: Using Styles Attribute color-2 A string value specifying the color to which color-1 is to be changed. The value can be any valid CSS color. (See http://www.w3.org/tr/rec-css1#color-units.) opacity A floating-point value from 0 to 1 specifying opacity to which color-1 is to be changed. Example This example changes all colors that are not white to light green at full opacity. <?xml version="1.0" encoding="utf-8"?> <NamedStyle version="mxp_workspace_1_5" xmlns="http://www.mapinfo.com/mxp"> <Interior fill-opacity="1" fill="(#id7)"> <Defs> <Pattern id="id7"> <Bitmap uri="mapinfo:brush 2"> <ColorAdjustmentSet> <ColorAdjustment color-1="nonwhite" color-2="rgb(224,255,176)" opacity="1"/> </ColorAdjustmentSet> </Bitmap> </Pattern> </Defs> </Interior> </NamedStyle> Point Styles A point style specifies the visual characteristics of a point. PointStyle A PointStyle element defines a style for a point geometry. Context Table 22: Context on page 143 lists the elements that can contain, or be contained by, a PointStyle element. Table 22: Context Contained by NamedStyle or CompositeStyle Element PointStyle Contains Bitmap or FontSymbol Spectrum Spatial Developer Guide 143

Named Styles Attributes Table 23: Attributes on page 144 lists the attributes of a PointStyle element. Table 23: Attributes Attribute id name A unique identifier for the element. A descriptive name for the element. Examples This example specifies an 18-point red push-pin symbol from the MapInfo 3.0 Symbols set. Note that the text attribute is set to C, which is decimal code 67 in the UTF-8 encoding, and the family attribute is set to MapInfo Symbols, which specifies the MapInfo 3.0 Symbols set. In the MapInfo 3.0 Symbols set, code 67 specifies a push-pin symbol. <?xml version="1.0" encoding="utf-8"?> <NamedStyle version="mxp_workspace_1_5" xmlns="http://www.mapinfo.com/mxp"> <PointStyle> <FontSymbol size="18" size-unit="mapinfo:length pt" stroke="red" stroke-opacity="1" text="c" family="mapinfo Symbols"/> </PointStyle> </NamedStyle> This example specifies a 14-point blue star symbol from the MapInfo 3.0 Symbols set. Note that the text attribute is set to #, which is decimal code 35 in the UTF-8 encoding, and the family attribute is set to MapInfo Symbols, which specifies the MapInfo 3.0 Symbols set. In the MapInfo 3.0 Symbols set, code 35 specifies a star symbol. <?xml version="1.0" encoding="utf-8"?> <NamedStyle version="mxp_workspace_1_5" xmlns="http://www.mapinfo.com/mxp"> <PointStyle> <FontSymbol size="14" size-unit="mapinfo:length pt" stroke="blue" stroke-opacity="1" text="#" family="mapinfo Symbols"/> </PointStyle> </NamedStyle> 144 Spectrum Technology Platform 9.0

Chapter 9: Using Styles Font Styles A font style specifies the visual characteristics of a string of text. FontStyle The FontStyle element defines a style for a text string. Context Table 24: Context on page 145 lists the elements that can contain, or be contained by, a FontStyle element. Table 24: Context Contained by NamedStyle or CompositeStyle Element FontStyle Contains (empty) Attributes Table 25: Attributes on page 145 lists the attributes of a FontStyle element. Table 25: Attributes Attribute id name family size size-unit A unique identifier for the element. A descriptive name for the element. A string value specifying the name of a TrueType font. The family attribute is optional. The default value is arial. A floating-point value specifying the font size. The size attribute is optional. The default value is 12. A reference to a length in the mapinfo codespace, which specifies the unit of measurement used for the size attribute. The size-unit attribute is optional. The default value is mapinfo:length pt. stroke stroke-opacity A string value specifying the color of the font. The value can be any valid CSS color. (See http://www.w3.org/tr/rec-css1#color-units.) The stroke attribute is optional. The default value is black. A floating-point value from 0 to 1 specifying the opacity of the font. A value of 0 means that the font is totally transparent. A value of 1 means that the font is totally opaque. A value of 0.5 means that the font is 50% translucent. The stroke-opacity attribute is optional. The default value is 1. Spectrum Spatial Developer Guide 145

Named Styles Attribute font-style An enumeration value specifying the font style. Possible values are: normal italic oblique The font-style attribute is optional. The default value is normal. effect A string value specifying the color of the text effect provided by the effect-type attribute. The value can be any valid CSS color. (See http://www.w3.org/tr/rec-css1#color-units.) The effect attribute is optional. The default value is none. effect-opacity A floating-point value from 0 to 1 specifying the opacity of the text effect. A value of 0 means that the effect is totally transparent. A value of 1 means that the effect is totally opaque. A value of 0.5 means that the effect is 50% translucent. The effect-opacity attribute is optional. The default value is 1. effect-type An enumeration value specifying the text effect type. Possible values are: box halo glyph-outline none The effect-type attribute is optional. The default value is none. font-weight An enumeration value specifying the font weight. Possible values are: normal bold 100 200 300 400 500 600 700 800 900 Note: normal is equivalent to 200; bold is equivalent to 400. The font-weight attribute is optional. The default value is normal. text-decoration A string value specifying the text decoration. The value must have the following pattern: a choice of one or more of (underline line-through) separated by a single space or the single value none. Examples: line-through underline, underline, none. The text-decoration attribute is optional. The default value is none. 146 Spectrum Technology Platform 9.0

Chapter 9: Using Styles Attribute text-case An enumeration value specifying the text case. Possible values are: upper lower default Note: default means 'retain the current case'. The text-case attribute is optional. The default value is default. shadow A boolean value (true or false) specifying whether to have a drop-shadow drawn behind the font. A value of false (the default) specifies no drop-shadow. The shadow attribute is optional. The default value is false. expand A boolean value (true or false) specifying whether a space character should be inserted between each pair of visible characters in the text string. The expand attribute is optional. The default value is false. Example This example specifies a 12-point black sans serif font. <?xml version="1.0" encoding="utf-8"?> <NamedStyle version="mxp_workspace_1_5" xmlns="http://www.mapinfo.com/mxp"> <FontStyle family="microsoft Sans Serif" font-style="normal" effect="white" effect-opacity="1" effect-type="none" font-weight="normal" text-decoration="none" text-case="default" shadow="false" expand="false" size="12" size-unit="mapinfo:length pt" stroke="black"/> </NamedStyle> Symbol Styles A symbol style specifies the visual characteristics of a symbol. FontSymbol The FontSymbol element defines a style for a font symbol. Spectrum Spatial Developer Guide 147

Named Styles Context Table 26: Context on page 148 lists the elements that can contain, or be contained by, a FontSymbol element. Table 26: Context Contained by NamedStyle or PointStyle Element FontSymbol Contains (empty) Attributes Table 27: Attributes on page 148 lists the attributes of a FontSymbol element. Table 27: Attributes Attribute id name text A unique identifier for the element. A descriptive name for the element. A one-character string value specifying the symbol character to use. If the family attribute is set to the name of a TrueType font, set this attribute to the character for the font symbol. If the family attribute is set to MapInfo 3.0 Compatible or MapInfo Symbols, refer to the set of symbols and symbol codes shown in MapInfo 3.0 Symbol Codes on page 163. family Either of the following: A string value specifying the name of a TrueType symbol font (for example, "WingDings"). The string value MapInfo 3.0 Compatible or MapInfo Symbols, specifying the symbols shown in MapInfo 3.0 Symbol Codes on page 163. The family attribute is optional. The default value is arial. size A floating-point value specifying the size of the symbol. The size attribute is optional. The default value is 12. size-unit A reference to a length in the mapinfo codespace, which specifies the unit of measurement used for the size attribute. The size-unit attribute is optional. The default value is mapinfo:length pt. stroke A string value specifying the color of the symbol. The value can be any valid CSS color. (See http://www.w3.org/tr/rec-css1#color-units.) The stroke attribute is optional. The default value is black. stroke-opacity A floating-point value from 0 to 1 specifying the opacity of the symbol. A value of 0 means that the symbol is totally transparent. A value of 1 means that the symbol is totally opaque. A value of 0.5 means that the symbol is 50% translucent. 148 Spectrum Technology Platform 9.0

Chapter 9: Using Styles Attribute The stroke-opacity attribute is optional. The default value is 1. font-style An enumeration value specifying the font style. Possible values are: normal italic oblique The font-style attribute is optional. The default value is normal. effect A string value specifying the color of the text effect provided by the effect-type attribute. The value can be any valid CSS color. (See http://www.w3.org/tr/rec-css1#color-units.) The effect attribute is optional. The default value is none. effect-opacity A floating-point value from 0 to 1 specifying the opacity of the text effect. A value of 0 means that the effect is totally transparent. A value of 1 means that the effect is totally opaque. A value of 0.5 means that the effect is 50% translucent. The effect-opacity attribute is optional. The default value is 1. effect-type An enumeration value specifying the text effect type. Possible values are: box halo glyph-outline none The effect-type attribute is optional. The default value is none. font-weight An enumeration value specifying the font weight. Possible values are: normal bold 100 200 300 400 500 600 700 800 900 Note: normal is equivalent to 200; bold is equivalent to 400. The font-weight attribute is optional. The default value is normal. text-decoration A string value specifying the text decoration. The value must have the following pattern: a choice of one or more of (underline line-through) separated by a single space or the single value none. Examples: line-through underline, underline, none. Spectrum Spatial Developer Guide 149

Named Styles Attribute The text-decoration attribute is optional. The default value is none. text-case An enumeration value specifying the text case. Possible values are: upper lower default Note: default means 'retain the current case'. The text-case attribute is optional. The default value is default. shadow A boolean value (true or false) specifying whether to have a drop-shadow drawn behind the symbol. A value of false (the default) specifies no drop-shadow. The shadow attribute is optional. The default value is false. expand A boolean value (true or false) specifying whether a space character should be inserted between each pair of visible characters in the text string. The expand attribute is optional. The default value is false. angle angle-unit A floating-point value specifying the rotation angle of the symbol. A string value specifying the unit of measurement used for the angle attribute. Examples This example specifies an 18-point red push-pin symbol from the MapInfo 3.0 Symbols set. Note that the text attribute is set to C, which is decimal code 67 in the UTF-8 encoding, and the family attribute is set to MapInfo Symbols, which specifies the MapInfo 3.0 Symbols set. In the MapInfo 3.0 Symbols set, code 67 specifies a push-pin symbol. <?xml version="1.0" encoding="utf-8"?> <NamedStyle version="mxp_workspace_1_5" xmlns="http://www.mapinfo.com/mxp"> <FontSymbol size="18" size-unit="mapinfo:length pt" stroke="red" stroke-opacity="1" text="c" family="mapinfo Symbols"/> </NamedStyle> This example specifies a 14-point blue star symbol from the MapInfo 3.0 Symbols set. Note that the text attribute is set to #, which is decimal code 35 in the UTF-8 encoding, and the family attribute is set to MapInfo Symbols, which specifies the MapInfo 3.0 Symbols set. In the MapInfo 3.0 Symbols set, code 35 specifies a star symbol. <?xml version="1.0" encoding="utf-8"?> <NamedStyle 150 Spectrum Technology Platform 9.0

Chapter 9: Using Styles version="mxp_workspace_1_5" xmlns="http://www.mapinfo.com/mxp"> <FontSymbol size="14" size-unit="mapinfo:length pt" stroke="blue" stroke-opacity="1" text="#" family="mapinfo Symbols"/> </NamedStyle> Image Styles An image style specifies the visual characteristics of an image. RasterStyle A RasterStyle element defines a style for a raster image. Context Table 28: Context on page 151 lists the elements that can contain, or be contained by, a RasterStyle element. Table 28: Context Contained by NamedStyle or CompositeStyle Element RasterStyle Contains (empty) Attributes Table 29: Attributes on page 151 lists the attributes of a RasterStyle element. Table 29: Attributes Attribute id name contrast brightness A unique identifier for the element. A descriptive name for the element. A floating-point value from 0 to 1 specifying the contrast of the image. A value of 0 means that the image has minimum contrast. A value of 1 means that the image has maximum contrast. A value of 0.5 means that the image has 50% contrast. The contrast attribute is optional. The default value is 0.5. A floating-point value from 0 to 1 specifying the brightness of the image. Brightness is a measure of the lightness of darkness of the image. A value of 0 means that the image has minimum brightness. A value of 1 means that Spectrum Spatial Developer Guide 151

Named Styles Attribute the image has maximum brightness. A value of 0.5 means that the image has 50% brightness. The brightness attribute is optional. The default value is 0.5. opacity grayscale transparent transparent-color A floating-point value from 0 to 1 specifying the opacity of the image. A value of 0 means that the image is totally transparent. A value of 1 means that the image is totally opaque. A value of 0.5 means that the image is 50% translucent. The opacity attribute is optional. The default value is 1. A boolean value (true or false) specifying whether the image should be displayed using only shades of gray, ranging from white to black. The grayscale attribute is optional. The default value is false. A boolean value (true or false) specifying whether the color identified by transparent-color should be displayed with an opacity of 0 (transparent). The transparent attribute is optional. The default value is false. A string value specifying the color to be displayed with an opacity of 0 if transparent is set to true. The value can be any valid CSS color. (See http://www.w3.org/tr/rec-css1#color-units.) Example This example specifies a raster image style that sets any red areas to transparent. <?xml version="1.0" encoding="utf-8"?> <NamedStyle version="mxp_workspace_1_5" xmlns="http://www.mapinfo.com/mxp"> <RasterStyle id="mirasterstyle" name="mirasterstyle" contrast="0.5" brightness="0.5" opacity="1" grayscale="false" transparent="true" transparent-color="red"/> </NamedStyle> GridStyle A GridStyle element defines a style for a MapInfo grid image. 152 Spectrum Technology Platform 9.0

Chapter 9: Using Styles Context Table 30: Context on page 153 lists the elements that can contain, or be contained by, a GridStyle element. Table 30: Context Contained by NamedStyle or CompositeStyle Element GridStyle Contains GridInflectionList Attributes Table 31: Attributes on page 153 lists the attributes of a GridStyle element. Table 31: Attributes Attribute id name contrast brightness opacity grayscale show-hillshade null-color A unique identifier for the element. A descriptive name for the element. A floating-point value from 0 to 1 specifying the contrast of the image. A value of 0 means that the image has minimum contrast. A value of 1 means that the image has maximum contrast. A value of 0.5 means that the image has 50% contrast. The contrast attribute is optional. The default value is 0.5. A floating-point value from 0 to 1 specifying the brightness of the image. Brightness is a measure of the lightness or darkness of the image. A value of 0 means that the image has minimum brightness. A value of 1 means that the image has maximum brightness. A value of 0.5 means that the image has 50% brightness. The brightness attribute is optional. The default value is 0.5. A floating-point value from 0 to 1 specifying the opacity of the image. A value of 0 means that the image is totally transparent. A value of 1 means that the image is totally opaque. A value of 0.5 means that the image is 50% translucent. The opacity attribute is optional. The default value is 1. A boolean value (true or false) specifying whether the image should be displayed using only shades of gray, ranging from white to black. The grayscale attribute is optional. The default value is false. A boolean value (true or false) specifying whether to display the grid image with relief shading in order to provide a more 3D appearance. The show-hillshade attribute is optional. The default value is false. A string value specifying the color used to indicate that a value is null. The value can be any valid CSS color. (See http://www.w3.org/tr/rec-css1#color-units.) The null-color attribute is optional. The default value is black. Spectrum Spatial Developer Guide 153

Named Styles Attribute Note: This attribute has no effect if null-transparent is true. null-transparent A boolean value (true or false) specifying whether null values should be displayed as transparent (true) or displayed as the color specified in null-color (false). The null-transparent attribute is optional. The default value is false. Example This example specifies a grid image style that contains a collection of three grid inflection points. <?xml version="1.0" encoding="utf-8"?> <NamedStyle version="mxp_workspace_1_5" xmlns="http://www.mapinfo.com/mxp"> <GridStyle id="migridstyle" name="migridstyle" contrast="0.5" brightness="0.5" opacity="1" grayscale="false" show-hillshade="false" null-color="black" null-transparent="true"/> <GridInflectionList> <GridInflection value="0.4" color="yellow"/> <GridInflection value="0.5" color="green"/> <GridInflection value="0.6" color="blue"/> </GridInflectionList> </GridStyle> </NamedStyle> GridInflectionList A GridInflectionList element defines an ordered collection of inflection points (as defined by a series of zero or more GridInflection elements) used to interpret a Grid file. The contained collection of GridInflection elements must be ordered in ascending order of the value attribute. A value in the data that lies between two GridInflections will have its color determined by blending the colors at the two inflection points. Context Table 32: Context on page 155 lists the elements that can contain, or be contained by, a GridInflectionList element. 154 Spectrum Technology Platform 9.0

Chapter 9: Using Styles Table 32: Context Contained by GridStyle Element GridInflectionList Contains GridInflection Attributes The GridInflectionList element has no attributes. Example This example specifies a grid image style that contains a collection of three grid inflection points. <?xml version="1.0" encoding="utf-8"?> <NamedStyle version="mxp_workspace_1_5" xmlns="http://www.mapinfo.com/mxp"> <GridStyle id="migridstyle" name="migridstyle" contrast="0.5" brightness="0.5" opacity="1" grayscale="false" show-hillshade="false" null-color="black" null-transparent="true"/> <GridInflectionList> <GridInflection value="0.4" color="yellow"/> <GridInflection value="0.5" color="green"/> <GridInflection value="0.6" color="blue"/> </GridInflectionList> </GridStyle> </NamedStyle> GridInflection A GridInflection element defines a style for a grid inflection point. A grid inflection point indicates that a cell with the specified value should be rendered with the specified color. Context Table 33: Context on page 156 lists the elements that can contain, or be contained by, a GridInflection element. Spectrum Spatial Developer Guide 155

Named Styles Table 33: Context Contained by GridInflectionList Element GridInflection Contains (empty) Attributes Table 34: Attributes on page 156 lists the attributes of a GridInflection element. Table 34: Attributes Attribute value A floating-point value specifying the value of the grid inflection point. Note: This attribute is required. color A string value specifying the color of the grid inflection point. The value can be any valid CSS color. (See http://www.w3.org/tr/rec-css1#color-units.) Note: This attribute is required. Example This example specifies a grid image style that contains a collection of three grid inflection points. <?xml version="1.0" encoding="utf-8"?> <NamedStyle version="mxp_workspace_1_5" xmlns="http://www.mapinfo.com/mxp"> <GridStyle id="migridstyle" name="migridstyle" contrast="0.5" brightness="0.5" opacity="1" grayscale="false" show-hillshade="false" null-color="black" null-transparent="true"/> <GridInflectionList> <GridInflection value="0.4" color="yellow"/> <GridInflection value="0.5" color="green"/> <GridInflection value="0.6" color="blue"/> </GridInflectionList> </GridStyle> </NamedStyle> 156 Spectrum Technology Platform 9.0

Chapter 9: Using Styles Composite Styles A composite style specifies the visual characteristics of a set of other geometry types such as lines and areas. MapinfoTextObjectStyle A MapinfoTextObjectStyle element defines a composite style for a legacy MapInfo text object. Legacy MapInfo text objects can be defined only in a MapInfo native data file, also known as a TAB file. A MapinfoTextObjectStyle element contains styles for the text content (defined by a FontStyle element) and the optional callout line (defined by an LineStyle element). Context Table 35: Context on page 157 lists the elements that can contain, or be contained by, a MapinfoTextObjectStyle element. Table 35: Context Contained by NamedStyle or CompositeStyle Element MapinfoTextObjectStyle Contains FontStyle and LineStyle Attributes Table 36: Attributes on page 157 lists the attributes of a MapinfoTextObjectStyle element. Table 36: Attributes Attribute id name A unique identifier for the element. A descriptive name for the element. Example This example specifies a 12-point sans serif font for the text content, and 1-pixel black line for the callout line. <?xml version="1.0" encoding="utf-8"?> <NamedStyle version="mxp_workspace_1_5" xmlns="http://www.mapinfo.com/mxp"> <MapinfoTextObjectStyle> <FontStyle family="microsoft Sans Serif" font-style="normal" effect="white" effect-opacity="1" effect-type="none" font-weight="normal" text-decoration="none" text-case="default" Spectrum Spatial Developer Guide 157

Named Styles shadow="false" expand="false" size="12" size-unit="mapinfo:length pt" stroke="black"/> <LineStyle stroke="black" stroke-opacity="1" width="1" width-unit="mapinfo:imagesize pixel"> <Pen>mapinfo:pen 2</Pen> </LineStyle> </MapinfoTextObjectStyle> </NamedStyle> AreaStyle An AreaStyle element defines a composite style comprising a line style (as defined by a LineStyle element) and a fill style (as defined by an Interior element). Context Table 37: Context on page 158 lists the elements that can contain, or be contained by, an AreaStyle element. Table 37: Context Contained by NamedStyle or CompositeStyle Element AreaStyle Contains LineStyle and Interior Attributes Table 38: Attributes on page 158 lists the attributes of an AreaStyle element. Table 38: Attributes Attribute id name A unique identifier for the element. A descriptive name for the element. Example This example specifies an area filled with a solid light green color, bounded by a 1-pixel dashed black line. <?xml version="1.0" encoding="utf-8"?> <NamedStyle version="mxp_workspace_1_5" xmlns="http://www.mapinfo.com/mxp" xmlns:gml="http://www.opengis.net/gml"> <AreaStyle> 158 Spectrum Technology Platform 9.0

Chapter 9: Using Styles <LineStyle width="1" width-unit="mapinfo:imagesize pixel"> <Pen>mapinfo:pen 9</Pen> </LineStyle> <Interior fill-opacity="1" fill="(#id7)"> <Defs> <Pattern id="id7"> <Bitmap uri="mapinfo:brush 2"> <ColorAdjustmentSet> <ColorAdjustment color-1="nonwhite" color-2="rgb(224,255,176)" opacity="1"/> <ColorAdjustment color-1="white" color-2="white" opacity="1"/> </ColorAdjustmentSet> </Bitmap> </Pattern> </Defs> </Interior> </AreaStyle> </NamedStyle> CompositeStyle A CompositeStyle element defines a composite style that comprises zero or one of each of the following: AreaStyle, LineStyle, RasterStyle, FontStyle, GridStyle, PointStyle, and MapinfoTextObjectStyle. Context Table 39: Context on page 159 lists the elements that can contain, or be contained by, a CompositeStyle element. Table 39: Context Contained by NamedStyle Element CompositeStyle Contains Zero or one of each of the following: AreaStyle LineStyle RasterStyle FontStyle GridStyle PointStyle MapinfoTextObjectStyle Attributes Table 40: Attributes on page 160 lists the attributes of a CompositeStyle element. Spectrum Spatial Developer Guide 159

Named Styles Table 40: Attributes Attribute id name A unique identifier for the element. A descriptive name for the element. Example This example specifies a composite style that has these features: An area filled with a solid light green color, bounded by a 1-pixel dashed black line. A 12-point sans serif font for the text content, and 1-pixel black line for the callout line. <?xml version="1.0" encoding="utf-8"?> <NamedStyle version="mxp_workspace_1_5" xmlns="http://www.mapinfo.com/mxp" xmlns:gml="http://www.opengis.net/gml"> <CompositeStyle> <AreaStyle> <LineStyle width="1" width-unit="mapinfo:imagesize pixel"> <Pen>mapinfo:pen 9</Pen> </LineStyle> <Interior fill-opacity="1" fill="(#id7)"> <Defs> <Pattern id="id7"> <Bitmap uri="mapinfo:brush 2"> <ColorAdjustmentSet> <ColorAdjustment color-1="nonwhite" color-2="rgb(224,255,176)" opacity="1"/> <ColorAdjustment color-1="white" color-2="white" opacity="1"/> </ColorAdjustmentSet> </Bitmap> </Pattern> </Defs> </Interior> </AreaStyle> <MapinfoTextObjectStyle> <FontStyle family="microsoft Sans Serif" font-style="normal" effect="white" effect-opacity="1" effect-type="none" font-weight="normal" text-decoration="none" text-case="default" shadow="false" expand="false" size="12" size-unit="mapinfo:length pt" stroke="black"/> <LineStyle stroke="black" stroke-opacity="1" width="1" 160 Spectrum Technology Platform 9.0

Chapter 9: Using Styles width-unit="mapinfo:imagesize pixel"> <Pen>mapinfo:pen 2</Pen> </LineStyle> </MapinfoTextObjectStyle> </CompositeStyle> </NamedStyle> Pattern Codes Pattern codes enable you to specify which line and fill patterns you want to be displayed in a map. Line Pattern Codes The following figure shows the line patterns, and corresponding pattern codes, available in Spectrum Technology Platform. Note: Pattern 1 is invisible. Spectrum Spatial Developer Guide 161

Symbol Codes Fill Pattern Codes The following figure shows the fill patterns, and corresponding pattern codes, available in Spectrum Technology Platform. Symbol Codes Symbol codes enable you to specify which symbols you want to be displayed in a map. 162 Spectrum Technology Platform 9.0

Chapter 9: Using Styles MapInfo 3.0 Symbol Codes The following figure shows the symbols, and corresponding symbol codes, available in the MapInfo 3.0 symbol set. Note: Symbol 31 is an invisible symbol. Spectrum Spatial Developer Guide 163

Rasters and Grids 10 This section provides information on how to use raster and grid images in Spectrum Technology Platform. Raster images are useful in mapping to provide additional context and reference information.grid images, which are a special type of raster, show a color gradation over an area representing the interpolation of data points. Raster images are typically used as a base layer in a map, while grid layers are used as overlays, on top of other layers. For example, aerial photographs that show real-world detail such as buildings, refineries, and vegetation are well-suited as base layers for a map. Scanned paper maps are another example of a raster image. Use a raster image as a base layer and overlay vector data such as street networks, point locations representing customers, and postal boundaries, to create useful and visually appealing maps. Raster and grid images used in Spectrum Technology Platform must be registered so that known geographic points on the image coincide with the same features on the vector data. Additionally, company logos and other art you wish to display must be registered to some location on earth, even though they are not true georeferenced data. Many raster images available today come with a registration file in MapInfo TAB format. To register a raster image, bring it into MapInfo Professional and register it there. Grid images can be created in MapInfo Professional. as well. In this section: Supported Capabilities for Rasters and Grids........166 Using Rasters and Grids.........................167

Supported Capabilities for Rasters and Grids Supported Capabilities for Rasters and Grids The following raster and grid capabilities are supported in Spectrum Technology Platform. Raster and grid images can be part of a map rendering request to the Mapping, Map Tiling, or WMS services. The metadata associated with rasters and grids can be queried via the Feature Service, WFS and CSW services. Map Projection A map including a raster or grid layer is projected using the coordinate system of the raster or grid image. Raster images are not reprojected to match the other layers in a map. Legend Support Responses containing raster and grid images can return legend information in a rendering request. The swatch that represents the raster layer displays a generic raster icon. For a grid layer, the inflection color is returned. See also Add a Legend to Your Map on page 182. Styles Raster or grid styles are supported as override themes on the named layer. Supported styles for raster include: grayscale, brightness, contrast, opacity and transparency color. Grid styles additionally include an inflection color list. Override Themes Raster images can include an override theme provided the theme is part of the named layer definition. Override themes are used to change the display of the raster or grid, such as brightness, contrast, transparency. In the case of grid, the inflection list can be overridden. The theme style of the override is defined as an MWS raster or grid style. Overlay Support Grid images can be used as an overlay in a named map. Raster images cannot. The grid image is contained in a GridLayer where the style, interpolation mode, bounds and points table are queryable. Related Links Using Raster and Grid Images in the Location Intelligence Module on page 167 Supported Raster Formats The following raster and grid formats are supported in Spectrum Technology Platform. Raster formats: Format GIF PNG JPEG BMP TIFF GeoTiff File Extension.gif.png.jpg/.jpeg.bmp,.wbmp.tif.geotif 166 Spectrum Technology Platform 9.0

Chapter 10: Rasters and Grids Paint Targa Windows Metafile ECW MrSid ADRG CADRG CIB NITF.pcx.tga.wmf,.emf.ecw.sid.gen.gen various.ntf Grid Formats Format MapInfo Grid Vertical Mapper Continuous Grid Vertical Mapper Classified Grid Defense Digital Terrain Elevation Data (DTED) File Extension.mig.grd.grc (view only).dt0,.dt1,.dt2,.dt3 In order to use rasters and grids as a map layer, there must be an associated.tab file containing georeference information about the image, including the bounds, coordinate system and registration points. Using Rasters and Grids Raster and grid images can be included in a named map that can be rendered via the Mapping Service or queried for its metadata via the Feature Service. This is done by creating a named layer or named table for the raster or grid, just as you would do for a vector layer. The overall process of using raster and gird images in Spectrum Technology Platform is to create the image as a named table or named layer and include it in a named map definition. Use either SOAP or REST to render the map or retrieve metadata about the image. Grid Example The following Java code shows how to create a GridLayer and use it in a request for a named map. This sample is available in the JAXB_Samples.zip in the mapping folder. For an explanation of the GridLayer elements, see GridLayer Elements. public class RenderNamedMapWithGridLayerOverlay { public static void main(string[] args) { try { MappingServiceInterface mapping = Preference.getServiceinterface(); Point mapcenter = BuildGeometry.buildPoint("mapinfo:coordsys 12, 62, 7, 0.0", 0, 0, null); MapView mapview = MappingView.getZoomAndCenterMapView(mapCenter,MappingUtility.buildDistance(19000, DistanceUnit.KILOMETER)); NamedTable namedtable = new NamedTable(); namedtable.setname("/namedtables/worldcaptable"); Spectrum Spatial Developer Guide 167

Using Rasters and Grids Distance cellwidth = MappingUtility.buildDistance(50, DistanceUnit.MILE); IDWInterpolator interpolator = new IDWInterpolator(); interpolator.setaggregationmethod(aggregationmethod.average); interpolator.setexponent(2); interpolator.setmaxpoints(25); interpolator.setsearchradius(100); CustomInflectionCollection inflectioncollection = new CustomInflectionCollection(); inflectioncollection.setinflectionmethod(inflectionmethod.equal_count); inflectioncollection.setroundby(0.1); InflectionColorBinList inbinlist = new InflectionColorBinList(); InflectionColorBin red = new InflectionColorBin(); red.setcolor("red"); inbinlist.getinflectioncolorbin().add(red); InflectionColorBin yellow = new InflectionColorBin(); yellow.setcolor("yellow"); inbinlist.getinflectioncolorbin().add(yellow); InflectionColorBin green = new InflectionColorBin(); green.setcolor("green"); inbinlist.getinflectioncolorbin().add(green); InflectionColorBin rgb = new InflectionColorBin(); rgb.setcolor("rgb(0,255,255)"); inbinlist.getinflectioncolorbin().add(rgb); InflectionColorBin blue = new InflectionColorBin(); blue.setcolor("blue"); inbinlist.getinflectioncolorbin().add(blue); inflectioncollection.setinflectioncolorbinlist(inbinlist); //Creating GridEnvelope List<Pos> pointlist = new ArrayList<Pos>(2); pointlist.add(buildgeometry.buildpos(-1.6190368438028984e7, -5501153.098687401, null)); pointlist.add(buildgeometry.buildpos(1.6606614137907444e7, 6743291.671893631, null)); Envelope gridenvelope = BuildGeometry.buildEnvelope("mapinfo:coordsys 12, 62, 7, 0.0", pointlist); //Creating GridLayer Layer gridlayer = MappingUtility.buildGridLayer(namedTable, null, cellwidth, "Cap_Pop", "Obj", interpolator, inflectioncollection, gridenvelope); RenderNamedMapWithOverlayRequest request = MappingServiceRequestBuilder.createRenderNamedMapOverlayRequest ("RenderNamedMapWithGridLayerOverlay","/NamedMaps/WorldMap", mapview, gridlayer); RenderNamedMapWithOverlayResponse response = mapping.rendernamedmapwithoverlay(request); PrintMappingResponse.printRenderNamedMapWithOverlayResponse(response); 168 Spectrum Technology Platform 9.0

Chapter 10: Rasters and Grids catch (ServiceException se) { PrintMappingResponse.printError(se); catch (Exception e) { e.printstacktrace(); GridLayer Elements This table defines the schema elements that make up a GridLayer. Element Table Style CellWidth ValueExpression SpatialExpression Interpolator Aggregation method SearchRadius MaxPoints Exponent InflectionCollection ComputedInflectionCollection CustomInflectionCollection Equal Count Equal Range The underlying table that the grid layer references. The raster style definition that is applied (e.g, brightness, contrast, opacity) The width of a grid cell. The expression used to derive the value of a grid cell. The expression used to get the value of the point geometry. An algorithm used to create a grid. Spectrum Technology Platform support IDW (Inverse Distance Weighting) which uses a distance weighted average of data points to calculate grid cell values. The IDW interpolator is best suited for data values that produce arbitrary values over the grid, that is, data that does not have any relationship or influence over neighboring data values, such as population. This method of interpolation also works well for sparse data. The method by which the interpolator aggregates the values contained in the same grid cell. Average, Count, Maximum, Minimum and Sum are supported. The maximum distance in grid cells between a grid cell and its neighboring data points. The distance determines if these points are considered in the distance weighing average. Maximum number of data points in the table to be used for interpolation. Determines how much influence each point will have on the result. The higher the exponent the greater the influence closer points will have on the cell value. Exponents can range from 1 to 10. A collection of elements that refer to how the color that represents the values is spread. The inflection color-spreading method that takes start and end colors (default startcolor = blue, endcolor = red) The inflection color-spreading method that uses a specific color for each inflection. The color is then spread between two inflections. Sets the inflection values so that approximately an equal number of grid cells fall between each inflection value. Spreads the inflections evenly between the minimum and maximum of the source data range. Spectrum Spatial Developer Guide 169

Using Rasters and Grids RoundBy InflectionSize Amount by which the values are rounded. If the inflection method is based on cell count, you may not see the effects of the rounding factor until the inflection values are calculated. Number of bins that the values are grouped into. 170 Spectrum Technology Platform 9.0

How To's 11 This section contains instructions for commonly performed tasks. In this section: Mapping.......................................172 Accessing Data from a Database..................183 Map Tiling.....................................184 Web Service Authentication......................199 WMS Configuration..............................203 Custom Symbols................................211

Mapping Mapping Design Your Map Spectrum Technology Platform supports a range of approaches to designing maps for use with the Mapping Service, from simple named maps that require no customization, to more complex maps where styles and themes can be created on the fly. The amount of customization to include in your map is tied to how you want your users to interact with it and how dynamic your data is. Render a Named Map The simplest map to render is a named map. A named map resides in the repository and includes all the data source, mapping and layer information needed to display a map image. A named map can be rendered in a SOAP or REST request. The only information to provide at runtime in addition to the named map is the map view, which is the location and the size of the map. The best way to create a named map is to use MapInfo Professional to interactively create your map content and settings. Saving this map as an MWS (MapInfo Workspace) provides the XML content for the Named Map Tool in Management Console to store the map and related items in the repository. It is then ready for use by the Mapping Service. For a SOAP example, go to the Spectrum Spatial SOAP Mapping Service Demo Page at http://hostname[:portnumber]/spatial/mappingservice/demopage.html Render Named Map from the drop-down list. For a REST example, see Render Named Map Given a Center and Zoom on page 46. and choose Render a Named Map with an Overlay If a named map is too restrictive, consider adding an overlay in your mapping request. An overlay is a way of customizing a named map that cannot be customized directly. Overlays can be layers or themes, and can be based on tables, inline tables and views. For example, an overlay of a feature layer can include features from an in-memory table as the result of a search query. Overlays are part of the mapping request. They are not stored in the repository. In a SOAP request the overlay is defined in an OverlayList. In a REST request, the overlay is defined in the JSON object. For a SOAP example, go to the Spectrum Spatial SOAP Mapping Service Demo Page at http://hostname[:portnumber]/spatial/mappingservice/demopage.html Render Named Map with BarLayer Overlay from the drop-down list. For a REST example, see Map with Pie Layer Overlay on page 58. and choose Render Map with Named Layers Using named layers in a map provides users with some level of interaction with the map. The named layers are listed in sequence in the request, which determines the draw order of the map image. This is a good option if you want your application logic or users to select and deselect layers to control the display of information on the map. Named layers are a very powerful capability for managing data. The purpose of a named layer is to indicate how the data in the table is styled. You can create reusable style definitions for a data set by building the complexity you want, such as themes, styles, and zoom level. To use it, you only need to call the layer by name. 172 Spectrum Technology Platform 9.0

Chapter 11: How To's This option provides similiar functionality to WMS. Rendering a map with named layers allows you to point directly to the named layer, whereas with WMS, the named layer must be first set up in a configuration file. WMS includes GetFeatureInfo whereas the Mapping Service does not. For a SOAP example, go to the Spectrum Spatial SOAP Mapping Service Demo Page at http://hostname[:portnumber]/spatial/mappingservice/demopage.html Render Map1 example from the drop-down list. For a REST example, see Center and Zoom with Multiple Layers on page 57. and choose Render Map with Inline Layers For more flexibility when rendering a map you can use inline layers, which are layers that are defined in the request. Any supported layer type can be defined inline. Layers can be defined by named tables or memory tables. Named Table The simplest form of an inline layer is defined by a named table. For more dynamic data, consider adding themes, styles, and labels inline instead of building them into the named layer. For a SOAP example, go to the Spectrum Spatial SOAP Mapping Service Demo Page at http://hostname[:portnumber]/spatial/mappingservice/demopage.html and choose Render Map With FeatureLayer IVT from the drop-down list. This example includes an inline FeatureLayer that is defined by a named table (/Samples/NamedTables/USA) and an Individual Value theme defined with named styles. For a REST example, see Equal Count Range Theme with MapBasic Styles on page 60. This example shows the JSON section of the request that includes a FeatureLayer that is defined by a named table (/Samples/NamedTables/USA) and a Range theme. Memory Table An inline layer that is defined by a memory table is a powerful capability when rendering a map. This option is useful when the data to act upon is not accessible as a named table. Your application would generate a FeatureCollection, for example, a list of points, that can be passed in the request and rendered without accessing the actual data or referring to a named table. For a SOAP example, go to the Spectrum Spatial SOAP Mapping Service Demo Page at http://hostname[:portnumber]/spatial/mappingservice/demopage.html and choose Render Map2 from the drop-down list. This example includes an inline FeatureLayer that is defined by a memory table, where the FeatureCollection are point locations defined by strings. Use a Map Created in MapInfo Professional A typical early step when developing an application to interact with the Location Intelligence Module in Spectrum Technology Platform is to bring a map that you have created in MapInfo Professional into the Spectrum Spatial repository. This is done by using a MapInfo Professional workspace (MWS) in Management Console or with the MWS Upload Utility. An.MWS is an XML-based workspace containing the map layers and settings that are used to render a map. Using the Management Console, the MWS content is used to add named resources to the repository. For more information on Management Console, see the application's online help. The MWS Upload Utility creates named resources from a MapInfo Professional workspace (MWS) file and then uploads those resources to your repository. The upload tool only runs on Windows systems with access to the repository and the workspace you want to upload. The tool works by splitting the workspace into named resources. The path to any data files on the local computer are replaced with the path to a copy of the data files on the server. Finally, the named resources are uploaded to the repository. Spectrum Spatial Developer Guide 173

Mapping Adding a Named Map and Named Tables To add named maps and named tables to the repository using the Management Console: 1. Open Management Console. 2. Expand Modules > Location Intelligence > Tools then click Named Maps. 3. Click Add. The Add Named Map dialog box appears. 4. Select the MWS file in the MWS source field using the browser button. This MWS file will be used to define the named map. 5. In the Named Map name field enter the name for the named map to be created. You can either use the repository browser button and select the directory in the repository and enter the named map name, or enter the repository path and named map name information in the field. For example, if you are entering the information in the field and creating the nymap named map in the Maps folder in the repository, the name you would enter in the Named map name field would be /Maps/nymap. 6. Select one of the following methods to generate the table information for the named map: The Use inline tables option generates a named map with table definitions inline. This means that no named tables are used, rather the named map will contain all relevant table information. Choose this option if you will not be querying data but are merely planning to create tiles from the StreetPro data. The Create named tables option generates new named tables in the repository in the specified folder that you define in the Named tables path field. You must choose this option if you are planning to query the StreetPro data that you are uploading. If the named table already exists in that folder, it will use the existing one, unless you have selected the Overwrite named tables option. In this case, all named tables will be overwritten with new named table definitions. 174 Spectrum Technology Platform 9.0

Chapter 11: How To's Note: The Use existing named table option updates the named map by populating the tables in the map using already existing named tables in the repository. The list of named tables are populated in the list and you must verify that each of the named tables is valid in the named map. This option is useful if you have only modified styles and not tables in the MWS in MapInfo Professional, for example. 7. For the Use inline tables and Create named tables options, leave the Local data path blank. 8. For the Use inline tables and Create named tables options, specify the best server path from the server's perspective. The Server data path is used to define the new path from the machine on which you are using Management Console to upload the MWS file (local path), to the new table files located on the hosting machine (server path). For example, if the server is on a machine you remote to, use the mapped drive that is on the server if applicable, not the mapped drive on your own machine. Also a mapped drive address is more efficient than a UNC address, such as \\server-name\directory\filename. This will replace all data paths in the MWS file (up to the name of the table) with the new path specified. This includes both relative or full paths. 9. Click OK. The new named map appears in the tree in the Named Maps dialog. 10. To verify that you successfully uploaded all named tables for the Use inline tables option, open the named map using WebDAV to inspect that the named tables appear inline: 11. To verify that you successfully created all named tables for the Create named tables option, click Modify. You can now see the named tables: Spectrum Spatial Developer Guide 175

Mapping 12. To verify that you can render a map using the new named map, select the Render Named Map request on the Mapping Service Demo Page (http://localhost:8080/spatial/mappingservice/demopage.html), modify the NamedMap in the request to match the one you created (as well as the X, Y, and Zoom as needed), then submit. A map image appears on the right side of the page. 176 Spectrum Technology Platform 9.0

Chapter 11: How To's Note: For the Create named tables option, the tab files referenced in the MWS must exist in the server path or you get an error on loading; for the Use inline tables option, you will not get the error. In the latter case, the named map you create will error at render time. Upload a Workspace to the Repository To upload a workspace to your repository: 1. Copy all data files used by the workspace to the Spectrum Technology Platform hosting machine. 2. For StreetPro data only, edit the MWS <filename> element to add the path to the data. 3. Run MWSUploadUtility.exe from any computer with access to the repository. When the utility launches, provide it with the following information: Repository: The standard WebDAV URL for the repository, including the final slash e.g., http://localhost:8080/repositoryservice/repository/default/ NamedMap Path: The path inside the repository to upload the Named Map files. If nothing is specified then the files will be uploaded at the repository root. Spectrum Spatial Developer Guide 177

Mapping NamedTables Path: The path inside the repository to upload the Named Table files. If nothing is specified then the files will be uploaded at the repository root. For StreetPro data, you do not need to create Named Tables, so leave this blank. MapName: The name of the Named Map to create in the repository. If nothing is specified then the name will default to the name of the MWS file. Local Data Path: The path to any referenced data files on the machine where the MWS file was created. If you do not know where the data files are located, then open the MWS file in a text editor and look for the path for any TAB file. For StreetPro data, leave this blank. Server Data Path: The path to the same data files on your Spectrum Technology Platform hosting machine. For StreetPro data, leave this blank. 4. Select the upload options you want to use. Overwrite Files: Check this box to overwrite any named resources in the repository with the same name. If this option is not checked, and a file exists with the same name, a new file will be created following this format: If States table exists, then States_0 will be created, then States_1, States_2, States_3, and so on. Maps: Create a named map resource in the repository for this workspace. You must check this option to view this workspace with the Mapping and Map Tiling services. Tables: Create a named table in the repository for each table used by the workspace. You must check this option to access these tables with the Feature Service. When selecting the Tables option, the Maps option, and NOT selecting the Use Named Tables option, the tool will create a named map with references to existing named tables. For StreetPro data, leave the checkbox empty. Use Named Tables: Reference named tables from the named map resource. If you check this option, then you must also create named tables with the Tables option (unless you already have these tables in the repository). If you do not check this option, then references to the tables used by the workspace will be embedded in the named map. For StreetPro data, leave the checkbox empty. 5. Click Upload Workspace. The tool will prompt you for the workspace file. If you have provided paths for the local data and server data, the tool looks for any references to the local data path in the MWS and dependent files, and then replaces them with the server data path. The program has now finished running. To verify that your named resources are in the repository, go to the repository at: http://hostname[:portnumber]/repositoryservice/repository/default/ Render a Map Once your named resources from the MWS are available in the repository, you are ready to use them in Location Intelligence Module. Rendering a map involves making a RenderMap request to the Spectrum Spatial server. For learning purposes, we will use the Mapping Demo Page that include a list of common SOAP requests. To render a map: 1. Go to the Spectrum Spatial SOAP Mapping Service Demo Page at http://hostname[:portnumber]/spatial/mappingservice/demopage.html 2. Choose Render Named Map from the drop-down list of mapping requests and click Submit. The Spectrum Spatial Mapping Service will process the request and return a SOAP response and an image of the named map. The named map associated with this demo request is using a sample named map that was uploaded to the repository at installation time. 3. To view the response and image for one of your named maps, edit the request and replace the text /Samples/NamedMaps/USA with your named map and click Submit. Related Links You may need to change the map request to use the center and zoom width appropriate for your data. 178 Spectrum Technology Platform 9.0

Chapter 11: How To's MapView Types on page 243 Create a Thematic Map To create a named layer that has a theme, or a named map that contains named theme layers, you have to create the definition file for the named layer or named map. The easiest way to gather the information for the named definition is to start in MapInfo Professional. There you create a map with the required theme layers and save it as a MapInfo Workspace (MWS) file. The elements in the MWS serve as the source of information that you will copy and paste into the named layer or named maps containing named layers. Apart from the relative ease with which you can create the definition file, this method has the advantage of enabling you to preview the visual appearance of the thematic map and make adjustments in MapInfo Professional before you save the MWS file. Note: While MapInfo Professional can save a map as an MWS file, it cannot always read an MWS file reliably. This means that if you later need to modify the thematic map layers, you may not be able to read the source MWS file back into MapInfo Professional to make the changes. If you need to modify a named layer or named map definition that contains a named theme, you will have to go into MapInfo Professional again to save it as an MWS again. Creating a Theme Using MapInfo Professional For detailed instructions on creating themes in MapInfo Professional, see the MapInfo Professional online help. To create a theme for a map: 1. In MapInfo Professional, open the map in which you want to create the theme layer. If the map does not yet exist, create it. 2. In the map, select the layer to which you want to apply a theme. If the layer does not yet exist, create it. 3. Apply the desired theme to the map layer. 4. Save the map to a MapInfo Workspace (MWS) file. It is also a good idea to save the workspace as a.wor. If you need to make changes to the map, re-open the.wor in MapInfo Professional. MapInfo Professional may not read the.mws file reliably. The MWS will be used to create a named layer and a named map in the following steps. Creating a Named Layer that Has a Theme To create a named layer definition that contains a theme: 1. Create a new empty XML file, and paste the following lines into it: <?xml version="1.0" encoding="utf-8"?> <NamedLayer version="mxp_namedresource_1_5" xmlns="http://www.mapinfo.com/mxp"> <ConnectionSet /> <DataSourceDefinitionSet> </DataSourceDefinitionSet> </NamedLayer> This will become the definition file for the new named layer. 2. Using the MWS you created in Creating a Theme Using MapInfo Professional on page 179, open it in an XML editor. Find the element that defines the theme layer you want to save as a named layer. This element will have the name <FeatureLayer> or <ObjectThemeLayer>, depending on the type of theme you applied. See the note below. For simplicity, this procedure assumes that the theme layer is defined within a <FeatureLayer> element. Spectrum Spatial Developer Guide 179

Mapping 3. Copy all the lines from the open <FeatureLayer> element tag to the close </FeatureLayer> element tag, and paste them into the new definition file immediately above the close </NamedLayer> element tag, as show in the following example: <?xml version="1.0" encoding="utf-8"?> <NamedLayer version="mxp_namedresource_1_5" xmlns="http://www.mapinfo.com/mxp"> <ConnectionSet /> <DataSourceDefinitionSet> </DataSourceDefinitionSet> <FeatureLayer>... <DataSourceRef ref="id4" />... </FeatureLayer> </NamedLayer> Note: If you applied a bar chart, pie chart or graduated symbol theme to the map layer, then the layer is defined within an <ObjectThemeLayer> element. If you applied a dot density, individual value, or ranged theme, then the layer is defined within a <FeatureLayer> element. 4. The <FeatureLayer> element you just copied will contain a <DataSourceRef> child element. Take note of the <DataSourceRef> element's ref attribute value. 5. In the MWS file, find the <DataSourceDefinition> element that has the same id attribute value as the <DataSourceRef>'s ref attribute value noted in the previous step. The <DataSourceDefinition> element is a child of the <DataSourceDefinitionSet> element, and has different names depending on the type of the data source. For example, if the data source is a TAB file, then the element name will be <TABFileDataSourceDefinition>. 6. Once you find the corresponding <DataSourceDefinition> element (for example, <TABFileDataSourceDefinition>), copy all the lines from the open element tag to the close element tag, and paste them between the open and close tags of the <DataSourceDefinitionSet> element, as shown in the following example: <?xml version="1.0" encoding="utf-8"?> <NamedLayer version="mxp_namedresource_1_5" xmlns="http://www.mapinfo.com/mxp"> <ConnectionSet /> <DataSourceDefinitionSet> <TABFileDataSourceDefinition id="id4">... </TABFileDataSourceDefinition> </DataSourceDefinitionSet> <FeatureLayer>... <DataSourceRef ref="id4" />... </FeatureLayer> </NamedLayer> 7. Save the new named layer definition file as a UTF-8 encoded file without the BOM (byte order mark). 8. If you have not already done so, download the schema files to your local machine. The schema files are available for download at support.pb.com. 9. In your XML editor, associate the new definition file with the MXP_NamedResource_1_5.xsd schema you downloaded in step 8 on page 180. 10. Check that the new definition file is valid against the MXP_NamedResource_1_5.xsd schema. If there are any errors, correct them. 180 Spectrum Technology Platform 9.0

Chapter 11: How To's 11. Once the new definition file passes validation, remove the schemalocation attribute that was added to the root element by your XML editor when you associated the new definition file with the MXP_NamedResource_1_5.xsd schema in step 9 on page 180. 12. Save the definition file and add it to the Location Intelligence Module repository using the Named Resource Service, WebFolders or DAVExplorer. The new named layer, with theme applied, can now be added to your named maps. Creating a Named Map that Contains Theme Layers To create a named map definition that contains theme layers: 1. Create a new empty XML file, and paste the following lines into it: <?xml version="1.0" encoding="utf-8"?> <NamedMapDefinition version="mxp_namedresource_1_5" xmlns="http://www.mapinfo.com/mxp" xmlns:gml="http://www.opengis.net/gml"> <ConnectionSet /> <DataSourceDefinitionSet> </DataSourceDefinitionSet> </NamedMapDefinition> This will become the definition file for the new named map. 2. Using the MWS you created in Creating a Theme Using MapInfo Professional on page 179, open the MWS file in an XML editor, and find the <MapDefinition> element that defines the map you want to save as a named map. 3. Copy all the lines from the open <MapDefinition> element tag to the close </MapDefinition> element tag, and paste them into the new definition file immediately above the close </NamedMapDefinition> element tag, as show in the following example: <?xml version="1.0" encoding="utf-8"?> <NamedMapDefinition version="mxp_namedresource_1_5" xmlns="http://www.mapinfo.com/mxp" xmlns:gml="http://www.opengis.net/gml"> <ConnectionSet /> <DataSourceDefinitionSet> </DataSourceDefinitionSet> <MapDefinition>... </MapDefinition> </NamedMapDefinition> 4. In the MWS file, find the <DataSourceDefinitionSet> element and copy all its child <DataSourceDefinition> elements into the new definition file under the <DataSourceDefinitionSet> element. Note: The <DataSourceDefinition> elements will have different names depending on the type of the data source. For example, if the data source is a TAB file, then the element name will be <TABFileDataSourceDefinition>. 5. Save the new named map definition file as a UTF-8 encoded file without the BOM (byte order mark). 6. If you have not already done so, download the schema files to your local machine. The schema files are available for download at support.pb.com. 7. In your XML editor, associate the new definition file with the MXP_NamedResource_1_5.xsd schema you downloaded in step 6 on page 181. Spectrum Spatial Developer Guide 181

Mapping 8. Check that the new definition file is valid against the MXP_NamedResource_1_5.xsd schema. If there are any errors, correct them. 9. Once the new definition file passes validation, remove the schemalocation attribute that was added to the root element by your XML editor when you associated the new definition file with the MXP_NamedResource_1_5.xsd schema in step 7 on page 181. 10. Save the definition file and add it to the Location Intelligence Module repository using the Named Resource Service, WebFolders or DAVExplorer. Add a Legend to Your Map Unlike other map components such as themes and styles, legends cannot be included as part of the static definition of a named map. That is, the named resource schemas do not provide any elements for including a legend in a named map's definition file. Instead, legends are always generated 'on-the-fly' when the named map is requested, based on the defined themes and styles of the map's layers. A map legend is composed of individual legend entries or rows. Each legend entry in turn is composed of a symbol or color swatch followed by a text description. When you submit a request for the legend of a named map, zero, one, or more legend entries are returned for each layer in the named map. When you want to request a legend for a map, the request must be submitted to the Mapping Service. You can submit the Mapping Service request directly through either the SOAP interface or the REST interface, or indirectly through the RIA controls. Requesting a Legend Using SOAP To request a map legend using the Mapping Service SOAP interface, you submit (via HTTP POST) a GetNamedMapLegendsRequest request message to the Mapping Service SOAP interface. The Mapping Service will then return a GetNamedMapLegendsResponse response message that contains the requested legend data. For more information on the Mapping Service SOAP interface GetNamedMapLegendsRequest request message and GetNamedMapLegendsResponse response message, see the Services section in the Spectrum Technology Platform Spectrum Spatial Guide on support.pb.com. Legend Examples Using SOAP After you have installed the Location Intelligence Module web services, you can open the Mapping Service Demo Page and try submitting various SOAP requests for map legends. Requesting a Legend Using REST To request a map legend using the Mapping Service REST interface, you submit an HTTP GET request to the corresponding REST URL. The request URL will have this general form: HTTP GET /maps/mapname/legend.type;w=width;h=height;t=imagetype; [r=resolution];[l=locale]?[inlineswatch=boolean] For more information on the Mapping Service REST interface method to request a map legend, see the topic Get Legend for a Named Map in this guide. Legend Examples Using REST After you have installed the Location Intelligence Module web services, you can try submitting the following REST interface URLs to request map legends. Note: In the follow examples, the map legend data is returned in the form of a JSON object. http://<yourserverandport>/rest/spatial/mappingservice/maps/namedmaps /WorldMap/legends.json;w=16;h=16;t=png 182 Spectrum Technology Platform 9.0

Chapter 11: How To's http://<yourserverandport>/rest/spatial/mappingservice/maps/namedmaps /WorldMap/legends.json;w=16;h=16;t=png?inlineSwatch=false http://<yourserverandport>/rest/spatial/mappingservice/maps/namedmaps /WorldMap/legends.json;w=16;h=16;t=png;r=50 http://<yourserverandport>/rest/spatial/mappingservice/maps/namedmaps /WorldMap/legends.json;w=16;h=16;t=png;r=50;l=demo Requesting a Legend Using RIA Controls The RIA (Rich Internet Application) controls provide a set of browser-based user interface components for easily embedding maps and other location-based capabilities in web pages. Built entirely in JavaScript, the controls work without the need for any browser plug-ins and without having to write any server-side code. One of the RIA controls, the LegendControl, enables you to easily add a legend for your map. When your map is displayed in the browser, the LegendControl calls on the Mapping Service to provide the legend data for the map. The RIA controls are included when you install the Location Intelligence Module web services. For more information on the RIA controls, see What Are the RIA Controls? on page 34. For information on the RIA JavaScript API, see the support.pb.com. Legend Examples Using RIA Controls After you have installed the Location Intelligence Module web services, you can open the RIA Examples page to see the various RIA controls in action. To try the RIA LegendControl, click Map Legend on the left menu. Accessing Data from a Database The Location Intelligence Module supports several methods to access data stored in a database management system: Create an XML document that represents the data source. See the Resources and Data section in the Spectrum Technology Platform Spectrum Spatial Guide on support.pb.com for information on how to upload to the repository. Upload a workspace using the MWS Upload Utility. Recommended method: Add a JDBC connection to the data source using the Management Console. Adding or Modifying a JDBC Named Connection 1. Open the Management Console. 2. Expand Modules > Location Intelligence > Tools then click Named Connections. 3. Click Add or Modify. The Connection Properties dialog box will appear. 4. Enter a name for the resource in the Connection Name field. The name can be anything you choose. You cannot modify the name of an existing database resource. Changing the name of an existing database resource would cause any services or jobs that reference the database resource to fail. 5. In the Connection type drop-down, select JDBC. 6. In the URL field, specify the JDBC connection URL to the database. This URL is in the format jdbc:[subprotocol]:[node]/[databasename]. For example: Oracle jdbc:oracle:thin:@pbs-lim:1521:pbspatial SQL Server jdbc:sqlserver://pbs-lim:5432;databasename=pbspatial PostGres/GIS jdbc:postgresql://111.111.11.111:1433/pbspatial Spectrum Spatial Developer Guide 183

Map Tiling For connections to a SQL Server or PostGres/GIS instance, not all connection string options that would normally be available via a particular JDBC driver are supported. Since GeoTools is used to connect to both SQL Server and PostGres/GIS, only the described connection URLs are supported. 7. In the User name field, specify the user for connecting to the database resource. 8. In the Password field, specify the password for the user connecting to the database resource. 9. In the Properties field, specify any database specific connection properties. Consult the database documentation for property names and value types that can be appended to a connection string. For example, property value networkprotocol and key tcp. Note: Oracle is currently the only database to support properties from the dialog. For the PostGres/GIS and SQL Server append properties to the URL. 10. Click Test to make sure your connection is valid. 11. Click OK. The Named Connection to the database resource now appears in the list of available resources in Find Nearest, Query Spatial Data, and Read Spatial Data. These connections can also be used to access Named Tables in database resources. Map Tiling Map tiles are portions of a map that are seamlessly joined on the fly while you are panning and zooming in the map window. Each pan and zoom is a call to the server to request the appropriate map tile(s). Only those that fit the bounds of the map view and match the zoom level are returned. Google Maps and Bing Maps are examples of applications that use map tiles. Spectrum Technology Platform includes a Map Tiling Service that returns map tiles on the fly or from a tile cache at the user's request. Through the Map Tiling REST Interface, the mapping client can determine the maps that are available from the server, query the metadata of each map and return a map comprised of tiles. MapInfo StreetPro data is well-suited for use as map tiles. StreetPro is typically used as reference layers for a map. Configuring map tiling for use in Spectrum Technology Platform involves creating a named tile definition that describes your named map and adding it to the repository. To request tiles, use the Tile method from the REST interface. Tiles will be created on the fly. For greater rendering efficiency, consider pre-generating the map tiles or setting up a tile cache for on-the-fly tiles. Related Links Spectrum Spatial Service Guide Configuring the Map Tile Service The Map Tiling Service configuration file MapTilingConfiguration is located in the Configuration directory under the root repository. For example, a default installation will place the Map Tiling Service configuration file at http://localhost:8080/repositoryservice/repository/default/configuration/maptilingconfiguration. To configure the Map Tiling Service: 1. From the machine hosting Spectrum Technology Platform and the repository, copy the configuration file from the repository to a directory on your local machine using a standard WebDAV protocol tool. 2. Make changes to the local MapTilingConfiguration file. For parameter descriptions for the configuration file, see Global Configuration Parameters on page 185. 3. Upload the modified configuration file to the same location (and name) in the repository using your WebDAV tool. 184 Spectrum Technology Platform 9.0

Chapter 11: How To's 4. Use the Spectrum Technology Platform JMX Console to invoke the new configuration for the service. For instructions on how to reload the configuration using the JMX Console, see Reload the Service Configuration using JMX Console on page 187. Accessing the Repository using WebDAV Configuration files are pre-loaded in the repository for each service. These configuration files are located at http://localhost:8080/repositoryservice/repository/default/configuration/. To configure the services, you must use a WebDAV protocol tool to access the JCR repository, make changes to the configuration file, and reload the configuration using the JMX Console. There are many tools available to accomplish the WebDAV connection tasks. We have provided examples using WebFolders and DAVExplorer. Global Configuration Parameters The Map Tiling Service configuration consists of a set of global parameters that define how tiles are generated. These parameters are used if optional parameters defined in the named tiles are not specified. If a named tile has defined these parameters, then the parameters in the global configuration will be overwritten. The following are global configuration paramters: Parameter Type Required RepositoryURL string yes The URL defines the location of your local repository where resource are stored that are accessed by the Map Tiling service. This URL should point to the Repository Service rmi, for example: http://localhost:8080/repositoryservice/rmi Note: In most instances, this URL should not be changed. ExpirationDate string no The date on which the client should delete the map tile from the cache, and request a new copy from the server. The ExpirationDate value must be specified as a W3C formatted date string (for example, 2013-12-31). Note: The ExpirationDate parameter has effect only when using external caching software such as Squid or Apache. MimeList string no The available types of tiles generated by the tile server for named tiles when the MimeList is not specified. MapResolution integer no The resolution of the tile images in dots per inch (the number of individual dots that can be placed within the span of one linear inch). The minimum dpi you can define is 72, anything less would render a poor quality image. If a value less than 72 is defined, the service will throw an exception. MapRendering string no The rendering quality (anti-alias) of the tile images generated. You can specify either Speed or Quality. If MapRendering is not specified in either the global configuration or in a named tile, the default rendering quality is Speed. RenderLabels boolean no Tells the service not to render LabelLayers when generating a tile. The value is case-insensitive. If Spectrum Spatial Developer Guide 185

Map Tiling Parameter Type Required RenderLabels is not specified in either the global configuration or in a named tile, the default is 'true'. PadFactor integer no Used to prevent the clipping of labels when a label crosses a tile boundary. The PadFactor controls the amount of space is rendered around the requested tile with 0 meaning no padding, 1 meaning padding of 1 tile around the requested tile and so on. If PadFactor is not specified in either the global configuration or in a named tile, the default is 1.0. Internally, the Map Tiling service draws tiles to an offscreen bitmap (OSBM) (e.g., BufferedImage). To help speed up rendering of tiles by reducing garbage collection pauses, pools of offscreen bitmaps may be used to avoid constantly creating new ones. The OSBMPooling configuration controls how the offscreen bitmaps are created in memory. Note: If the OSBM pooling section of the configuration is removed, then pooling will not be enabled. The following are OSBM configuration paramters: Parameter Type Required MaxActive integer no Controls the maximum number of offscreen bitmaps (per tile dimension) that can be allocated by the pool (checked out to client threads, or idle in the pool) at one time. When non-positive, there is no limit to the number of objects per key. When this value is reached, the keyed pool is said to be exhausted. The default setting for this parameter is 8. MinIdle integer no The minimum number of idle offscreen bitmaps (per tile dimension) that should always be available. If this parameter is set to a positive number and TimeBetweenEvictionRunsMills is greater than zero, each time the idle object eviction thread runs, it will try to create enough idle instances so that there will be this number of idle instances available under each key. The default setting for this parameter is 0. MaxIdle integer no The maximum number of offscreen bitmap that can sit idle in the pool (per tile dimension) at any time. When negative, there is no limit to the number of objects that may be idle per key. The default setting for this parameter is 8. MaxTotal integer no The global limit on the number of objects that can be in circulation (active or idle) within the combined set of pools. When non-positive, there is no limit to the total number of objects in circulation. When MaxTotal is exceeded, all keyed pools are exhausted. When MaxTotal is set to a positive value and an offscreen bitmap is requested when at the limit with no idle instances available, an attempt is made to create room by clearing the oldest fifteen percent (15%) of the elements from the keyed pools. The default setting for this parameter is -1 (no limit). ExhaustedAction string no The behavior when the pool of offscreen bitmaps is exhausted. The options are fail, grow, or block. 186 Spectrum Technology Platform 9.0

Chapter 11: How To's Parameter Type Required Fail will throw an exception when an offscreen bitmap is requested when the pool is exhausted. Grow, the default, will create a new offscreen bitmap and return it, making MaxActive meaningless. Block will stop the process until a new or idle object is available. Optionally, one may configure the pool to examine and possibly evict objects as they sit idle in the pool and to ensure that a minimum number of idle objects is maintained for each key. This is performed by an idle object eviction thread, which runs asynchronously. Caution should be used when configuring this optional feature. Eviction runs require an exclusive synchronization lock on the pool. If they run too frequently or incur excessive latency when creating, destroying or validating object instances, performance issues may result. The idle object eviction thread may be configured using the MinEvictableIdleTimeMills and TimeBetweenEvictionRunsMills parameters. MinEvictableIdleTimeMills integer no The minimum amount of time that an offscreen bitmap may sit idle in the pool before it is eligible for eviction due to idle time. When non-positive, no object will be dropped from the pool due to idle time alone. This parameter has no effect unless TimeBetweenEvictionRunsMillis is greater than zero. The default setting for this parameter is 30 minutes. TimeBetweenEvictionRunsMils integer no How long the eviction thread should sleep before examining idle offscreen bitmaps. When non-positive, no eviction thread will be launched. The default setting for this parameter is -1 (i.e., by default, idle object eviction is disabled). Reload the Service Configuration using JMX Console Once you have modified a service configuration, you must reload the configuration in the repository using the JMX Console. The JMX console allows you to reload and administer a service, without having to restart the application container. To reload the service configuration: 1. Access the JMX Console using the following URL: http://localhost:8080/jmx-console/ 2. Under the Domain: Spatial section, select the administration link for the service. For example, Spatial:name=Administration,type=WMS Service. 3. Click the Invoke button for the reloadconfiguration operation. You will get a message on the status of the invocation. Creating a Named Tile Definition To create a named tile definition: 1. Use one of the following methods to create named resources for your MWS and add them to the repository. Spectrum Spatial Developer Guide 187

Map Tiling Management Console: See Adding a Named Map and Named Tables on page 174. MWS Upload Utility: See Upload a Workspace to the Repository. 2. Using a text editor or an XML editor, create a named tile definition that will display some or all of the named map that was created when you uploaded the MapInfo workspace. We have provided sample named tiles in the repository for some common maps. 3. Using a WebDAV tool of your choice, upload the named tile definition file to the repository. Note: This step must be performed on the machine that hosts the repository. Parameters for Named Tiles Named tiles are stored in the repository, and define how an individual hosted named map is used by the Map Tiling Service. For each map you want to expose through the Map Tiling Service you must have an equivalent named tile. In the named tile file, the NamedTile element contains the parameters that define the named tile, each of which contains some or all of the following list of child elements: Parameter Type Required DisplayName string yes The alias of the named map stored in the map repository. This alias can be different than the actual name of the named map, and will be used in the tiling service requests to call the named tile. string yes The metadata description of the named map. This information is presented to the user when a get call is sent to the Map Tiling Service. ResourceLocation string yes The directory and name of the actual named map in the repository, from the repository base. For example, if the named map is located at http://localhost:8080/repositoryservice/repository/ default/samples/namedmaps/world, then you would define the ResourceLocation as /NamedMaps/World. Note: You must specify the starting '/'. Projection string yes The coordinate system projection to host the named map. The Map Tiling Service will transform the named map into the projection defined. The projection is defined using the EPSG format. For best results, use epsg:3857 (Spherical Mercator). MinimumLevel integer yes The minimum zoom level to host the map. Must be greater than zero. See What Is Tile Level? for information to help define the level. MaximumLevel integer yes The maximum zoom level to host the map. Must be greater than zero. See What Is Tile Level? for information to help define the level. TileWidth integer yes Width of a tile in pixels. Must be greater than or equal to 16 and must be a number that can be calculated from a 2 n equation (for example 2 4 =16, 2 5 =32, 2 8 =256). Bounds string yes The bounds of the map. Coordinates are comma separated and in the coordinate system specified by the projection option. The bounds must represent a square in order for proper tile divsioning. 188 Spectrum Technology Platform 9.0

Chapter 11: How To's Parameter Type Required MimeList string no The available types of tiles generated by the tile server for this map only. ExpirationDate string no The date on which the client should delete the map tile from the cache, and request a new copy from the server. The ExpirationDate value must be specified as a W3C formatted date string. Note: The ExpirationDate parameter has effect only when using external caching software such as Squid or Apache. MapResolution integer no The resolution of the tile images in dots per inch (the number of individual dots that can be placed within the span of one linear inch). If not specified, the GlobalMapResolution is used. The minimum dpi you can define is 72. Less than 72 dpi, the service will throw an exception. MapRendering string no The rendering quality (anti-alias) of the tile images generated. You can specify either Speed or Quality. If a MapRendering preference is not specified, the global preference in the configuration will be used to determine the maps rendering quality. If neither is specified, the default rendering quality is Speed. RasterRendering string no The rendering quality (anti-alias) of the tile images generated from raster maps. You can specify either Speed or Quality. If a MapRendering preference is not specified, the global preference in the configuration will be used to determine the maps rendering quality. If neither is specified, the default rendering quality is Speed. RenderLabels boolean no Tells the service not to render LabelLayers when generating a tile. The value is case-insensitive. If a RenderLabels preference is not specified, the global preference in the configuration will be used. If neither is specified, the default is 'true'. PadFactor double no Used to prevent the clipping of labels when a label crosses a tile boundary. The PadFactor controls the amount of space is rendered around the requested tile with 0 meaning no padding, 1 meaning padding of 1 tile around the requested tile and so on. If a PadFactor preference is not specified, the global preference in the configuration will be used. If neither is specified, the default is 1.0. BackgroundOpacity double no The level of background opacity (transparency) for the tile images. The background opacity is defined on a scale from 0.0 (zero) to 1.0. Where 0.0 is completely transparent and 1.0 is completely opaque. For example a value of 0.75, would be 75 percent transparent. The following is an example of a named tile definition: <NamedTile> Spectrum Spatial Developer Guide 189

Map Tiling <DisplayName>World</DisplayName> <>Map Of The World</> <ResourceLocation>/NamedMaps/WorldMap</ResourceLocation> <Projection>epsg:3857</Projection> <MinimumLevel>1</MinimumLevel> <MaximumLevel>20</MaximumLevel> <TileWidth>256</TileWidth> <Bounds>-20037508.34,-20037508.34,20037508.34,20037508.34</Bounds> <MimeList> <Mime>image/png</Mime> <Mime>image/jpeg</Mime> <Mime>image/gif</Mime> </MimeList> <ExpirationDate>2019-12-31</ExpirationDate> <MapResolution>96</MapResolution> <MapRendering>Speed</MapRendering> <RenderLabels>false</RenderLabels> <PadFactor>1.0</PadFactor> </NamedTile> What Is Tile Level? The level, in combination with the tile width, tile height, and bounds of the named map, determines the zoom level of the tiles to be returned. The level shows how close the map image is to the Earth. Level 1 is the furthest away and is composed of one tile that the entire map will be drawn into. Level 2 is composed of 4 tiles, 2 across and 2 down. Each tile is a quarter of the entire map. Level 3 is composed of 16 tiles, 4 across and 4 down, and so on. The higher the level specified, the closer to the Earth the map image appears. For example, levels 1 to 3 usually show global or hemispheric detail, levels 4 to 15 show county/state/province level of detail and some larger cities, levels greater that 15 show street level views. What the levels actually display is dependent on the named map hosted by the Map Tile Service and the parameters in the named tile definition. For example, a level of 1 for a world map would be zoomed out to show the entire world. However, if you have a named map of a city or region where the bounds is less than the whole world, Level 1 would be zoomed in to show the regional or street level map. How Tile Height Is Calculated The tile height is calculated from the map bounds and the tile width to produce a tile that has the same aspect ratio as the bounds. The tile height is calculated using the following equation: tileheight = (boundsheight boundswidth) tilewidth There is one restriction when defining a map: the resultant tile height must be a whole number (integer). Since tile height and tile width are calculated in pixels, it is impossible for a user to display these values as fractions of a pixel. For example, a map with a bounds of (-180, -90, 180, 90) in WGS84 has an aspect ratio (width to height) of 2:1. So the tileheight calculation is half the tilewidth. If you defined the tilewidth parameter to be 256 then the tileheight would be 128. This is an acceptable tileheight value. However, if you have defined a map with the bounds of (-180, -90, 90, 0) in WGS84, that would create an aspect ratio of 3:1. Calculating the tileheight based on a tilewidth of 256 would result in a tileheight of 85.3333333. This is not an acceptable tileheight value, and will not be displayed by the Map Tiling Service. If a map hosted by the Map Tiling Service is configured with tilewidth and bounds parameter settings that result in an invalid tileheight calculation, then the map will not appear in the list of available maps returned by a call to the getmaps method in the Map Tiling Interface. StreetPro Named Tile Definition StreetPro data is well-suited to being used for map tiling in a web application. The layers provide a wealth of reference information for a map and the information doesn't change very often. 190 Spectrum Technology Platform 9.0

Chapter 11: How To's To use StreetPro in tiling, create a named tile definition that points to a StreetPro named map in the repository. If you are interested in creating a named tile based on a smaller geography than the entire world, you will need to define fewer levels. We recommend the beginning level of 7. However, the bounds of the map should stay at the world level for best results. Creating a StreetPro Named Tile Once you have uploaded your named map (and named tables, optionally), you then also have the option of creating a named tile using Management Console. You can render StreetPro data on a map with or without map tiles; however, tiling makes map rendering more efficient. To create a named tile for a StreetPro named map: 1. In Management Console, under Location Intelligence > Tools, select Named Tiles. 2. Click Add. Populate the fields with the following data: Spectrum Spatial Developer Guide 191

Map Tiling Name: (Required) Enter the name of the new named tile including the repository path and name for the named tile. You must prepend the name of the named tile with where in the repository the named tile is going to be created. For example, /StreetPro/NYStateTile. You cannot modify the name of an existing named tile. Changing the name of an existing resource would cause any services or jobs that reference the resource to fail. : (Optional) Add a metadata description of the named map. This information is presented to the user when a get call is sent to the Map Tiling Service. NamedMap: (Required) Enter the name of the named map to be used as the source of the name tile. Either enter the name of the named map including the repository path of the resource in the repository, or use the repository browser button and select the named map from the repository. Coordinate system: (Required) Keep the default coordinate system projection, epsg:3857. MinLevel: (Required) Enter the minimum zoom level to host the map; for StreetPro enter 7 as the optimal minimum level. Must be greater than zero. The level, in combination with the tile width, tile height, and bounds of the named map, determines the zoom level of the tiles to be returned. The level shows how close the map image is to the Earth. Level 1 is the furthest away and is composed of one tile that the entire map will be drawn into. Level 2 is composed of 4 tiles, 2 across and 2 down. Each tile is a quarter of the entire map. Level 3 is composed of 16 tiles, 4 across and 4 down, and so on. The higher the level specified, the closer to the Earth the map image appears. For example, levels 1 to 3 usually show global or hemispheric detail, levels 4 to 15 show county/state/province level of detail and some larger cities, levels greater that 15 show street level views. MaxLevel: (Required) Enter the maximum zoom level to host the map; for StreetPro, enter a maximum level of 18 or 19, depending on your specific needs. Width: (Required) Enter the width of the tiles in pixels: 256. Bounds: (Required) Enter the bounds of the map: -2.003750834E7,-2.003750834E7,2.003750834E7,2.003750834E7. Coordinates are comma separated and in the coordinate system specified by the Coordinate system field. 192 Spectrum Technology Platform 9.0

Chapter 11: How To's MimeTypes: (Optional) Enter the available image types of tiles generated by the tile server for the named map: png,jpeg,gif. This is a comma separated list of image mime types. ExpiryDate: (Optional) Enter the date on which the client should delete the tile from the cache, and request a new copy from the server: 2019-12-31. The ExpiryDate value must be specified in a W3C formatted date string as YYYY-MM-DD. Resolution: (Optional) Keep the default resolution of 96. MapRendering: (Optional) Keep the default option for Speed. RasterRendering: (Optional) Keep the default option for Speed. RenderLabels: (Optional) Select False so that labels will not be rendered on your tiles for label layers in this map. PadFactor: (Optional) Keep the default value of 1. The pad factor is used to prevent the clipping of labels when a label crosses a tile boundary. The PadFactor controls the amount of space is rendered around the requested tile with 0 meaning no padding, 1 meaning padding of 1 tile around the requested tile and so on. BackgroundOpacity: (Optional) Enter 0.5 for the level of background opacity (transparency) for the tile images. The background opacity is defined on a scale from 0.0 (zero) to 1.0. Where 0.0 is completely transparent and 1.0 is completely opaque. For example a value of 0.5, would be 50 percent transparent. 3. Click OK. The named tile is now available for use in the Map Tiling Service. As you render tiles in calls to the tile service, they are generated on the fly (if they do not already exist in the cache) and stored in the tile cache if it is configured to do so. Requesting a Map Tile Once the named tile definition is in the repository, you are ready to formulate and submit an XML request for the map tile. You do this using the Tile method in the Spectrum Technology Platform REST interface. In the REST Interface, all the parameters are included in the request For the tile method these include service, named map, tile level, column and row based on the level, and the output image format. 1. Create the Tile request following the example: http://localhost:8080/rest/spatial/maptilingservice/namedtiles/worldtile/2/1:1/tile.png 2. Copy the request into a browser and refresh the page. The tile displays. 3. To learn about all capabilities of the Map Tiling Service, go to http://[host:port]/spatialsamples/ and choose the JavaScript sample application. Click on the Map Tiling tab. 4. Choose any of the supported methods and study the responses in the map window and/or the response windows. Related Links Spectrum Spatial Guide: MapTiling Methods MapList and Generating Map Tiles The Tiling Generator is a command line utility that enables a user to execute batch runs to generate tiles. There are three options available when using this utility: Generate a file that contains the tile levels to be created. Use the file created above and create the tiles to seed the cache. Directly use the parameters to generate the tiles and seed the cache. No input file is needed for this option. Spectrum Spatial Developer Guide 193

Map Tiling Tiles need to be generated on the server. The Tile Generator requires the JAVA_HOME variable to be set to the location of the installed JDK. By running cache_builder.bat with no parameters or with the -help parameter, you will get more details about the options above. Generating Tiles from a Request File This procedure outlines how to create a tile request list and use it to generate tiles with Tile Generator. To generate tiles from a tile request list: 1. Extract the files from TileGeneratorUtility.zip to a location of your choice. 2. To generate a tile request file, in a command window, type cache_builder.bat followed by the required and optional parameters that meets your needs, as defined in the table. cache_builder.bat -url=http://localhost:8080/rest/spatial/maptilingservice -fileoutput=c:\spatialserver\tiling\maptilingrequests.txt -map=/namedtiles/worldtile -level="1,2-4" -mbr="-20000000, -20000000, 20000000, 20000000" -username=admin -password=admin Parameter -fileoutput <fileoutput> -level <level> -map <map> -mbr <mbr> -password <password> -url <url> -username <username> Required yes yes yes no yes yes yes Path and name of the file the tile requests will be saved to. Level(s) for which to generate tiles (e.g., comma separated 1,2,6 or range 1-10). Named tile in the repository used to create tile(s) ( e.g., /NamedTiles/WorldTile). Minimum Bounding Rectangle (MBR) to be used to generate tiles. Password to access the repository. URL to the MapTiling Service. User to access the repository. 3. To generate the tiles using the output file from step 2, in the command window, type cache_builder.bat followed by the parameters as defined in the table below. cache_builder.bat -url=http://localhost:8080/rest/spatial/maptilingservice -fileinput=c:\spatialserver\tiling\maptilingrequests.txt -image=png -threads=1 -diroutput=c:\spatialserver\tiling\output -username=admin -password=admin Parameter -diroutput <diroutput> -fileinput <fileinput> -image <image> -password <password> -threads <threads> -url <url> Required yes yes yes yes no yes Path to the directory the generated tiles will be saved to. Path and name of the request file to generate the tiles. Image type of tiles (e.g., png). Password to access the repository. Number of threads to use to generate the tiles. Specifies the URL to the MapTiling Service. 194 Spectrum Technology Platform 9.0

Chapter 11: How To's Parameter -username <username> -cache <cache> Required yes no User to access the repository. When set to false, sets the HTTP cache-control header to no-cache when doing a tile request. This tells the proxy server to go back to the originating server for the tile. The proxy server will replace what s in its cache with the new tile. Generating Tiles Without a Request File This process generates tiles directly by specifying all parameters in the command. No input file is needed. To generate tiles: 1. Extract the files from TileGeneratorUtility.zip to a location of your choice. 2. In the command window, type cache_builder.bat followed by the parameters as defined in the table below. cache_builder.bat -url=http://localhost:8080/rest/spatial/maptilingservice -image=png -level="1,2-4" -threads=1 -map=/namedtiles/worldtile -mbr="-20000000, -20000000, 20000000, 20000000" -diroutput=c:\spatialserver\tiling\output -username=admin -password=admin Parameter -diroutput <diroutput> -image <image> -level <level> -map <map> -mbr <mbr> -password <password> -threads <threads> -url <url> -username <username> -cache <cache> Required yes yes yes yes no yes no yes yes no Path to the directory the generated tiles will be saved to. Image type of tiles (e.g., png). Level(s) to generate tiles for(e.g., comma separated 1,2,6 or range 1-10). Named tile resource used to create tile(s) in the repository( e.g., /NamedTiles/WorldTile). Minimum Bounding Rectangle(MBR) to be used to generate tiles. Password to access the repository. Number of threads to use to generate the tiles. Specifies the URL to the MapTiling Service. User to access the repository. When set to false, sets the HTTP cache-control header to no-cache when doing a tile request. This tells the proxy server to go back to the originating server for the tile. The proxy server will replace what s in its cache with the new tile. Using Tile Caching A built-in pluggable tile caching mechanism is provided with the Map Tiling Service. This allows you to pre-generate tiles, and use these tiles as a cache source for your application. You can also use the tile cache for holding on-the-fly rendered tiles for more efficient map navigation. Spectrum Spatial Developer Guide 195

Map Tiling Tiles can be pre-generated using the Tile Generator utility. Install the Tile Generator Utility by extracting the files from <installdir>\spectrum\server\app\exports. Caching is used to enhance performance and minimize redundant rendering of frequently rendered map tiles. As an alternative to the service's built-in caching mechanism, you can use external caching software such as Squid. However, in order to use external caching software, you must have the service's built-in caching mechanism turned off. Creating a Tile Cache To set up a tile cache for pre-rendered or on-the-fly tiles: 1. Download and install an instance of the Apache HTTP Server that will act as the front end to your Spectrum Technology Platform installation. Note: The Apache web server must be installed on a machine that has network access to the one that hosts Spectrum Technology Platform. The front-end Apache server will act as a sort of filter, intercepting NamedTile requests so that the requested map tiles can be cached to disk. 2. Modify the Apache server's configuration file: apache_install_dir/conf/httpd.conf. a) Open httpd.conf in a text editor. b) In httpd.conf, find this line... Listen 80...and immediately below it, add this line... Listen 90 c) At the end of the file, add this line... Include conf/tilecaching.conf d) Save the changes you have made to httpd.conf, and close the file. 3. In the apache_install_dir/conf directory, create a new file named tilecaching.conf. a) Open tilecaching.conf in a text editor, and add the following lines: Note: Placeholder values are shown in bold italics. Replace them with the actual values for your system. LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so LoadModule headers_module modules/mod_headers.so <Directory "c:/maptilecache_dirname"> AllowOverride None Order allow,deny Allow from all </Directory> NameVirtualHost *:90 NameVirtualHost *:80 ProxyRequests off ProxyPreserveHost On <Proxy *> Order allow,deny Allow from all </Proxy> <VirtualHost *:80> 196 Spectrum Technology Platform 9.0

Chapter 11: How To's ServerName spatialserver <Location /rest/enterprisemapping/maptilingservice/namedtiles/> RequestHeader unset Authorization </Location> ProxyPass /rest/enterprisemapping/maptilingservice/namedtiles/ http://spatialserver:90/rest/enterprisemapping/maptilingservice/namedtiles/ ProxyPassReverse /rest/enterprisemapping/maptilingservice/namedtiles/ http://spatialserver:90/rest/enterprisemapping/maptilingservice/namedtiles/ ProxyPass / http://spatialserver:8080/ ProxyPassReverse / http://spatialserver:8080/ </VirtualHost> <VirtualHost *:90> ServerName spatialserver ProxyPass / http://spatialserver:8080/ ProxyPassReverse / http://spatialserver:8080/ <Location /rest/enterprisemapping/maptilingservice/namedtiles/> Header merge cache-control "public" RequestHeader set Authorization "Basic YWRtaW46YWRtaW4=" </Location> LoadModule cache_module modules/mod_cache.so LoadModule disk_cache_module modules/mod_disk_cache.so CacheRoot c:/maptilecache_dirname CacheEnable disk /rest/enterprisemapping/maptilingservice/namedtiles/ CacheIgnoreHeaders None </VirtualHost> b) Save the changes you have made to tilecaching.conf, and close the file. 4. Create the directory that will hold the cached map tiles. Give the directory a name that will make its purpose clear, such as maptilecache. Be sure to specify the name correctly in the tilecaching.conf configuration file. 5. Restart the Apache web server. Enabling Pluggable Tile Caching To enable the pluggable tile cache in the Map Tiling Service: 1. Use a standard WebDAV protocol tool to access the repository (e.g., Windows WebFolders, DAVExplorer, etc.) and copy the configuration file from the repository to a directory on your local machine. The Map Tiling Service configuration file is located at http://localhost:8080/repositoryservice/repository/default/configuration/maptilingconfiguration. 2. Open the local MapTilingConfiguration file in any text editor. 3. In the Cache section, set enabled to true. <Cache enabled="true"> 4. Set the diskpath property to the location where your tiles are stored. Spectrum Spatial Developer Guide 197

Map Tiling Since this location not only stores your pregenerated tiles, but also stores tiles that are generated by the tiling service, this directory must be writable by the user account that launches the Spectrum Technology Platform. <Property name="diskpath" value="c:/program Files/Pitney Bowes/Spectrum/server/modules/spatial/TileCache"/> 5. Optionally modify the tilepathpattern property to define how tiles are stored in the diskpath directory structure. The file structure in the cache is define by the three properties :diskpath/tilepathpattern/tilenamepattern. You can use the key words (mapname, level, row, column, mimetype) to set the path format. <Property name="tilepathpattern" value="mapname/level/row"/> 6. Optionally modify the tilenamepattern property to define how tiles are named in the diskpath directory structure. The file structure in the cache is define by the three properties :diskpath/tilepathpattern/tilenamepattern. You can use the following three tilenamepattern values (row.mimetype, column.mimetype, row-column.mimetype) to set the name format. <Property name="tilenamepattern" value="column.mimetype"/> 7. Upload the modified configuration file back to the same location (and name) in the repository using your WebDAV tool. 8. Use the Spectrum Technology Platform JMX Console to invoke the new configuration for the service. For instruction on how to reload the configuration using the JMX Console, see Reload the Service Configuration using JMX Console on page 187. The pluggable tile cache is now enabled. You can now use your pre-generated tiles at the location you specified. Creating Your Own Tile Caching Mechanism Depending on your organization's requirements, you may need to create your own custom tile caching mechanism. For example, the built-in tile caching mechanism included with the Location Intelligence Module caches tiles on the file system. If instead you want to cache your tiles in a database, you will need to create your own custom tile caching mechanism. To create your own tile caching mechanism, use the following steps: 1. Create a Java class that implements the following interface: com.mapinfo.midev.service.maptiling.cache.itilecache Note: Your implementing class must contain a default (no arguments) constructor. The ITileCache interface class is packaged in this JAR file: Spectrum_install_dir/server/modules/spatial/lib/midev-service-maptiling-1.3.0.jar For information about each of the ITileCache methods you will need to implement, see the ITileCache Javadoc file located here: Spectrum_install_dir/server/modules/spatial/javadoc 2. Package your implementing class into a JAR file, and place a copy of the JAR file in this directory: Spectrum_install_dir/server/modules/spatial/lib 198 Spectrum Technology Platform 9.0

Chapter 11: How To's 3. Register your implementing class in the java.properties file by setting its full name as the value for the maptiling.tilecache.class key. The java.properties file is located in the Spectrum_install_dir/server/modules/spatial directory. 4. Pull the named configuration file for the Map Tiling Service (MapTilingConfiguration.xml) out of the repository using your favorite WebDAV tool. The default location of the MapTilingConfiguration.xml file in the repository is: http://localhost:8080/repositoryservice/repository/default/configuration 5. Using a text editor, add any initialization settings for the cache to the MapTilingConfiguration.xml named configuration file. Each initialization setting is added to a <Property> element that is a child of the <Cache> element in the configuration file. Each <Property> element has a name attribute and a value attribute which hold the name and value of the initialization setting. 6. Re-add the named configuration file back into the repository using your favorite WebDAV tool. 7. Do one of the following to reload the Map Tiling Service configuration: Restart the web service. Use the Spectrum Technology Platform JMX Console (available at http://hostname[:portnumber]/jmx-console) to reload the configuration without restarting the web service. The Map Tiling Service will now use your custom tile caching mechanism to cache the map tiles. Web Service Authentication Spectrum Technology Platform web services can be configured to allow access only to authenticated users. When developing a client application that will access such a web service, you must add program code that will pass the user's credentials to the web service. Using Basic Authentication Basic authentication is one of the authentication methods a client application can use to pass a user's credentials to a Spectrum Technology Platform web service. When basic authentication is used, a username and password are concatenated, with a colon separating the two values. The resulting string is then Base64 encoded and transmitted in the HTTP header of the web service request. Using Basic Authentication to Access SOAP Services To use basic authentication to access a SOAP service, your client application must add the username and password to an instance of the service interface. Just before the request is submitted to the SOAP service, the username and password set in the service interface are Base64 encoded and inserted into the HTTP Authorization request header. Java Example The following program listing (Preference.java) shows an example of a Java class that adds the username and password to the service interface: package com.pbbi.midev.feature.feature.utility; import java.net.url; Spectrum Spatial Developer Guide 199

Web Service Authentication import javax.xml.namespace.qname; import javax.xml.ws.bindingprovider; import com.mapinfo.midev.service.feature.ws.v1.featureservice; import com.mapinfo.midev.service.feature.ws.v1.featureserviceinterface; public class Preference { public final static String NAMESPACE = "http://www.mapinfo.com/midev/service/feature/ws/v1"; public final static String SERVICENAME = "FeatureService"; public final static String DEFAULT_SERVICENAME = "http://localhost:8080/soap/featureservice?wsdl"; public final static String USERNAME = "admin"; public final static String PASSWORD = "admin"; public static FeatureServiceInterface getserviceinterface() throws Exception { FeatureService service; FeatureServiceInterface serviceinterface; service = new FeatureService(new URL(DEFAULT_SERVICENAME), new QName(NAMESPACE, SERVICENAME)); serviceinterface = service.getfeatureserviceinterface(); Preference.setUserCredentials(serviceInterface, USERNAME, PASSWORD); return serviceinterface; public static void setusercredentials(featureserviceinterface serviceinterface, String username, String pasword) { BindingProvider provider = (BindingProvider)serviceInterface; provider.getrequestcontext().put(bindingprovider.username_property, username); provider.getrequestcontext().put(bindingprovider.password_property, pasword); C# Example The following program listing (Preference.cs) shows an example of a C# class that adds the username and password to the service interface: using System; using System.Collections.Generic; using System.Linq; using System.Text; using FeatureSamples.FeatureService; using System.ServiceModel; namespace FeatureSamples { class Preference { public static String ENDPOINT_CONFIG_NAME = "FeatureServiceInterface"; public static String DEFAULT_SERVICE_URL = "http://localhost:8080/soap/featureservice"; // This is used to create an client interface to the Feature service. public static FeatureServiceInterfaceClient getserviceinterface() { // create the client to communicate to the service. 200 Spectrum Technology Platform 9.0

Chapter 11: How To's // can also use the empty client constructor as below // FeatureServiceInterfaceClient client = new FeatureServiceInterfaceClient(); // In this case, the default value for the 2 parameters are set in the app.config file. // app.config is a configuration file generated when the Visual Studio imports a service WSDL. // the remote address will be default to the service URL entered for the WSDL. // FeatureServiceInterfaceClient client = new FeatureServiceInterfaceClient(ENDPOINT_CONFIG_NAME, DEFAULT_SERVICE_URL); // Create client with Basic authentication BasicHttpBinding binding = new BasicHttpBinding(); binding.sendtimeout = TimeSpan.FromSeconds(25); binding.security.mode = System.ServiceModel.BasicHttpSecurityMode.TransportCredentialOnly; binding.security.transport.clientcredentialtype = System.ServiceModel.HttpClientCredentialType.Basic; EndpointAddress address = new EndpointAddress(DEFAULT_SERVICE_URL); FeatureServiceInterfaceClient client = new FeatureServiceInterfaceClient(binding, address); // set username and password client.clientcredentials.username.username = "guest"; client.clientcredentials.username.password = ""; return client; Using Basic Authentication to Access REST Services To use basic authentication to access a REST service, your client application must add the Base64-encoded username and password to the HTTP Authorization request header, using a standard library method corresponding to your client application language. Java Example The following program listing shows an example of a Java class that adds the Base64-encoded username and password to the HTTP Authorization request header: import java.io.bufferedreader; import java.io.inputstreamreader; import java.net.url; import java.net.httpurlconnection; import java.net.authenticator; import java.net.passwordauthentication; public class RestAuth { public static void main(string[] args) { Authenticator.setDefault(new Authenticator() { protected PasswordAuthentication getpasswordauthentication() { return new PasswordAuthentication("admin", "admin".tochararray()); ); Spectrum Spatial Developer Guide 201

Web Service Authentication try { URL url = new URL("http://localhost:8080/rest/Spatial/FeatureService/tables.json"); HttpURLConnection connection = (HttpURLConnection)url.openConnection(); connection.setrequestmethod("get"); connection.setdoinput(true); connection.setdooutput(true); BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); String inputline; while((inputline = reader.readline())!= null) System.out.println(inputLine); reader.close(); catch(exception e) { e.printstacktrace(); C# Example The following program listing shows an example of a C# class that adds the Base64-encoded username and password to the HTTP Authorization request header: using System; using System.IO; using System.Net; using System.Text; namespace RestAuthSample { public class RestAuth { public static string SERVICE_URL = "http://localhost:8080/rest/spatial/featureservice"; public static string SERVICE_METHOD = "tables.json"; public static string RESPONSE_FILE = "C:\\tableslist.json"; public static void Main() { try { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(SERVICE_URL + "/" + SERVICE_METHOD); string authinfo = "admin:admin"; // username:password authinfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo)); request.method = "GET"; request.headers["authorization"] = "Basic " + authinfo; WebResponse response = request.getresponse(); Stream responsestream = response.getresponsestream(); StreamReader reader = new StreamReader(responseStream); if (reader.endofstream!= true) { StreamWriter writer = new StreamWriter(RESPONSE_FILE); writer.write(reader.readtoend()); 202 Spectrum Technology Platform 9.0

Chapter 11: How To's writer.close(); reader.close(); responsestream.close(); response.close(); catch(exception e) { Console.WriteLine(e.ToString()); WMS Configuration The WMS server support within Spectrum Technology Platform allows you to expose map images of your data to any conforming WMS client. Through configuration you decide what layers are exposed and how they might be presented to a WMS user. These configuration items reuse the named tables and named layers which are best practices for using data in any facet of Spectrum Technology Platform. Related Links Spectrum Spatial Guide Step 1: Create Named Tables The first step is to create a named table for each data table to ensure that the data is accessible to the Spectrum Technology Platform server. For examples of named tables for all supported table types, see the Resources and Data section in the Spectrum Technology Platform Spectrum Spatial Guide on support.pb.com. There are three tools that create named tables. Choose the most appropriate for your needs. To create a named table: 1. Choose one of the following methods: Using the Named Tables tool in Management Console, click the Add button to create a named table for each table you want to expose through WMS. Choose this option if you have a few tables, and especially if they are not native TAB files. Management Console provides options for different table types. Using the MWS Upload utility, upload an.mws. The tool processes the.mws to create named tables and adds them to the repository. Choose this option if you have many native tables and need to present a map to users. Using WebDAV technology, create a new file or edit an existing named table from the repository and save as a new XML file. Add the named table to the repository if edited outside the repository. This choice is for the advanced user who understands the named table schemas and wants to create named tables that are similar to others they have. 2. Verify that the named tables have been uploaded to the repository by going to http://localhost:8080/repositoryservice/repository/default/. 3. Verify that each named table you create is accessible to Spectrum Technology Platform by going to the Feature Service demo page and choosing DescribeTable. http://[host:port]/spatial/featureservice/demopage.html Spectrum Spatial Developer Guide 203

WMS Configuration If the named table is built correctly, the Feature Service will return a response that describes the table. Step 2: Create Named Layer WMS uses named layers as the basis for the information to render as a WMS map image. Ultimately, you must create a WMSLayer and add it to the WMS Configuration file, but creating the named layer comes first. For examples of named layers, see the Resource and Data section in the Spectrum Technology Platform Spectrum Spatial Guide on support.pb.com. To create a named layer: 1. Using WebFolders or DAVExplorer to access named resources in the repository, open the sample named layer LayerWithTable in an editor. Save the file with a new name. Contents of the LayerWithTable named layer before editing. The bold sections are what you will edit. <?xml version="1.0" encoding="utf-8"?> <NamedLayer version ="MXP_WorkSpace_1_5" xmlns="http://www.mapinfo.com/mxp"> <ConnectionSet /> <DataSourceDefinitionSet> <NamedDataSourceDefinitionRef id="id1" resourceid="/namedtables/usa"/> </DataSourceDefinitionSet> <FeatureLayer id="id9" name="usa" alias="usa" volatile="unknown"> <Visibility visible="true"> <VisibleRange enabled="false"> <ZoomRange uom="mapinfo:length mi">0 0</ZoomRange> </VisibleRange> </Visibility> <DataSourceRef ref="id1" /> </FeatureLayer> </NamedLayer> 2. Change the resourceid to your named table. 3. Create a unique name and alias for the layer. It is important that these elements are unique. If two layers with the same alias are rendered in the same map, only one of the layers will be drawn. 4. If your named layer is a simple layer with default styles, you can skip to step 6. 5. If your layer is more complex, such as it contains a theme or label layer, copy the layer section from the existing MWS and paste it into the new named layer replacing the <FeatureLayer> section. Your layer can be a FeatureLayer, LabelLayer, ObjectThemeLayer or a LayerGroup. Example of a feature layer with a style override (FeatureStyleOverrideTheme). <FeatureLayer id="id49" name="usa" alias="usa" volatile="unknown"> <Visibility visible="true"> <VisibleRange enabled="false"> <ZoomRange uom="mapinfo:length mi" mininclusive="true" maxinclusive="true">0.000000 3300.000000</ZoomRange> </VisibleRange> </Visibility> <DataSourceRef ref="id1"/> <FeatureStyleModifierThemeList> <FeatureStyleOverrideTheme id="id50" name="style Override" alias="style Override id50"> <CompositeStyle> <LineStyle stroke="rgb(0,0,0)" stroke-opacity="1" width="1" width-unit="mapinfo:imagesize pixel"> <Pen>mapinfo:pen 2</Pen> </LineStyle> <AreaStyle> <LineStyle stroke="rgb(0,0,0)" stroke-opacity="1" width="1" 204 Spectrum Technology Platform 9.0

Chapter 11: How To's width-unit="mapinfo:imagesize pixel"> <Pen>mapinfo:pen 2</Pen> </LineStyle> <Interior fill-opacity="1" fill="rgb(255,244,208)"/> </AreaStyle> <PointStyle> <FontSymbol text="#" size="12" size-unit="mapinfo:length pt" stroke="rgb(0,0,0)" stroke-opacity="1" family="mapinfo 3.0 Compatible"/> </PointStyle> <MapinfoTextObjectStyle> <FontStyle size="9" size-unit="mapinfo:length pt" stroke="rgb(0,0,0)" stroke-opacity="1" family="arial" font-style="normal" effect="rgb(255,255,255)" effect-opacity="1" effect-type="none" font-weight="normal" text-decoration="none" text-case="default" shadow="false" expand="false"/> </MapinfoTextObjectStyle> </CompositeStyle> </FeatureStyleOverrideTheme> </FeatureStyleModifierThemeList> </FeatureLayer> 6. Save the named layer to the repository. 7. Repeat from Step 1 for each named layer you wish to create. 8. To verify that the named layer(s) were created correctly, go to the Mapping Service demo page and choose Render Map 1 from the drop-down list. a) Replace the named layer in the v:1 layer with your named layer. <v1:layer xsi:type="v1:namedlayer" name="/namedlayers/layerwithtable" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"/> b) Click Submit. If you see your named layer in the map window, you created the named layer correctly. You may need to change the map request to use the center and zoom width appropriate for your data. Related Links Map Definition Section on page 252 Step 3: Add Layers to WMS Configuration The layers to be exposed in WMS are specified in the WMS Configuration as WMSLayer elements. Each WMSLayer to be rendered references a named layer in the repository. You must add a WMSLayer entry for each layer you want to present on your WMS server. WMSLayers are a flat list of entries under the WMSLayerList element. In addition to the layers of data to be exposed, WMS supports the creation of non-renderable layers that exist for purpose of organization. In the WMS configuration file, you need to create WMSLayer entries for the actual data layers and the layers that are just for organization. In the case of the actual layers, you will provide detailed information about how to expose that layer by following the steps below. In the case of pure organizational layers, the WMSLayer entry only requires a Title representing the user friendly name. To add layers to WMS Configuration. 1. Using WebFolders or DAVExplorer open the WMSConfiguration in an editor. 2. Under the <WMSLayerList> add a WMSLayer entry for each layer. Provide the information following Example: WMSLayer Definition on page 206. For an explanation of the parameters, see Parameters: WMSLayer on page 206. 3. Optionally, if you wish to create a hierarchy for your layers, first create a WMSLayer for the top level layer, but omit the name element. This layer will not render in a WMS GetMap request. Spectrum Spatial Developer Guide 205

WMS Configuration The actually hierarchy is created in the WMSConfiguration under the WMSLayerTree section in the next step. Example: WMSLayer Definition Example of a WMSLayer: <WMSLayer> <Name>World</Name> <Title>World</Title> <Abstract>The entire world base map</abstract> <KeywordList> <Keyword>World</Keyword> </KeywordList> <Queryable>true</Queryable> <SRSList> <SRS>EPSG:4326</SRS> </SRSList> <NamedResourceList> <ResourcePath>/NamedLayers/LayerWithTable</ResourcePath> </NamedResourceList> <NamedStyleList> <NamedStyle> <Name>PointStylePin</Name> <Title>PointStylePin</Title> <ResourcePath>/NamedStyles/PointStylePin</ResourcePath> </NamedStyle> <NamedStyleList> <LatLonBoundingBox>-180, -90, 180, 90</LatLonBoundingBox> <DefaultPixelSearchRadius>5</DefaultPixelSearchRadius> </WMSLayer> Parameters: WMSLayer Parameter Name Title Abstract Queryable KeywordList SRSList NamedResourceList NamedStyleList Required Yes, if layer is to be rendered Yes No No No No Yes No The name of your Layer. This is the machine readable name of your named layer. If the layer is only listed for organizational purposes, no name is needed. It will get the name of the layer from the Title parameter. Human-readable name for your layer. Descriptive introduction to your layer. Edit the Abstract to describe what type of features or content the layer provides. Boolean that indicates whether the server supports the GetFeatureInfo operation on that Layer. Default is true. Only renderable layers can be queryable. Contains <Keyword> elements to aid in catalog searches. List of the Spatial Reference Systems used by the layer. Every renderable layer needs at least one coordinate system either explicitly listed or inherited from a parent. The absolute path of the named layer within the repository root. All ResourcePaths must start with a slash (/) character. List of available styles for this layer. Any number of styles may be defined for a Layer. Each style must have a Name, Title, 206 Spectrum Technology Platform 9.0

Chapter 11: How To's Parameter LatLonBoundingBox DistanceBuffer DefaultPixelRadiusSearch Required No No No and ResourcePath element. The ResourcePath is the absolute path of the NamedStyle within the repository root. All ResourcePaths must start with a slash (/) character. Describes the bounding box for the Layer. Deprecated. The distance buffer within which a GetFeatureInfo operation will search all features for information. The default value is 300 meters. Use instead of DistanceBuffer. The distance in pixels within which a GetFeatureInfo operation will search all features in the layer. This can also be set at the Service level and/or in a request using the parameter PIXELSEARCHRADIUS. If specified in both the layer and service levels, the layer level value will override the service level value. If specified in the request, it overrides both the layer and service level values. If not specified at either the service or layer level or in the request, the default value is 3 pixels. Step 4: Create Layer Tree in WMS Configuration Now that you have created all the WMSLayers that represent your WMS offering, you now need to describe how those layers will be organized hierarchically. In the WMSLayerTree section, you will create this hierarchy as nested XML elements where the title of each element must match the title of a WMSLayer element. To create a layer tree in the WMS Configuration. 1. Add a WMSLayerTree entry for each WMSLayer you created in Step 3: Add Layers to WMS Configuration on page 205. Insert a WMSLayerTree element underneath an existing WMSLayerTree element. This would be the root element or a sub element. It cannot be added parallel to the root element. 2. Save the WMS Configuration file and reload it so your changes take effect. To reload the edited WMS Configuration, use the Spectrum Technology Platform JMX Console (available at http://hostname[:portnumber]/jmx-console). Choose WMS Service under Domain:Spatial and click Invoke. Example: WMSLayer Definition Example of a list of WMSLayerTree layers. The bold entries are non-rendering organizational layers. <WMSLayerTree> <Title>Pitney Bowes Map Server</Title> <WMSLayerTree> <Title>World Map</Title> </WMSLayerTree> <WMSLayerTree> <Title>World Capitals</Title> </WMSLayerTree> <WMSLayerTree> <Title>Mexico</Title> <WMSLayerTree> <Title>Mexico Range Theme</Title> </WMSLayerTree> <WMSLayerTree> <Title>Mexico Label Layer</Title> Spectrum Spatial Developer Guide 207

WMS Configuration </WMSLayerTree> </WMSLayerTree> </WMSLayerTree> Step 5: Test the WMS Configuration Once the named layers are created and the information added to the WMS Configuration, check to make sure that your WMS layers are exposed through the WMS service properly and that they follow your intended layout. To test the capabilities: 1. Enter into a web browser: http://[host:port]/rest/spatial/wms?request=getcapabilities&service=wms 2. Check the XML returned. Example: WMS GetCapabilities Response Example of a response from a WMS GetCapabilities request. <WMS_Capabilities version="1.3.0" xsi:schemalocation="http://www.opengis.net/wms http://schemas.opengis.net/wms/1.3.0/capabilities_1_3_0.xsd"> <Service> <Name>WMS</Name> <Title>Spatial Server WMS Service</Title> <Abstract>The Spatial Server WMS Service!</Abstract> <KeywordList> <Keyword>mapinfo</Keyword> <Keyword>geographic</Keyword> <Keyword>wms</Keyword> </KeywordList> <OnlineResource ns2:type="simple" ns2:href="http://localhost:8080/rest/spatial/wms?"/> <ContactInformation> <ContactPersonPrimary/> <ContactAddress/> </ContactInformation> <Fees>NONE</Fees> <AccessConstraints>NONE</AccessConstraints> </Service> <Capability> <Request> <GetCapabilities> <Format>application/vnd.ogc.wms_xml</Format> <Format>text/xml</Format> <DCPType> <HTTP> <Get> <OnlineResource ns2:type="simple" ns2:href="http://localhost:8080/rest/spatial/wms?"/> </Get> </HTTP> </DCPType> </GetCapabilities> <GetMap> <Format>image/gif</Format> <Format>image/jpeg</Format> <Format>image/jpg</Format> <Format>image/png</Format> <Format>image/tiff</Format> <DCPType> <HTTP> <Get> <OnlineResource ns2:type="simple" 208 Spectrum Technology Platform 9.0

Chapter 11: How To's ns2:href="http://localhost:8080/rest/spatial/wms?"/> </Get> </HTTP> </DCPType> </GetMap> <GetFeatureInfo> <Format>text/xml</Format> <DCPType> <HTTP> <Get> <OnlineResource ns2:type="simple" ns2:href="http://localhost:8080/rest/spatial/wms?"/> </Get> </HTTP> </DCPType> </GetFeatureInfo> </Request> <Exception> <Format>INIMAGE</Format> <Format>BLANK</Format> <Format>XML</Format> </Exception> <Layer queryable="false" opaque="false" nosubsets="false" fixedwidth="0" fixedheight="0"> <Title>Pitney Bowes Map Server</Title> <CRS>CRS:84</CRS> <EX_GeographicBoundingBox> <westboundlongitude>-180.0</westboundlongitude> <eastboundlongitude>180.0</eastboundlongitude> <southboundlatitude>-90.0</southboundlatitude> <northboundlatitude>90.0</northboundlatitude> </EX_GeographicBoundingBox> <BoundingBox CRS="CRS:84" minx="-180.0" miny="-90.0" maxx="180.0" maxy="90.0"/> <Style> <Name>PointStyle</Name> <Title>PointStyle</Title> <Abstract/> </Style> <Style> <Name>LineStyle</Name> <Title>LineStyle</Title> <Abstract/> </Style> <Layer queryable="true" opaque="false" nosubsets="false" fixedwidth="0" fixedheight="0"> <Name>World</Name> <Title>World Map</Title> <CRS>CRS:84</CRS> <EX_GeographicBoundingBox> <westboundlongitude>-180.0</westboundlongitude> <eastboundlongitude>180.0</eastboundlongitude> <southboundlatitude>-90.0</southboundlatitude> <northboundlatitude>90.0</northboundlatitude> </EX_GeographicBoundingBox> <BoundingBox CRS="CRS:84" minx="-180.0" miny="-90.0" maxx="180.0" maxy="90.0"/> <Style> <Name>AreaStyle</Name> <Title>AreaStyle</Title> <Abstract>Default area style.</abstract> </Style> <Style> <Name>AreaStyleBlue</Name> <Title>AreaStyleBlue</Title> <Abstract>Blue area style.</abstract> </Style> <Style> <Name>AreaStyleGreen</Name> <Title>AreaStyleGreen</Title> <Abstract>Green area style.</abstract> Spectrum Spatial Developer Guide 209

WMS Configuration </Style> <Style> <Name>AreaStyleRed</Name> <Title>AreaStyleRed</Title> <Abstract>Red area style.</abstract> </Style> <Style> <Name>CompositeStyle</Name> <Title>CompositeStyle</Title> <Abstract>Composite style.</abstract> </Style> <Style> <Name>LineStyleDash</Name> <Title>LineStyleDash</Title> <Abstract>Dashed line style.</abstract> </Style> <Style> <Name>LineStyleSolid</Name> <Title>LineStyleSolid</Title> <Abstract>Solid line style.</abstract> </Style> <Style> <Name>PointStylePin</Name> <Title>PointStylePin</Title> <Abstract>Pin point style.</abstract> </Style> <Style> <Name>PointStyleStar</Name> <Title>PointStyleStar</Title> <Abstract>Star point style.</abstract> </Style> </Layer> <Layer queryable="true" opaque="false" nosubsets="false" fixedwidth="0" fixedheight="0"> <Name>WorldCap</Name> <Title>World Capitals</Title> <CRS>CRS:84</CRS> <EX_GeographicBoundingBox> <westboundlongitude>-223.82</westboundlongitude> <eastboundlongitude>229.58</eastboundlongitude> <southboundlatitude>-51.7</southboundlatitude> <northboundlatitude>64.24</northboundlatitude> </EX_GeographicBoundingBox> <BoundingBox CRS="CRS:84" minx="-223.82" miny="-51.7" maxx="229.58" maxy="64.24"/> </Layer> <Layer queryable="true" opaque="false" nosubsets="false" fixedwidth="0" fixedheight="0"> <Name>UKREGNS</Name> <Title>UK Regions</Title> <EX_GeographicBoundingBox> <westboundlongitude>-9.313035522251392</westboundlongitude> <eastboundlongitude>2.6728925542959603</eastboundlongitude> <southboundlatitude>49.85775126079786</southboundlatitude> <northboundlatitude>60.83825324988055</northboundlatitude> </EX_GeographicBoundingBox> <BoundingBox CRS="CRS:84" minx="-9.313035522251392" miny="49.85775126079786" maxx="2.6728925542959603" maxy="60.83825324988055"/> </Layer> <Layer queryable="false" opaque="false" nosubsets="false" fixedwidth="0" fixedheight="0"> <Title>Mexico</Title> <CRS>EPSG:3857</CRS> <EX_GeographicBoundingBox> <westboundlongitude>-180.0</westboundlongitude> <eastboundlongitude>180.0</eastboundlongitude> <southboundlatitude>-90.0</southboundlatitude> <northboundlatitude>90.0</northboundlatitude> </EX_GeographicBoundingBox> <BoundingBox CRS="CRS:84" minx="-180.0" miny="-90.0" maxx="180.0" 210 Spectrum Technology Platform 9.0

Chapter 11: How To's maxy="90.0"/> <Layer queryable="true" opaque="false" nosubsets="false" fixedwidth="0" fixedheight="0"> <Name>MexicoRangeTheme</Name> <Title>Mexico Range Theme</Title> <EX_GeographicBoundingBox> <westboundlongitude>-117.12549190281374</westboundlongitude> <eastboundlongitude>-86.74336825802507</eastboundlongitude> <southboundlatitude>14.537774865811338</southboundlatitude> <northboundlatitude>32.71862158128273</northboundlatitude> </EX_GeographicBoundingBox> <BoundingBox CRS="CRS:84" minx="-117.12549190281374" miny="14.537774865811338" maxx="-86.74336825802507" maxy="32.71862158128273"/> <Style> <Name>Green</Name> <Title>Green</Title> <Abstract/> </Style> <Style> <Name>Blue</Name> <Title>Blue</Title> <Abstract/> </Style> </Layer> <Layer queryable="true" opaque="false" nosubsets="false" fixedwidth="0" fixedheight="0"> <Name>MexicoLabels</Name> <Title>Mexico Label Layer</Title> <EX_GeographicBoundingBox> <westboundlongitude>-117.12549190281374</westboundlongitude> <eastboundlongitude>-86.74336825802507</eastboundlongitude> <southboundlatitude>14.537774865811338</southboundlatitude> <northboundlatitude>32.71862158128273</northboundlatitude> </EX_GeographicBoundingBox> <BoundingBox CRS="CRS:84" minx="-117.12549190281374" miny="14.537774865811338" maxx="-86.74336825802507" maxy="32.71862158128273"/> </Layer> </Layer> </Layer> </Capability> </WMS_Capabilities> Custom Symbols In MapInfo Professional you can create maps that contain your own custom symbols. If you want to use these maps in Spectrum Technology Platform, you must first save them as MapInfo Professional workspace (MWS) files and then upload them to the Spectrum Technology Platform repository. To have the custom map symbols displayed correctly in Spectrum Technology Platform, you must also follow the additional steps described here. Displaying Custom Symbols To display custom symbols in Spectrum Technology Platform: 1. Add the image files for the custom symbols to a JAR file. 2. Place the JAR file in this directory: install_dir/server/modules/spatial/lib. 3. If necessary, make any required changes to the custom symbol references in the MapInfo Professional workspace (MWS) file. This step is required only in cases where the custom symbol files are not located in the top-level internal directory within the JAR file. Spectrum Spatial Developer Guide 211

Custom Symbols In the MWS file, each reference to a custom symbol file can be found in the uri attribute of a Bitmap element. When you save a map as an MWS file in MapInfo Professional, the custom symbol references in the MWS file are set to the name of the custom symbol file only. If the custom symbol files are located in the top-level internal directory within the JAR file, then these references will already be correct. However, if the symbol files are located lower down in the JAR file's internal directory structure, then the uri attributes must be changed to reflect the location of the symbol files within the JAR file. In the uri attribute, each directory level within the JAR file must be separated by a forward slash ( / ), except for the top level. For example, if a custom symbol file named my_custom_symbol.png is located in the top-level internal directory within a JAR file, then the default reference to it in the MWS file will still be correct: <Bitmap id="id000017" name="my_custom_symbol" uri="my_custom_symbol.png" height="native" width="native" unit="mapinfo:imagesize pixel"> However, if the custom symbol file is located under an internal directory named images within the JAR file, then its reference in the MWS file should be changed to the following: <Bitmap id="id000017" name="my_custom_symbol" uri="images/my_custom_symbol.png" height="native" width="native" unit="mapinfo:imagesize pixel"> Note: In both cases, note the absence of a forward slash at the start of the uri path. For more information about the Bitmap element, see Bitmap on page 139. 4. Create named resources from the MWS using one of the following methods. Both procedures create a named map in the repository. The named map definition includes references to the custom symbols. Use the Spectrum Technology Platform Management Console. See Adding a Named Map and Named Tables on page 174 Use the Spectrum Technology Platform MWS Upload Utility. See Upload a Workspace to the Repository. 5. Restart Spectrum Technology Platform. 212 Spectrum Technology Platform 9.0

Migrating from Envinsa or MapXtreme Java 12 This section is for developers who have an application in Envinsa or MapXtreme Java and want to migrate it to Spectrum Spatial. The approach we have taken is a walkthrough of a coverage locator web application that is written in ASP.NET and uses Envinsa web sevices. The walkthrough highlights many of the decisions you will need to make as you evaluate your application for migration. For a higher level comparison of Spectrum Spaital to Envinsa and MapXterme Java, see the white paper "Migrating to a New Generation of MapInfo." The application to be discussed here is a web-based coverage locator solution for determining if wireless service is available from a wireless telecommunications operator and at what quality. The solution is an ASP.NET application using an Envinsa-based web services platform for mapping, geocoding and spatial analysis (Envinsa.NET API Presentation, Directory, Location Utility Services). The client tier is comprised of ASP.NET Web forms and uses Web 2.0 ASP.NET AJAX Extensions. In this section: Architecture Considerations......................214 Migration Tasks.................................215

Architecture Considerations Architecture Considerations This section covers migration decisions about the coverage locator solution architecture. Client Application The client portion of the coverage locator solution is an ASP.NET Web forms/ajax client. Decision: Do we keep the client application as is, using ASP.NET Web Forms, or do we take the opportunity to upgrade to a Web 2.0 Map tile-based application using Open Layers with Spectrum Spatial RIA controls? With the upgrade to Open Layers and RIA controls you will get a fast map display, navigation and a highly responsive user experience. It integrates with Pitney Bowes StreetPro-based base maps or other base maps such as those from Google and Bing maps. It also takes advantage of Spectrum Spatial s Map Tiling Service and Map Tiling generator. For more information on RIA controls, see Working with RIA Controls on page 33. For more information on map tiling, see Map Tiling on page 184. API: SOAP or REST for Geospatial Functionality The coverage locator uses geocoding, point-in-polygon querying and map rendering from the Envinsa.NET API. Decision: Do the Spectrum Spatial SOAP and REST APIs provide the same geospatial capabilities? Spectrum Spatial has built off the foundational interfaces of MapXtreme Java and Envinsa. In Spectrum Spatial, users have the ability to develop applications against one of three APIs: WS-I compliant SOAP interface; REST interface; and Series of OGC (Open Geospatial Consortium) interfaces including WMS, WFS and CSW. Spectrum has the Universal Addressing and Enterprise Geocoding modules for address validation and geocoding. These modules are a superset of Envinsa s Location Utility Service capabilities. Spectrum Spatial's SOAP API provides robust Mapping and Feature services. The REST API provides a smaller set of operations for mapping and feature searching, plus a map tiling service. The SOAP API is easiest to implement in a ASP.NET Web forms architecture while the REST API is easiest to implement in the Javascript-based Open Layers with Spectrum Spatial RIA Controls client. For more information on Spectrum Spatial's SOAP and REST API, see Working With REST Services on page 41. Data, Data Access and Management The coverage locator solution uses a base map for geographic reference and custom data for the coverages. In Envinsa the data format is MDF, which must be converted to Spectrum Spatial named resources. Decision: How do we access coverage layer data sources for point-in-polygon coverage quality query in Spectrum Spatial? How can we access our base map with coverage layers for map rendering at a specified location and zoom? Data access in Spectrum Spatial is similar to that in Envinsa, via a data provider model, but a generation ahead in terms of performance. For example, Spectrum Spatial can push spatial processing to a database with spatial capability to retrieve only records that satisfy the query. Data Management in Spectrum Spatial has built upon the Envinsa Content Manager concept to create the Spectrum Spatial Repository. The repository contains named resources that point to actual data. By attaching a name to a data resource, it can be referenced from many locations. To change the look or behavior of applications or data, only the resource needs to be changed, not each application or data 214 Spectrum Technology Platform 9.0

Chapter 12: Migrating from Envinsa or MapXtreme Java file. The management tool is called the Management Console. It has capabilities to create named resources and add them to the repository, as well as manage data connections and user access. Automation The processes for address validation, geocoding and point-in-polygon querying in the Envinsa solution required hand-written code specific to the implementation of the coverage locator. Decision: Can we improve on the workflow and performance of the application's business processes for address validation, geocoding and point-in-polygon querying? The Spectrum Spatial Enterprise Designer is a drag-and-drop workflow design tool for automating business processes. It can tie address validation, geocoding and point-in-polygon stages together without writing any code and with the ability to publish the process as a web service, a gain in performance over Envinsa and MapXtreme Java. This new capability is new to the MapInfo suite and enables a product paradigm shift for users and analysts that wish to formulate customized uses of Location Intelligence throughout an organization. Migration Tasks Decision Result After evaluating the architecture options for migrating the coverage locator, the decision is to leave the application as is experienced by the users and change as little as possible. The solution will continue to use ASP.NET Web Forms/Ajax client and we will update the Geosptial functionality and data access and management to use Spectrum Spatial. This section covers how to configure the application, services and data acess, and update the code to use the Spectrum Spatial SOAP API for geoprocessing. Configuration Configuration tasks include: User Account Management This section describes the task for creating users. Creating a User This procedure describes how to create a Spectrum Technology Platform user account and assign a role to the account. 1. Open the Management Console. 2. Expand Security then click Users. 3. Click Add. The New User window appears. 4. Leave the Enable user box checked if you want this user account to be available for use. 5. Enter the user name in the User name field. Note: User names can only contain ASCII characters. 6. Enter the user's password in the Password field. 7. Reenter the user's password in the Confirm password field. 8. Enter the user's email address in the Email address field. Spectrum Spatial Developer Guide 215

Migration Tasks 9. Enter a description of the user in the field. 10. Select the roles you want to give to this user. 11. Click OK. Transaction Logging Transaction Logging is managed via the Management Console. For more information see Transaction History. Set Default Options for Services in Repository Configuration Files Set-up Default options for FeatureService, MappingService and GeocodingService services in Spectrum Spatial Repository Configuration files and Management Console How to Change Web Service Configuration Settings To change web service configuration settings: 1. Pull the named configuration file for the web service out of the repository using your favorite WebDAV tool. Note: You cannot use the Named Resource Service to extract a named configuration file from the repository. 2. Using a text editor, make any required changes to the named configuration file. 3. Re-add the named configuration file back into the repository using your favorite WebDAV tool. Note: You cannot use the Named Resource Service to add a named configuration file to the repository. 4. Do one of the following to reload the web service configuration: Restart the web service. Use the Spectrum Technology Platform JMX Console (available at http://hostname[:portnumber]/jmx-console) to reload the configuration without restarting the web service. Development The development work to undertake when migrating our coverage locator application from Envinsa is to update the code in the following areas: change URLs to the Spectrum Spatial mapping; feature and geocoding services; provide user authentication; configure file references to the named map and data sources; and update the code to use the SOAP/WSDL Spectrum Spatial API in place of the Envinsa.NET API. Convert Envinsa Named Map to MWS Use the Envinsa Map Manager to save the named map as a. gst format file which can than be opened by MapInfo Professional ( MapX geoset Utility) or the MapXtreme Workspace Manager and saved as a MSW workspace file. 1. In the Envinsa Map Manager, save the named map as a.gst and open it in MapInfo Professional or MapXtreme Workspace Manager. 2. Save the.gst as an.mws workspace file. Be sure that Spectrum Spatial can access the.mws file for uploading to the repository. 216 Spectrum Technology Platform 9.0

Chapter 12: Migrating from Envinsa or MapXtreme Java Upload a Workspace to the Repository To upload a workspace to your repository: 1. Copy all data files used by the workspace to the Spectrum Technology Platform hosting machine. 2. For StreetPro data only, edit the MWS <filename> element to add the path to the data. 3. Run MWSUploadUtility.exe from any computer with access to the repository. When the utility launches, provide it with the following information: Repository: The standard WebDAV URL for the repository, including the final slash e.g., http://localhost:8080/repositoryservice/repository/default/ NamedMap Path: The path inside the repository to upload the Named Map files. If nothing is specified then the files will be uploaded at the repository root. NamedTables Path: The path inside the repository to upload the Named Table files. If nothing is specified then the files will be uploaded at the repository root. For StreetPro data, you do not need to create Named Tables, so leave this blank. MapName: The name of the Named Map to create in the repository. If nothing is specified then the name will default to the name of the MWS file. Local Data Path: The path to any referenced data files on the machine where the MWS file was created. If you do not know where the data files are located, then open the MWS file in a text editor and look for the path for any TAB file. For StreetPro data, leave this blank. Server Data Path: The path to the same data files on your Spectrum Technology Platform hosting machine. For StreetPro data, leave this blank. 4. Select the upload options you want to use. Overwrite Files: Check this box to overwrite any named resources in the repository with the same name. If this option is not checked, and a file exists with the same name, a new file will be created following this format: If States table exists, then States_0 will be created, then States_1, States_2, States_3, and so on. Maps: Create a named map resource in the repository for this workspace. You must check this option to view this workspace with the Mapping and Map Tiling services. Tables: Create a named table in the repository for each table used by the workspace. You must check this option to access these tables with the Feature Service. When selecting the Tables option, the Maps option, and NOT selecting the Use Named Tables option, the tool will create a named map with references to existing named tables. For StreetPro data, leave the checkbox empty. Use Named Tables: Reference named tables from the named map resource. If you check this option, then you must also create named tables with the Tables option (unless you already have these tables in the repository). If you do not check this option, then references to the tables used by the workspace will be embedded in the named map. For StreetPro data, leave the checkbox empty. 5. Click Upload Workspace. The tool will prompt you for the workspace file. If you have provided paths for the local data and server data, the tool looks for any references to the local data path in the MWS and dependent files, and then replaces them with the server data path. The program has now finished running. To verify that your named resources are in the repository, go to the repository at: http://hostname[:portnumber]/repositoryservice/repository/default/ Updating Envinsa References to Spectrum Spatial To update the Envinsa references to Spectrum Spatial: 1. In the coverage locator configuration file, update the references for the Envinsa services, named map and catalog paths, following the table below: Spectrum Spatial Developer Guide 217

Migration Tasks Envinsa Envinsa Service: http://localhost:8080/presentation/ services/presentation Spectrum Spatial Spectrum Spatial Service: http://localhost:8080/soap/mappingservice Envinsa Service: http://localhost:8080/directory/services/directory Spectrum Spatial Service: http://localhost:8080/soap/featureservice Envinsa Service: http://localhost:8080/locationutility/ services/locationutility Envinsa Named Map: <MapPreferences basemapname="mapdisplay/highcovloc" Envinsa Content Manager Catalog: <Layer name="3g" path="ntelos;ntelos//coverage.3g1x" alias="3g" selected="false"> Spectrum Spatial Service: http://localhost:8080/services/geocodeusaddress Spectrum Spatial Named Map: <MapPreferences basemapname=" ="/CovLoc/highCovLoc" Spectrum Spatial Named Table: <Layer name="3g" path="/covloc/3g1x" alias="3g" selected="false"> 2. Save the configuration file. Update Code to SOAP API Update the solution code to use the SOAP/WSDL Spectrum Spatial API for the FeatureService, MappingService and GeocodingService requests instead of the Envinsa.NET API. 1. Replace the Envinsa.NET API Directory Service WithinBoundary request with the Spectrum Spatial SOAP/WSDL API FeatureService SearchBySQL request. <SearchBySQLRequest:> <SQL>select Quality from "/CovLoc/3GIX" where MI_Point(-73.12345, 42.98765, 'epsg:4326') within obj</sql> 2. Replace the Envinsa.NET API Presentation Service PortrayMapRequest using LayerExtension property to exclude all other coverage layers from map except the selected one. Replace with the Spectrum Spatial SOAP/WSDL API MappingService DescribeNamedMap and RenderMap requests to get a list of layers in the named map to reconstruct it excluding all other coverage layers from map except the selected one. Example from Mapping Service SOAP Demo page: Render Map with FeatureLayer CustomRangeTheme: <S:Body> <v1:rendermaprequest imagemimetype="image/png" returnimage="false"> <v1:mapview xsi:type="v1:zoomandcentermapview"> <v1:width>800.0</v1:width> <v1:height>600.0</v1:height> <v1:zoomlevel uom="mile">3000.0</v1:zoomlevel> <v1:mapcenter srsname="epsg:4269"> <ns3:pos> <ns3:x>-101</ns3:x> <ns3:y>42</ns3:y> </ns3:pos> </v1:mapcenter> </v1:mapview> <v1:map> <v1:layer xsi:type="v1:featurelayer"> <ns2:table xsi:type="ns2:namedtable" name="/samples/namedtables/usa" /> <v1:themelist> <ns5:theme xsi:type="ns5:customrangetheme" expression="pop_2000"> <ns5:rangebinlist> 218 Spectrum Technology Platform 9.0

Chapter 12: Migrating from Envinsa or MapXtreme Java <ns5:rangebin> <ns5:upperbound xsi:type="ns7:doublevalue"> <ns7:value>20000000</ns7:value> </ns5:upperbound> <ns5:lowerbound xsi:type="ns7:doublevalue"> <ns7:value>0</ns7:value> </ns5:lowerbound> <ns6:style xsi:type="ns6:namedstyle" name="/samples/namedstyles/areastylegreen" /> </ns5:rangebin> <ns5:rangebin> <ns5:upperbound xsi:type="ns7:doublevalue"> <ns7:value>40000000</ns7:value> </ns5:upperbound> <ns5:lowerbound xsi:type="ns7:doublevalue"> <ns7:value>0</ns7:value> </ns5:lowerbound> <ns6:style xsi:type="ns6:namedstyle" name="/samples/namedstyles/areastylered" /> </ns5:rangebin> </ns5:rangebinlist> <ns5:allothers xsi:type="ns6:namedstyle" name="/samples/namedstyles/areastyleblue" /> </ns5:theme> </v1:themelist> </v1:layer> </v1:map> </v1:rendermaprequest> </S:Body> 3. Replace the Envinsa.NET API LocationUtility Service GeocodeRequest with the Spectrum SOAP/WSDL API GeocodeUSAddress service request. <GeocodeUSAddressRequest xmlns="http;//localhost:8080/services/geocodeusaddress"> <context> <account.id>admin</account.id> <account.password>admin</account.password> </context> <optional/> <rows> <row> <AddressLine>400 Main St</AddressLine> <City>Hamilton</City> <StateProvince>KS</StateProvince> <PostalCode>56789</PostalCode> </row> </rows> </GeocodeUSAddressRequest> Spectrum Spatial Developer Guide 219

Sample Applications 13 In this section we're going to bring together the concepts discussed in the previous sections to create both REST and SOAP client applications. In this section: When to Use REST and SOAP.....................222 REST Samples..................................222 SOAP Samples.................................224

When to Use REST and SOAP When to Use REST and SOAP Spectrum supports web service requests using REST and SOAP. They both offer similar capabilities, such as rendering, listing and describing maps and features. While our SOAP API offers more capabilities, the REST API is the more commonly used framework due to its use of JavaScript. An important difference between the two protocols is that REST uses a named resource in a request. SOAP will accept either a named resource or parameters that are written out in the request. A named map has the information about the map already defined and stored in the repository. At render time you cannot change the layer order or hide a layer, for example. If that is an important capability for you, choose SOAP and do not use named maps. But there are other options. One way to use REST and have some ability to control layer rendering is to have multiple named maps where each one defines one layer. If you want to use SOAP services in a JavaScript application, consider creating your own URL. This proxy will parse the request containing the named map and formulate it into a SOAP request containing the individual layers. Proxies are an important component in the RIA controls that ship with Spectrum Technology Platform. For more information see RIA controls section in this guide. REST Samples This section provides examples that show you how to make REST requests from client applications. List the Named Tiles In the Repository This web page uses a JavaScript call to the Map Tiling Service's REST interface to list the named tiles in the repository. The list of named tiles that is returned in the response is then displayed in a JavaScript alert box. Here is the code: <html> <body> <script type="text/javascript"> function submitform() { //Create an XMLHttpRequest object or try ActiveX var req; if (typeof XMLHttpRequest!= "undefined") { req = new XMLHttpRequest(); else { try { req = new ActiveXObject("Msxml2.XMLHTTP"); catch (e) { req = new ActiveXObject("Microsoft.XHTTP"); 222 Spectrum Technology Platform 9.0

Chapter 13: Sample Applications // populate the request, username and password var reqstring = document.getelementbyid('request').value; var username = document.getelementbyid('user').value; var password = document.getelementbyid('password').value; //Execute the REST request against a server secured with Basic Authentication req.open("get", reqstring, false, username, password); req.send(); //Display the response resp = req.response; alert(resp); </script> <form action="javascript: submitform()"> User: <input type="text" name="user" id="user" value="admin"/> Password: <input type="password" name="password" id="password" value="admin"/><br /> Request: <input type="text" name="request" id="request" value="http://myserver:8080/rest/spatial/maptilingservice/maplist.json"/><br /> <input type="submit" value="submit" /> </form> </body> </html> List the Named Maps In the Repository This Java application calls the Mapping Service's REST interface to list the named maps in the repository. The list of named maps that is returned in the response is then output at the command line. Here is the code: public static void main(string[] args) { java.io.inputstream is = null; try { // Create the REST request URL String serverurl = "http://myserver:8080/rest/spatial/mappingservice/maps.json"; java.net.url url = new java.net.url(serverurl); java.net.httpurlconnection conn = (java.net.httpurlconnection)url.openconnection(); String user = "user"; String password = "pass"; // Credentials need to be a base64 encoded string of the nature "user:pass" String credentials = user + ":" + password; byte[] encodedbytes = org.apache.commons.codec.binary.base64.encodebase64(credentials.getbytes()); String base64encodedstring = new String(encodedBytes); // Apply the authorization header - a string of nature "Basic <base64encodedcredentialsstring>" String authheader = "Basic" + " " + base64encodedstring; conn.addrequestproperty("authorization", authheader); // Get response for the request Spectrum Spatial Developer Guide 223

SOAP Samples is = conn.getinputstream(); java.io.bytearrayoutputstream bos = new java.io.bytearrayoutputstream(); org.apache.commons.io.ioutils.copy(is, bos); is.close(); // Display the response System.out.println(new String(bos.toByteArray())); catch (Exception e) { System.out.println(e.getMessage()); finally { org.apache.commons.io.ioutils.closequietly(is); SOAP Samples This section provides examples that show you how to make SOAP requests from client applications. Find the Nearest Five Subway Stations This application enables a user to find the five nearest subway stations in Toronto, Canada. To create this application, we will: 1. Create a named table that references the subway stations table, and add it to the repository. This table contains the location data for each subway station. 2. Create a named map that references the map of Toronto and add it to the repository. This map will show the user where each subway station is. 3. Create Java code that will call on the Feature Service to locate each subway station, and the Mapping Service to generate an underlying map of Toronto so that the user can see where each subway station is situated. Step 1: Add the Subway Stations Named Table to the Repository The first step is to create a named table in the repository that references the subway stations table (a TAB file). The TAB file contains the location data for each subway station. To create the named table in the repository, use the following steps: 1. Copy the subway stations TAB file to a location on the file system that is accessible to the Feature Service. 2. Open the Management Console and log in as an administrator. 3. Expand Modules > Location Intelligence > Tools then click Named Tables. 4. Click Add. The Add Named Table dialog box opens. 5. Enter the repository path and name for the new named table in the Named table name field. You must prepend the name of the named table with where in the repository the named table is going to be created. For example, if you are creating the SubwayStations named table and are creating this named table in the NamedTables directory in the repository, the name you would enter in the Named table name field would be /NamedTables/SubwayStations. 224 Spectrum Technology Platform 9.0

Chapter 13: Sample Applications 6. In the Named table type field select Tab. 7. In the Path field enter the path to the TAB file. 8. Click OK. The subway stations table now appears as a named table in the repository. Step 2: Add the Toronto Named Map to the Repository The next step is to create a named map for Toronto in the repository by uploading an MWS file. This map will show the user where each subway station is. 1. Find the file system location of the MWS file and the TAB files that the MWS references. 2. Copy the TAB files to a location on the file system that is accessible to the Mapping Service. 3. Open the MWS Uploader Utility. 4. In the Repository field, enter the standard WebDAV URL for the repository into which you want to upload the MWS file, including the final slash. For example, http://localhost:8080/repositoryservice/repository/default/. 5. In the NamedMaps Path field, enter the path inside the repository where you want the named map to be created. If this field is left empty, then the named map will be created at the root of the repository. 6. In the NamedTables Path field, enter the path inside the repository where you want the named tables that are referenced by the named map to be created. If this field is left empty, then the named tables will be created at the root of the repository. 7. In the MapName field, enter the name you want the new named map in the repository to have. If this field is left empty, then the name will default to the name of the MWS file. 8. In the Local Data Path field, enter the path to any referenced TAB files on the machine where the MWS file was created. If you do not know where the TAB files are located, then open the MWS file in a text editor and look for the path for any TAB files. 9. In the Server Data Path field, enter the path to the same TAB files on your Spectrum Technology Platform hosting machine. While uploading, the MWS Uploader Utility will look for any references to the local data path in the MWS and dependent files, and replace them with the server data path. 10. Select the Overwrite Files, Map, Tables, and Use Named Tables options. 11. Click the Upload Workspace button. The Open dialog box opens. 12. In the Open dialog box, select the MWS file you want to upload, then click Open. The selected MWS file, and the TAB files it references, are uploaded to the repository as a named map and named tables. The named map of Toronto and the required named tables have now been added to the repository and are available to the Mapping Service. Step 3: Create the Java Client Code The final step is to write the Java client code. The client code will receive a request to retrieve the five subway stations that are nearest to a given point. The point could be obtained either by geocoding an address or from a mobile device's GPS. Either way, the point will be provided to the client code as WGS 84 (lat/long) coordinates. The client code will call on the Feature Service to get the station locations. The client code will then use the Mapping Service to return a map of Toronto that has the location of the five subway stations as an overlay. Spectrum Spatial Developer Guide 225

SOAP Samples Before you can begin writing the Java client code, you must first generate the stub code based on the WSDL documents for the Feature and Mapping services. For information about how to generate stub code for a Java client, see Generating Stub Code for a Java Client on page 31. For the URLs of the Feature and Mapping Service WSDL documents, see WSDL URLs on page 30. Step 3a: Create the Client Code for the Feature Service Creating the SearchNearestRequest is a multi-step process as we need to specify: the geometry to search from the maximum candidates desired the name and location of, and distance to, each subway station the named table to query The steps are: 1. Create an instance of SearchNearestRequest and populate it with the desired parameters. 2. Make the call to the searchnearest method and get the SearchNearestResponse. 3. Return the FeatureCollection from SearchNearestResponse. Here is the code: /** * Returns a FeatureCollection of the 5 subway stations nearest the specified point. * The specified point is assumed to be in WGS 84 (i.e. long/lat). * @param longitude the longitude (i.e. X ordinate) of the point to search from. * @param latitude the latitude (i.e. Y ordinate) of the point to search from. * @return a FeatureCollection of the 5 subway stations nearest the specified point. */ private FeatureCollection findnearest(double longitude, double latitude) { // create the request and populate it along the way SearchNearestRequest request = new SearchNearestRequest(); // create the search point Point searchpoint = new Point(); searchpoint.setsrsname("epsg:4326"); Pos pos = new Pos(); pos.setx(longitude); pos.sety(latitude); searchpoint.setpos(pos); // set the search geometry which in this case is a point request.setgeometry(searchpoint); // we want at most 5 candidates request.setmaxnumberofcandidates(5); // return the distance from the search point to each found point as an attribute called 'distance' request.setreturneddistanceattributename(distance_attribute_name); request.setreturneddistanceunit(distance_units); // specify the attributes to return. in this case we want the name of the subway station and the geometry AttributeList projectionlist = new AttributeList(); projectionlist.getattributename().add("name"); projectionlist.getattributename().add("obj"); request.setattributelist(projectionlist); // specify the Named Table to search against NamedTable table = new NamedTable(); 226 Spectrum Technology Platform 9.0

Chapter 13: Sample Applications table.setname("/demo/stations"); request.settable(table); // create the client-side instance/interface to the FeatureService and specify the security settings to access the service FeatureService featureservicebootstrap = new FeatureService(); FeatureServiceInterface serviceport = featureservicebootstrap.getport(featureserviceinterface.class); ((BindingProvider)servicePort).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, ADMIN_USERNAME); ((BindingProvider)servicePort).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, ADMIN_PASSWORD); // query the Feature Service and return the resulting FeatureCollection try { SearchNearestResponse response = serviceport.searchnearest(request); return response.getfeaturecollection(); catch (ServiceException e) { throw new RuntimeException(e); Step 3b: Create the Client Code for the Mapping Service The next step is to create a map image with the found subway stations using Toronto as the base map. We need to use the RenderNamedMapWithOverlay method of the Mapping Service. The steps are: 1. Create an instance of RenderNamedMapWithOverlayRequest. 2. Set the desired width and height of the image. 3. Set the view (bounds) of the map. 4. Set the named map to render. 5. Set the MIME type (image format) to generate. 6. Create a FeatureLayer overlay based on the specified FeatureCollection. 7. Set some label properties to label each subway station with its name and distance in meters. 8. Create a theme to give the subway stations a recognizable style. 9. Execute the request and return the image's bytes. Here is the code: /** * Returns the image of the map overlayed with Features in the specified FeatureCollection. * @param fc the FeatureCollection to render on top of the map. * @param centerlongitude the longitude of the center of the map * @param centerlatitude the latitude of the center of the map * @param zoom the zoom (distance across the map) assumed to be kilometers. * @return the image of the map overlayed with Features in the specified FeatureCollection. */ private byte[] createmap(featurecollection fc, double centerlongitude, double centerlatitude, double zoom) { RenderNamedMapWithOverlayRequest request = new RenderNamedMapWithOverlayRequest(); ZoomAndCenterMapView mapview = new ZoomAndCenterMapView(); Spectrum Spatial Developer Guide 227

SOAP Samples // set the dimensions of the returned image to be 640 x 480 mapview.setwidth(640); mapview.setheight(480); // set the view. in this case we are using the zoom/center view Point center = new Point(); center.setsrsname("epsg:4326"); center.setpos(new Pos()); center.getpos().setx(centerlatitude); center.getpos().sety(centerlongitude); mapview.setmapcenter(center); Distance zoomlevel = new Distance(); zoomlevel.setvalue(zoom); zoomlevel.setuom(distanceunit.kilometer); mapview.setzoomlevel(zoomlevel); request.setmapview(mapview); // use the /demo/namedmaps/ontario Named Map for the background String namedmap = "/demo/namedmaps/ontario"; request.setnamedmap(namedmap); // we want a GIF String mimetype = "image/gif"; request.setimagemimetype(mimetype); // return the image NOT an URL to the image request.setreturnimage(true); // now create the FeatureCollection overlay using a MemoryTable and a FeatureLayer OverlayList overlaylist = new OverlayList(); List<Layer> overlays = overlaylist.getoverlay(); MemoryTable table = new MemoryTable(); table.setfeaturecollection(fc); FeatureLayer layer = new FeatureLayer(); layer.settable(table); { // create the label properties MapBasicPointStyle style = new MapBasicPointStyle(); MapBasicFontSymbol mapbasicsymbol; mapbasicsymbol = new MapBasicFontSymbol(); mapbasicsymbol.setbold(true); mapbasicsymbol.setcolor("black"); mapbasicsymbol.setfontname("arial"); mapbasicsymbol.setsize((short) 14); mapbasicsymbol.setshape(33); style.setmapbasicsymbol(mapbasicsymbol); LabelProperties labelproperties = new LabelProperties(); // the label expression is an MI SQL fragment labelproperties.setexpression("name + '(' + round(distance) + ' m)'"); labelproperties.setallowduplicate(allowduplicatetype.all); labelproperties.setallowoverlap(true); labelproperties.setxoffset(10.0); // a small offset in the X direction so the label does not overwrite the symbol layer.setlabelproperties(labelproperties); overlays.add(layer); request.setoverlaylist(overlaylist); // add theme to set the style of the overlay OverrideTheme theme = new OverrideTheme(); MapBasicPointStyle featurestyle = new MapBasicPointStyle(); MapBasicFontSymbol mapbasicfontsymbol = new MapBasicFontSymbol(); 228 Spectrum Technology Platform 9.0

Chapter 13: Sample Applications mapbasicfontsymbol.setshape(64); mapbasicfontsymbol.setcolor("red"); mapbasicfontsymbol.setfontname("mapinfo Transportation"); mapbasicfontsymbol.setsize((short) 14); featurestyle.setmapbasicsymbol(mapbasicfontsymbol); theme.setstyle(featurestyle); ThemeList themelist = new ThemeList(); themelist.gettheme().add(theme); layer.setthemelist(themelist); // create the client-side instance/interface to the FeatureService and specify the security settings to access the service MappingService mappingservicebootstrap = new MappingService(); MappingServiceInterface serviceport = mappingservicebootstrap.getport(mappingserviceinterface.class); ((BindingProvider)servicePort).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, ADMIN_USERNAME); ((BindingProvider)servicePort).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, ADMIN_PASSWORD); { RenderNamedMapWithOverlayResponse response; try { response = serviceport.rendernamedmapwithoverlay(request); catch (com.mapinfo.midev.service.mapping.ws.v1.serviceexception e) throw new RuntimeException(e); MapImage mapimage = response.getmapimage(); return mapimage.getimage(); Final Result And finally, here is the resulting map showing the five nearest subway stations: Spectrum Spatial Developer Guide 229

Common Object Types 14 This section provides reference information on common object types available in Spectrum Technology Platform. In this section: Geometry Types................................232 MapView Types.................................243

Geometry Types Geometry Types The following Geometry types can be specified in a feature or mapping request: Name Point MultiPoint Polygon MultiPolygon Envelope Ring LineString Curve MultiCurve LegacyText An (x,y,z) location. Java Example C# Example The collection of point geometries. Java Example C# Example A geometry consisting of exactly one exterior ring and zero or more interior rings. Each interior ring represents a hole completely inside the area defined by the exterior ring. Polygons with self-intersections or overlaps are not supported. Java Example C# Example The collection of polygon geometries. Java Example C# Example An envelope is a rectangle defined using two points (i.e. lower-left and upper-right) whose sides are parallel to the coordinate system axes. An envelope can be used as the bounds for map rendering, or as a minimum bounding rectangle for enclosing a geometry. Java Example C# Example A closed curve of line strings. Java Example C# Example An ordered collection of points connected by straight lines. Java Example C# Example An ordered connected sequence of line strings. Java Example C# Example An unordered collection of zero or more curves. Java Example C# Example Text that is of MapInfo native table type. Java Example C# Example Geometry Examples Geometry code examples are provided for Java and C#. Geometry Examples - Java The following examples demonstrate how to obtain various types of Geometry objects in Java programs. 232 Spectrum Technology Platform 9.0

Chapter 14: Common Object Types Point Example - Java The following shows a Java example that returns a Point object. public static Point buildpoint() throws Exception { Point point = new Point(); point.setsrsname("epsg:4326"); Pos pos = new Pos(); pos.setx(-77.0327); pos.sety(38.8990); pos.setmvalue(54.33); point.setpos(pos); return point; MultiPoint Example - Java The following shows a Java example that returns a MultiPoint object. public static MultiPoint buildmultipoint() throws Exception { MultiPoint multipoint = new MultiPoint(); multipoint.setsrsname("epsg:4326"); Point point = new Point(); Pos pos = new Pos(); pos.setx(-75.44); pos.sety(45.66); pos.setmvalue(new Double(54.33)); point.setpos(pos); multipoint.getpoint().add(point); Point point1 = new Point(); Pos pos1 = new Pos(); pos1.setx(-75.44); pos1.sety(45.66); pos1.setmvalue(new Double(54.33)); point1.setpos(pos1); multipoint.getpoint().add(point1); return multipoint; Polygon Example - Java The following shows a Java example that returns a Polygon object. public static Polygon buildpolygon() throws Exception { Polygon polygon = new Polygon(); polygon.setsrsname("epsg:4326"); Ring exteriorring = new Ring(); LineString linestring = new LineString(); Pos pos = new Pos(); pos.setx(-75.66); Spectrum Spatial Developer Guide 233

Geometry Types pos.sety(42.33); pos.setmvalue(new Double(-12.33)); linestring.getpos().add(pos); //add the viapoint Pos pos1 = new Pos(); pos1.setx(-77.66); pos1.sety(43.33); pos1.setmvalue(new Double(-17.33)); linestring.getpos().add(pos1); //add the end Point. Pos pos2 = new Pos(); pos2.setx(-78.66); pos2.sety(44.33); pos2.setmvalue(new Double(-19.33)); linestring.getpos().add(pos2); Pos pos3 = new Pos(); pos3.setx(-75.66); pos3.sety(42.33); pos3.setmvalue(new Double(-12.33)); linestring.getpos().add(pos3); exteriorring.getlinestring().add(linestring); polygon.setexterior(exteriorring); //set the interior ring. Ring interiorring = new Ring(); LineString interiorlinestring = new LineString(); Pos interiorpos = new Pos(); interiorpos.setx(-75.66); interiorpos.sety(45.33); interiorpos.setmvalue(new Double(-12.33)); interiorlinestring.getpos().add(interiorpos); //add the viapoint Pos interiorpos1 = new Pos(); interiorpos1.setx(-77.66); interiorpos1.sety(46.33); interiorpos1.setmvalue(new Double(-17.33)); interiorlinestring.getpos().add(interiorpos1); //add the end Point. Pos interiorpos2 = new Pos(); interiorpos2.setx(-75.66); interiorpos2.sety(45.33); interiorpos2.setmvalue(new Double(-19.33)); interiorlinestring.getpos().add(interiorpos2); interiorring.getlinestring().add(interiorlinestring); InteriorList interiorlist = new InteriorList(); polygon.setinteriorlist(interiorlist); //polygon.getinteriorlist().getring().add(interiorring[0]); return polygon; MultiPolygon Example - Java The following shows a Java example that returns a MultiPolygon object. public static MultiPolygon buildmultipolygon() throws Exception { MultiPolygon multipolygon = new MultiPolygon(); 234 Spectrum Technology Platform 9.0

Chapter 14: Common Object Types multipolygon.setsrsname("epsg:4326"); Polygon polygon = new Polygon(); //polygon.setsrsname("epsg:4326"); Ring exteriorring = new Ring(); LineString linestring = new LineString(); //linestring.setdimension("2"); //linestring.setsrsname("epsg:4326"); Pos pos = new Pos(); pos.setx(-75.66); pos.sety(42.33); pos.setmvalue(new Double(-12.33)); linestring.getpos().add(pos); //add the viapoint Pos pos1 = new Pos(); pos1.setx(-77.66); pos1.sety(43.33); pos1.setmvalue(new Double(-17.33)); linestring.getpos().add(pos1); //add the end Point. Pos pos2 = new Pos(); pos2.setx(-78.66); pos2.sety(44.33); pos2.setmvalue(new Double(-19.33)); linestring.getpos().add(pos2); Pos pos3 = new Pos(); pos3.setx(-75.66); pos3.sety(45.33); pos3.setmvalue(new Double(-12.33)); linestring.getpos().add(pos3); exteriorring.getlinestring().add(linestring); polygon.setexterior(exteriorring); //set the interior ring. Ring interiorring = new Ring(); LineString interiorlinestring = new LineString(); // linestring.setdimension("2"); //interiorlinestring.setsrsname("epsg:4326"); Pos interiorpos = new Pos(); interiorpos = new Pos(); interiorpos.setx(-75.66); interiorpos.sety(45.33); interiorpos.setmvalue(new Double(-12.33)); interiorlinestring.getpos().add(interiorpos); //add the viapoint Pos interiorpos1 = new Pos(); interiorpos1.setx(-77.66); interiorpos1.sety(46.33); interiorpos1.setmvalue(new Double(-17.33)); interiorlinestring.getpos().add(interiorpos1); //add the end Point. Pos interiorpos2 = new Pos(); interiorpos2.setx(-78.66); interiorpos2.sety(49.33); interiorpos2.setmvalue(new Double(-19.33)); interiorlinestring.getpos().add(interiorpos2); //add the end point Pos interiorpos3 = new Pos(); interiorpos3.setx(-75.66); interiorpos3.sety(45.33); interiorpos3.setmvalue(new Double(-12.33)); interiorlinestring.getpos().add(interiorpos3); interiorring.getlinestring().add(interiorlinestring); InteriorList interiorlist = new InteriorList(); polygon.setinteriorlist(interiorlist); //polygon.getinteriorlist().getring().add(interiorring); Spectrum Spatial Developer Guide 235

Geometry Types multipolygon.getpolygon().add(polygon); return multipolygon; Envelope Example - Java The following shows a Java example that returns an Envelope object. public static Envelope buildenvelope() throws Exception { Envelope envelope = new Envelope(); envelope.setsrsname("epsg:4326"); //set the startpoint Pos pos = new Pos(); pos.setx(-80.44); //pos.setx(-75.44); pos.sety(45.66); pos.setmvalue(new Double(54.33)); envelope.getpos().add(pos); //set the endpoint. Pos pos1 = new Pos(); pos1.setx(-73.44); //pos1.sety(43.66); pos1.sety(37.66); pos1.setmvalue(54.33); envelope.getpos().add(pos1); return envelope; Ring Example - Java The following shows a Java example that returns a Ring object. public static Ring buildring() throws Exception { Ring ring = new Ring(); ring.setsrsname("epsg:4326"); //set the linestring. LineString linestring = new LineString(); Pos pos = new Pos(); pos = new Pos(); pos.setx(-75.66); pos.sety(45.33); pos.setmvalue(new Double(-12.33)); linestring.getpos().add(pos); //add the viapoint Pos pos1 = new Pos(); pos1.setx(-77.66); pos1.sety(46.33); pos1.setmvalue(new Double(-17.33)); linestring.getpos().add(pos1); //add the end Point. Pos pos2 = new Pos(); pos2.setx(-78.66); pos2.sety(49.33); pos2.setmvalue(new Double(-19.33)); 236 Spectrum Technology Platform 9.0

Chapter 14: Common Object Types linestring.getpos().add(pos2); Pos pos3 = new Pos(); pos3.setx(-75.66); pos3.sety(45.33); pos3.setmvalue(new Double(-12.33)); linestring.getpos().add(pos3); ring.getlinestring().add(linestring); return ring; LineString Example - Java The following shows a Java example that returns a LineString object. public static LineString buildlinestring() throws Exception { LineString linestring = new LineString(); linestring.setsrsname("epsg:4326"); //add the first point. Pos pos = new Pos(); pos.setx(-75.44); pos.sety(45.66); pos.setmvalue(new Double(54.33)); linestring.getpos().add(pos); Pos pos1 = new Pos(); pos1.setx(-73.44); pos1.sety(43.66); pos1.setmvalue(new Double(54.33)); linestring.getpos().add(pos1); Pos pos2 = new Pos(); pos2.setx(-74.44); pos2.sety(45.66); pos2.setmvalue(new Double(54.33)); linestring.getpos().add(pos2); return linestring; Curve Example - Java The following shows a Java example that returns a Curve object. public static Curve buildcurve() throws Exception { Curve curve = new Curve(); curve.setsrsname("epsg:4326"); //set the linestring. LineString linestring = new LineString(); //LineString.setSrsName("EPSG:4326"); Pos pos = new Pos(); pos.setx(-75.66); pos.sety(45.33); pos.setmvalue(new Double(-12.33)); linestring.getpos().add(pos); //add the viapoint Pos pos1 = new Pos(); pos1.setx(-77.66); pos1.sety(46.33); Spectrum Spatial Developer Guide 237

Geometry Types pos1.setmvalue(new Double(-17.33)); linestring.getpos().add(pos1); //add the end Point. Pos pos2 = new Pos(); pos2.setx(-78.66); pos2.sety(49.33); pos2.setmvalue(new Double(-19.33)); linestring.getpos().add(pos2); curve.getlinestring().add(linestring); return curve; MultiCurve Example - Java The following shows a Java example that returns a MultiCurve object. public static MultiCurve buildmulticurve() throws Exception { MultiCurve multicurve = new MultiCurve(); multicurve.setsrsname("epsg:4326"); Curve curve = new Curve(); //curve.setsrsname("epsg:4326"); //set the linestring. LineString linestring = new LineString(); //linestring.setsrsname("epsg:4326"); Pos pos = new Pos(); pos = new Pos(); pos.setx(-75.66); pos.sety(45.33); pos.setmvalue(new Double(-12.33)); linestring.getpos().add(pos); //add the viapoint Pos pos1 = new Pos(); pos1.setx(-77.66); pos1.sety(46.33); pos1.setmvalue(new Double(-17.33)); linestring.getpos().add(pos1); //add the end Point. Pos pos2 = new Pos(); pos2.setx(-78.66); pos2.sety(49.33); pos2.setmvalue(new Double(-19.33)); linestring.getpos().add(pos2); curve.getlinestring().add(linestring); multicurve.getcurve().add(curve); return multicurve; LegacyText Example - Java The following shows a Java example that returns a LegacyText object. public static LegacyText buildlegacytext() throws Exception { LegacyText legacytext = new LegacyText(); 238 Spectrum Technology Platform 9.0

Chapter 14: Common Object Types Envelope envelope = buildenvelope(); legacytext.setrectangle(envelope); legacytext.settext("this is Legacy Text"); legacytext.setsrsname("epsg:4326"); Angle angle = new Angle(); angle.setvalue(90); angle.setuom(angularunit.degree); legacytext.setangle(angle); return legacytext; Geometry Examples - C# The following examples demonstrate how to obtain various types of Geometry objects in C# programs. Point Example - C# The following shows a C# example that returns a Point object. public static Point buildpoint() { Point point = new Point(); point.srsname = "EPSG:4326"; Pos pos = new Pos(); pos.x = -76.5; pos.y = 46.5; point.pos = pos; return point; MultiPoint Example - C# The following shows a C# example that returns a MultiPoint object. public static MultiPoint buildmultipoint() { MultiPoint multipoint = new MultiPoint(); multipoint.srsname = "EPSG:4326"; Point[] point = new Point[2]; point[0] = new Point(); point[0].srsname = "EPSG:4326"; Pos Pos = new Pos(); Pos.X = -75.44; Pos.Y = 45.66; point[0].pos = Pos; point[1] = new Point(); point[1].srsname = "EPSG:4326"; Pos Pos1 = new Pos(); Pos1.X = -73.44; Pos1.Y = 43.66; point[1].pos = Pos1; multipoint.point = point; return multipoint; Spectrum Spatial Developer Guide 239

Geometry Types MultiPolygon Example - C# The following shows a C# example that returns a MultiPolygon object. public static MultiPolygon buildmultipolygon() { MultiPolygon multipolygon = new MultiPolygon(); multipolygon.srsname = "EPSG:4326"; Polygon[] polygon = new Polygon[2]; polygon[0] = buildpolygon(); polygon[1] = buildpolygon(); multipolygon.polygon = polygon; return multipolygon; Envelope Example - C# The following shows a C# example that returns an Envelope object. public static Envelope buildenvelope() { Envelope envelope = new Envelope(); envelope.srsname = "EPSG:4326"; //set the startpoint Pos[] Pos = new Pos[2]; Pos[0] = new Pos(); Pos[0].X = -75.44; Pos[0].Y = 45.66; //set the endpoint. Pos[1] = new Pos(); Pos[1].X = -73.44; Pos[1].Y = 48.66; envelope.pos = Pos; return envelope; Ring Example - C# The following shows a C# example that returns a Ring object. public static Ring buildring() { Ring ring = new Ring(); ring.srsname = "EPSG:4326"; LineString[] linestring = new LineString[1]; linestring[0] = new LineString(); Pos[] coord = new Pos[4]; coord[0] = new Pos(); coord[0].x = -76.55; coord[0].y = 45.66; coord[1] = new Pos(); coord[1].x = -75.55; coord[1].y = 46.66; coord[2] = new Pos(); coord[2].x = -77.55; 240 Spectrum Technology Platform 9.0

Chapter 14: Common Object Types coord[2].y = 47.66; coord[3] = new Pos(); coord[3].x = -76.55; coord[3].y = 45.66; linestring[0].pos = coord; ring.linestring = linestring; return ring; LineString Example - C# The following shows a C# example that returns a LineString object. public static LineString buildlinestring() { LineString linestring = new LineString(); linestring.srsname = "EPSG:4326"; Pos[] coord = new Pos[3]; coord[0] = new Pos(); coord[0].x = -76.55; coord[0].y = 45.66; coord[1] = new Pos(); coord[1].x = -75.55; coord[1].y = 46.66; coord[2] = new Pos(); coord[2].x = -77.55; coord[2].y = 47.66; linestring.pos = coord; return linestring; Curve Example - C# The following shows a C# example that returns a Curve object. public static Curve buildcurve() { Curve curve = new Curve(); curve.srsname = "EPSG:4326"; //set the linestring. LineString[] linestring = new LineString[1]; linestring[0] = new LineString(); linestring[0].srsname = "EPSG:4326"; Pos[] Pos = new Pos[3]; Pos[0] = new Pos(); Pos[0].X = -45.33; Pos[0].Y = 75.66; //add the viapoint Pos[1] = new Pos(); Pos[1].X = -46.33; Pos[1].Y = 77.66; //add the end Point. Pos[2] = new Pos(); Pos[2].X = -49.33; Spectrum Spatial Developer Guide 241

Geometry Types Pos[2].Y = 78.66; linestring[0].pos = Pos; curve.linestring = linestring; return curve; MultiCurve Example - C# The following shows a C# example that returns a MultiCurve object. public static MultiCurve buildmulticurve() { MultiCurve multicurve = new MultiCurve(); multicurve.srsname = "EPSG:4326"; Curve[] curve = new Curve[1]; curve[0] = new Curve(); curve[0].srsname = "EPSG:4326"; //set the linestring. LineString[] linestring = new LineString[1]; linestring[0] = new LineString(); linestring[0].srsname = "EPSG:4326"; Pos[] Pos = new Pos[3]; Pos[0] = new Pos(); Pos[0].X = -45.33; Pos[0].Y = 75.66; //add the viapoint Pos[1] = new Pos(); Pos[1].X = -46.33; Pos[1].Y = 77.66; //add the end Point. Pos[2] = new Pos(); Pos[2].X = -49.33; Pos[2].Y = 78.66; linestring[0].pos = Pos; curve[0].linestring = linestring; multicurve.curve = curve; return multicurve; LegacyText Example - C# The following shows a C# example that returns a LegacyText object. public static LegacyText buildlegacytext() { LegacyText legacytext = new LegacyText(); Envelope envelope = buildenvelope(); legacytext.rectangle = envelope; legacytext.text = "This is Legacy Text"; legacytext.srsname = "EPSG:4326"; Angle angle = new Angle(); angle.value = 90; angle.uom = AngularUnit.Degree; legacytext.angle = angle; 242 Spectrum Technology Platform 9.0

Chapter 14: Common Object Types return legacytext; MapView Types The following MapView types can be specified in a mapping request: Name BoundsMapView ScaleAndCenterMapView ZoomAndCenterMapView Defines a map view based on the supplied bounds. If the bounds are not specified then the service will determine them. Java Example C# Example Defines a map view by scale and a center point. Java Example C# Example Defines a map view by zoom level and a center point. Java Example C# Example MapView Examples MapView code examples are provided for Java and C#. MapView Examples - Java The following examples demonstrate how to obtain various types of MapView objects in Java programs. BoundsMapView Example - Java The following shows a Java example that returns a BoundsMapView object. public static BoundsMapView getboundsmapview() throws Exception { BoundsMapView boundsmapview = new BoundsMapView(); boundsmapview.setheight(600); boundsmapview.setwidth(800); boundsmapview.setunit(paperunit.pixel); //sets the map resolution. If not specified, the default one is set to 96 DPI //boundsmapview.setmapresolution(200); boundsmapview.setbounds(buildgeometry.buildenvelope()); return boundsmapview; Spectrum Spatial Developer Guide 243

MapView Types ScaleAndCenterMapView Example - Java The following shows a Java example that returns a ScaleAndCenterMapView object. public static ScaleAndCenterMapView getscaleandcentermapview() throws Exception { ScaleAndCenterMapView scaleandcentermapview = new ScaleAndCenterMapView(); scaleandcentermapview.setheight(600); scaleandcentermapview.setwidth(800); scaleandcentermapview.setscale(20000); scaleandcentermapview.setunit(paperunit.pixel); //sets the map resolution. If not specified, the default one is set to 96 DPI //scaleandcentermapview.setmapresolution(200); Point point = BuildGeometry.buildPoint(); scaleandcentermapview.setmapcenter(point); return scaleandcentermapview; ZoomAndCenterMapView Example - Java The following shows a Java example that returns a ZoomAndCenterMapView object. public static ZoomAndCenterMapView getzoomandcentermapview() throws Exception { ZoomAndCenterMapView zoomandcentermapview = new ZoomAndCenterMapView(); zoomandcentermapview.setheight(600); zoomandcentermapview.setwidth(800); zoomandcentermapview.setunit(paperunit.pixel); //sets the map resolution. If not specified, the default one is set to 96 DPI //zoomandcentermapview.setmapresolution(200); Distance distance = new Distance(); distance.setvalue(2000.0); distance.setuom(distanceunit.kilometer); zoomandcentermapview.setzoomlevel(distance); Point point = BuildGeometry.buildPoint(); zoomandcentermapview.setmapcenter(point); return zoomandcentermapview; MapView Examples - C# The following examples demonstrate how to obtain various types of MapView objects in C# programs. BoundsMapView Example - C# The following shows a C# example that returns a BoundsMapView object. 244 Spectrum Technology Platform 9.0

Chapter 14: Common Object Types public static BoundsMapView createboundmapview() { BoundsMapView bmv = new BoundsMapView(); bmv.bounds = BuildGeometry.buildEnvelope(); bmv.height = 600; bmv.width = 800; bmv.unit = PaperUnit.Pixel; //sets the map resolution. If not specified, the default one is set to 96 DPI //bmv.mapresolution = 200; return bmv; ScaleAndCenterMapView Example - C# The following shows a C# example that returns a ScaleAndCenterMapView object. public static ScaleAndCenterMapView createscaleandcentermapview() { ScaleAndCenterMapView scaleandcentermapview = new ScaleAndCenterMapView(); scaleandcentermapview.height = 600; scaleandcentermapview.width = 800; scaleandcentermapview.scale = 20000; scaleandcentermapview.unit = PaperUnit.Pixel; //sets the map resolution. If not specified, the default one is set to 96 DPI //scaleandcentermapview.mapresolution = 200; Point point = BuildGeometry.buildPoint(); scaleandcentermapview.mapcenter = point; return scaleandcentermapview; ZoomAndCenterMapView Example - C# The following shows a C# example that returns a ZoomAndCenterMapView object. public static ZoomAndCenterMapView createzoomandcentermapview() { ZoomAndCenterMapView zc = new ZoomAndCenterMapView(); zc.height = 600; zc.width = 800; zc.unit = PaperUnit.Pixel; //sets the map resolution. If not specified, the default one is set to 96 DPI //zc.mapresolution = 200; // set up the zoom level of the map // it represents the full width of the map Distance zl = new Distance(); zl.value = 2000.0; zl.uom = DistanceUnit.Kilometer; zc.zoomlevel = zl; // set the map centre of the map view Point centre = BuildGeometry.buildPoint(); Spectrum Spatial Developer Guide 245

MapView Types zc.mapcenter = centre; return zc; 246 Spectrum Technology Platform 9.0

MapInfo Workspace (MWS) 15 Spectrum Technology Platform provides a workspace format that is portable and interoperable. This section covers its definition, capabilities and use. In this section: What Is the MapInfo Workspace?..................248 Structure of a Workspace........................248 Header Section.................................248 Connection Section.............................249 DataSource Definition Section....................251 Map Definition Section...........................252

What Is the MapInfo Workspace? What Is the MapInfo Workspace? Using Spectrum Technology Platform, you can persist the maps you create as XML-based workspaces (with an.mws extension) that are portable and interoperable. You will then be able to share these maps with anyone else using MapInfo products regardless of their working environment. In Spectrum Technology Platform, you can create named connections to define preferred paths for sharing new workspaces. Named connections allow you to specify alternate drive and path information or specific database connections to data on shared equipment. Users working on different computers can set up these named connection paths based on their own environment to use workspaces created by others. The path may be absolute or relative, but the file names are never included. Named connections can establish paths to a URI, a WMS, a local connection, and an RDBMS (using ODBC, OCI, or JDBC). Later, when a user gets a workspace that contains a named connection path, the correct path can be defined to locate the data referenced in the workspace. MXP_WorkSpace_1_5.xsd is a fully documented XML schema file that specifies the format of the XML file used to define workspaces. The XML schemas (.XSDs) that define the workspace are provided with Spectrum Technology Platform. There are comments in the schema files to assist you in using and understanding the workspace structure. You can view these files using any text viewing tool, such as Notepad, however, we recommend using a more robust XML viewing and editing tool. Our XML documents use textual identifiers and, where possible, we have used identifiers defined by XML standards organizations. However, XML, being extensible, allows for identifiers to be added by any document author to clarify the meaning of the data used in the document. To ensure that these identifiers are clearly labeled as defined by Pitney Bowes Software, we specify them in what we call the MapInfo Codespace. Structure of a Workspace The MapInfo Workspace is organized into sections of information, as follows: The Header Section on page 248 contains the basic file information including the version type and the creation date. The Connection Section on page 249 defines the location of the individual files that are contained in the workspace. This is where the named connection information is stored. The DataSource Definition Section on page 251 lists the sources of the data in the workspace.tab, Shape, Oracle, etc.. The Map Definition Section on page 252 contains definitions of layer, theme, and label features associated with the workspace, such as the label details, the zoom range, the colors used, etc. The UserData Section allows applications to persist their own data. User data is a "wild card" element meaning you can enter any content you want because the schema does not validate it. Header Section The file begins with the required XML file header information that describes the XML version the file conforms to, the encoding description, and a field that indicates whether the file is a standalone. The top level element in the file is the Workspace element, which contains attributes for the file version, date, and XML namespace definitions. Note: The supported encoding for workspace persistence is UTF-8 for Spectrum Technology Platform. <?xml version="1.0" encoding="utf-8" standalone="yes"?> 248 Spectrum Technology Platform 9.0

Chapter 15: MapInfo Workspace (MWS) <WorkSpace version="mxp_workspace_1_0" date="2004-02-03t14:00:00" xmlns:gml="http://www.opengis.net/gml" xmlns="http://www.mapinfo.com/mxp"> Connection Section The ConnectionSet section defines the database connections, file connections, and WMS connections that are necessary to use the workspace. These are examples of database connections. PostGIS <?xml version="1.0" encoding="utf-8"?> <NamedDataSourceDefinition version="mxp_namedresource_1_5" xmlns="http://www.mapinfo.com/mxp"> <ConnectionSet/> <DataSourceDefinitionSet> <GeoToolsDataSourceDefinition id="id1"> <DataSourceName>PostgresqlDataSource</DataSourceName> <GeoToolsConnection> <GeoToolsParams> <GeoToolsParam key="dbtype" value="postgis" valuetype="string"/> <GeoToolsParam key="host" value="@host@" valuetype="string"/> <GeoToolsParam key="port" value="@port@" valuetype="integer"/> <GeoToolsParam key="user" value="@user@" valuetype="string"/> <GeoToolsParam key="passwd" value="@password@" valuetype="string"/> <GeoToolsParam key="database" value="@databasename@" valuetype="string"/> </GeoToolsParam> <!--GeoToolsParam key="crs" value="epsg:4269" valuetype="string"/--> </GeoToolsParams> </GeoToolsConnection> <TableName>@TABLENAME@</TableName> <SchemaName>@SCHEMA@</SchemaName> </GeoToolsDataSourceDefinition> </DataSourceDefinitionSet> <DataSourceRef ref="id1"/> </NamedDataSourceDefinition> SQL Server <?xml version="1.0" encoding="utf-8"?> <NamedDataSourceDefinition xmlns="http://www.mapinfo.com/mxp" xmlns:gml="http://www.opengis.net/gml" version="mxp_namedresource_1_5"> <ConnectionSet> <GeoToolsConnection> <ConnectionName>SqlServer2008Connection</ConnectionName> <GeoToolsParams> <GeoToolsParam key="port" value="@port@" valuetype="java.lang.integer"></geotoolsparam> <GeoToolsParam key="passwd" value="@password@" valuetype="java.lang.string"></geotoolsparam> <GeoToolsParam key="dbtype" value="sqlserver" valuetype="java.lang.string"></geotoolsparam> <GeoToolsParam key="host" value="@host@" Spectrum Spatial Developer Guide 249

Connection Section valuetype="java.lang.string"></geotoolsparam> <GeoToolsParam key="user" value="@user@" valuetype="java.lang.string"></geotoolsparam> <GeoToolsParam key="database" value="@databasename@" valuetype="java.lang.string"></geotoolsparam> <GeoToolsParam key="crs" value="epsg:4326" valuetype="java.lang.string"></geotoolsparam> <GeoToolsParam key ="Integrated Security" value="false" valuetype ="java.lang.boolean"> </GeoToolsParam> </GeoToolsParams> </GeoToolsConnection> </ConnectionSet> <DataSourceDefinitionSet> <GeoToolsDataSourceDefinition id="id1"> <DataSourceName>SQLServerDataSource</DataSourceName> <ConnectionName>SqlServer2008Connection</ConnectionName> <TableName>@TABLENAME@</TableName> <SchemaName>@SCHEMA@</SchemaName> </GeoToolsDataSourceDefinition> </DataSourceDefinitionSet> <DataSourceRef ref="id1"/> </NamedDataSourceDefinition> Oracle <?xml version="1.0" encoding="utf-8"?> <NamedDataSourceDefinition version="mxp_namedresource_1_5" xmlns="http://www.mapinfo.com/mxp"> <ConnectionSet/> <DataSourceDefinitionSet> <DBDataSourceDefinition id="oraworldtable"> <DataSourceName>WORLD</DataSourceName> <ConnectionMember> <InlineDBConnection dbtype="oracle"> <JDBCDriverParameters> <JDBCUrl>jdbc:oracle:thin:@@host@:@port@:@SID@</JDBCUrl> <DriverPropertySet> <Property name="user" value="@username@" /> <Property name="password" value="password@" /> </DriverPropertySet> </JDBCDriverParameters> </InlineDBConnection> </ConnectionMember> <DBTable owner="@owner@" usequotes="true">world</dbtable> </DBDataSourceDefinition> </DataSourceDefinitionSet> <DataSourceRef ref="oraworldtable"/> </NamedDataSourceDefinition> 250 Spectrum Technology Platform 9.0

Chapter 15: MapInfo Workspace (MWS) DataSource Definition Section The DataSource Definition section defines the data files (for example, TAB files) and database tables that are retrieved at each connection location. Optional metadata may also be included to describe the data that is retrieved. <DataSourceDefinitionSet> <DBDataSourceDefinition id="id1" readonly="false"> <DataSourceName>alias_Line_ontario_oracle_9i_rel </DataSourceName> <ConnectionMember> <ConnectionName>ontario_oracle_9i_release_1</ConnectionName> </ConnectionMember> <DBQuery> <Query>select * from us_hiway_extra</query> </DBQuery> <DBDataSourceMetadata> <FeatureGeometryAttribute srsname="mapinfo:coordsys 1,62"> OBJECT </FeatureGeometryAttribute> <KeyAttributes /> </DBDataSourceMetadata> </DBDataSourceDefinition> <TABFileDataSourceDefinition id="id2" readonly="false"> <DataSourceName>alias_Line_us_hiway_extra</DataSourceName> <FileName>FeatureLayerBuilder\us_hiway_extra.tab</FileName> </TABFileDataSourceDefinition> <DBDataSourceDefinition id="id3" readonly="false"> <DataSourceName>alias_Point_ontario_oracle_9i_re </DataSourceName> <ConnectionMember> <ConnectionName>ontario_oracle_9i_release_1</ConnectionName> </ConnectionMember> <DBQuery> <Query>select * from usa_caps_extra</query> </DBQuery> <DBDataSourceMetadata> <FeatureGeometryAttribute srsname="mapinfo:coordsys 1,62"> OBJECT </FeatureGeometryAttribute> <KeyAttributes /> </DBDataSourceMetadata> </DBDataSourceDefinition> <TABFileDataSourceDefinition id="id4" readonly="false"> <DataSourceName>alias_Point_usa_caps_extra</DataSourceName> <FileName>FeatureLayerBuilder\usa_caps_extra.tab</FileName> </TABFileDataSourceDefinition> <DBDataSourceDefinition id="id5" readonly="false"> <DataSourceName>alias_Region_ontario_oracle_9i_r </DataSourceName> <ConnectionMember> <ConnectionName>ontario_oracle_9i_release_1</ConnectionName> </ConnectionMember> <DBQuery> <Query>select * from usa_extra</query> </DBQuery> <DBDataSourceMetadata> <FeatureGeometryAttribute srsname="mapinfo:coordsys 1,104"> OBJECT </FeatureGeometryAttribute> <KeyAttributes /> </DBDataSourceMetadata> </DBDataSourceDefinition> <TABFileDataSourceDefinition id="id6" readonly="false"> <DataSourceName>alias_Region_usa_extra</DataSourceName> Spectrum Spatial Developer Guide 251

Map Definition Section <FileName>FeatureLayerBuilder\usa_extra.tab</FileName> </TABFileDataSourceDefinition> </DataSourceDefinitionSet> Map Definition Section The Map Definition section defines one or more maps and their constituent layers. Each map has display conditions that include the size of the image, the zoom and center settings, and the coordinate system of the rendered map. The layer list displays with the label properties that are set for this map. These properties include the layer the labels are on, the file source for the labels, the visibility rules for the labels including the range at which the labels are visible, if applicable, the font and size properties of the labels, the label character limits, callouts, if applicable, label position settings, alignment, justification, and orientation of the label with regard to the point it is labeling. <MapDefinitionSet> <MapDefinition id="id7" name="tab_map 632140027761992151" alias="alias_tab_map 632140027761992151"> <DisplayConditions> <MapSize uom="mapinfo:imagesize pixel"> <ImageWidth>600</ImageWidth> <ImageHeight>400</ImageHeight> </MapSize> <ZoomAndCenter> <MapZoom uom="mapinfo:length mi">3000</mapzoom> <gml:point srsname="mapinfo:coordsys 1,62"> <gml:coordinates>-79.771366,38.003251000000006 </gml:coordinates> </gml:point> </ZoomAndCenter> <DisplayCoordSys> <SRSName>mapinfo:coordsys 1,62</SRSName> </DisplayCoordSys> <ResizeMethod>preserveZoom</ResizeMethod> <RasterConditions dither="halftone" truecolor="true" optimizerasterlayers="screen" optimizevectorlayers="screen" /> </DisplayConditions> <LayerList> <FeatureLayer id="id8" name="tab_point_632140027762460886" alias="alias_tab_point_632140027762460886" volatile="unknown"> <DataSourceRef ref="id4" /> </FeatureLayer> <FeatureLayer id="id9" name="tab_line_632140027764492071" alias="alias_tab_line_632140027764492071" volatile="unknown"> <DataSourceRef ref="id2" /> </FeatureLayer> <FeatureLayer id="id10" name="tab_region_632140027764960806" alias="alias_tab_region_632140027764960806" volatile="unknown"> <DataSourceRef ref="id6" /> </FeatureLayer> </LayerList> <MapLegendSet /> </MapDefinition> <MapDefinition id="id11" name="ontario_oracle_9i_release_1 632140027766054521" alias="alias_ontario_oracle_9i_release_1 632140027766054521"> 252 Spectrum Technology Platform 9.0

Chapter 15: MapInfo Workspace (MWS) <DisplayConditions> <MapSize uom="mapinfo:imagesize pixel"> <ImageWidth>600</ImageWidth> <ImageHeight>400</ImageHeight> </MapSize> <ZoomAndCenter> <MapZoom uom="mapinfo:length mi">3000</mapzoom> <gml:point srsname="mapinfo:coordsys 1,62"> <gml:coordinates>-79.771366,38.003251000000006 </gml:coordinates> </gml:point> </ZoomAndCenter> <DisplayCoordSys> <SRSName>mapinfo:coordsys 1,62</SRSName> </DisplayCoordSys> <ResizeMethod>preserveZoom</ResizeMethod> <RasterConditions dither="halftone" truecolor="true" optimizerasterlayers="screen" optimizevectorlayers="screen" /> </DisplayConditions> <LayerList> <FeatureLayer id="id12" name="oracle_usa_caps_extra_632140027766054521" alias="alias_oracle_usa_caps_extra_632140027766054521" volatile="unknown"> <DataSourceRef ref="id3" /> </FeatureLayer> <FeatureLayer id="id13" name="oracle_us_hiway_extra_632140027768398196" alias="alias_oracle_us_hiway_extra_632140027768398196" volatile="unknown"> <DataSourceRef ref="id1" /> </FeatureLayer> <FeatureLayer id="id14" name="oracle_usa_extra_632140027768866931" alias="alias_oracle_usa_extra_632140027768866931" volatile="unknown"> <DataSourceRef ref="id5" /> </FeatureLayer> </LayerList> <MapLegendSet /> </MapDefinition> </MapDefinitionSet> Spectrum Spatial Developer Guide 253

Notices

2013 Pitney Bowes Software Inc. All rights reserved. MapInfo and Group 1 Software are trademarks of Pitney Bowes Software Inc. All other marks and trademarks are property of their respective holders. USPS Notices Pitney Bowes Inc. holds a non-exclusive license to publish and sell ZIP + 4 databases on optical and magnetic media. The following trademarks are owned by the United States Postal Service: CASS, CASS Certified, DPV, elot, FASTforward, First-Class Mail, Intelligent Mail, LACS Link, NCOA Link, PAVE, PLANET Code, Postal Service, POSTNET, Post Office, RDI, Suite Link, United States Postal Service, Standard Mail, United States Post Office, USPS, ZIP Code, and ZIP + 4. This list is not exhaustive of the trademarks belonging to the Postal Service. Pitney Bowes Inc. is a non-exclusive licensee of USPS for NCOA Link processing. Prices for Pitney Bowes Software's products, options, and services are not established, controlled, or approved by USPS or United States Government. When utilizing RDI data to determine parcel-shipping costs, the business decision on which parcel delivery company to use is not made by the USPS or United States Government. Data Provider and Related Notices Data Products contained on this media and used within Pitney Bowes Software applications are protected by various trademarks and by one or more of the following copyrights: Copyright United States Postal Service. All rights reserved. 2013 TomTom. All rights reserved. TomTom and the TomTom logo are registered trademarks of TomTom N.V. Copyright NAVTEQ. All rights reserved Data 2013 NAVTEQ North America, LLC Fuente: INEGI (Instituto Nacional de Estadística y Geografía) Based upon electronic data National Land Survey Sweden. Copyright United States Census Bureau Copyright Nova Marketing Group, Inc. Portions of this program are Copyright 1993-2007 by Nova Marketing Group Inc. All Rights Reserved Copyright Canada Post Corporation This CD-ROM contains data from a compilation in which Canada Post Corporation is the copyright owner. 2007 Claritas, Inc. The Geocode Address World data set contains data licensed from the GeoNames Project (www.geonames.org) provided under the Creative Commons Attribution License ("Attribution License") located at http://creativecommons.org/licenses/by/3.0/legalcode. Your use of the GeoNames data (described in the Spectrum Technology Platform User Manual) is governed by the terms of the Attribution License, and any conflict between your agreement with Pitney Bowes Software, Inc. and the Attribution License will be resolved in favor of the Attribution License solely as it relates to your use of the GeoNames data. ICU Notices Copyright 1995-2011 International Business Machines Corporation and others. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, provided that the above 256 Spectrum Technology Platform 9.0

Copyright copyright notice(s) and this permission notice appear in all copies of the Software and that both the above copyright notice(s) and this permission notice appear in supporting documentation. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of the copyright holder. Spectrum Spatial Developer Guide 257