MapXtreme DeveloperGuide
MapXtreme DeveloperGuide
MapXtreme DeveloperGuide
v7.1
DEVELOPER GUIDE
Information in this document is subject to change without notice and does not represent a commitment on the part of the vendor or its representatives. No part
of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, without the written
permission of Pitney Bowes Software Inc., One Global View, Troy, New York 12180-8399.
2012 Pitney Bowes Software, Inc. All rights reserved.Pitney Bowes Software Inc. is a wholly-owned subsidiary of Pitney Bowes Inc. Pitney Bowes, the
Corporate logo, MapInfo, Group 1 Software, and MapXtreme are trademarks of Pitney Bowes Inc. or a subsidiary. All other trademarks are the property of
their respective owners.
United States:
Phone: 518.285.6000
Fax: 518.285.6070
Sales: 800.327.8627
Government Sales: 800.619.2333
Technical Support: 518.285.7283
Technical Support Fax: 518.285.6080
www.pb.com/software
Canada:
Phone: 416.594.5200
Fax: 416.594.5201
Sales: 800.268.3282
Technical Support:.518.285.7283
Technical Support Fax: 518.285.6080
pbinsight.ca
Europe/United Kingdom:
Phone: +44.1753.848.200
Fax: +44.1753.621.140
Technical Support: +44.1753.848.229
www.pb.co.uk/software
Asia Pacific/Australia:
Phone: +61.2.9437.6255
Fax: +61.2.9439.1773
Technical Support: 1.800.648.899
www.pbi.com.au/software
Contact information for all Pitney Bowes Software Inc. offices is located at:: www.pb.com/contact-us/
This product contains SpatiaLite v 3.1.0, which is licensed under GNU Lesser General Public License, Version 2.1, February 1999. The license can be
downloaded from: http://www.gnu.org/licenses/lgpl-2.1.html. The source code for this software is available from http://www.gaia-gis.it/gaia-sins/win-binx86-test/spatialite-3.1.0b-test-win-x86.zip and http://www.gaia-gis.it/gaia-sins/win-bin-amd64-test/spatialite-3.1.0b-test-win-amd64.zip.
This product contains Feature Data Objects v 3.6.0, which is licensed under GNU Lesser General Public License, Version 2.1, February 1999. The license can
be downloaded from: http://fdo.osgeo.org/lgpl.html. The source code for this software is available from http://fdo.osgeo.org/content/fdo-360-downloads.
This product contains HelpLibraryManagerLauncher.exe v 1.0.0.1, which is licensed under Microsoft Public License. The license can be downloaded from:
http://shfb.codeplex.com/license. The source code for this software is available from http://shfb.codeplex.com.
July 2012
Table of Contents
Chapter 1: Introduction to MapXtreme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Overview of MapXtreme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .22
Key Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .22
Migrating to MapXtreme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24
Learning to Use MapXtreme. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26
Support Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26
Developer Guide
Table of Contents
Developer Guide
Table of Contents
Developer Guide
Table of Contents
Developer Guide
Table of Contents
Developer Guide
Table of Contents
MICommand. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .190
MIDataReader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .192
MapInfo SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .193
Features and Feature Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .193
Feature. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .193
Feature Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .194
Searching for Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .194
Catalog Search Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .195
SearchInfo and SearchInfoFactory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .196
Analyzing Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .200
Improving Data Access Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .202
Developer Guide
Table of Contents
MapXtreme
Developer Guide
Table of Contents
10
Developer Guide
Table of Contents
11
Developer Guide
Table of Contents
12
Developer Guide
Table of Contents
13
Developer Guide
Table of Contents
AddressCandidates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .338
BaseGeocodeMatchCode and GeocodeMatchCode . . . . . . . . . . . . . . . . . . . . . . . . . .338
CandidateAddress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .338
Understanding the Geocoding Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .338
Geocoding Trade-offs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .338
A Few Words About Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .339
What are Custom User Dictionaries?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .340
What is World Geocoding? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .340
Geocoding a Location. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .340
Street Address Geocoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .341
Street Intersection Geocoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .342
Postal Code Geocoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .343
Gazetteer Type Geocoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .343
Batch Geocoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .343
Using Constraints for Accurate Geocoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .343
What are the Match Constraints?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .344
Impact of Relaxing Match Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .346
Understanding Accuracy for Close Matches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .346
Single Close Match (S Category). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .347
Best Match from Multiple Candidates (M Category) . . . . . . . . . . . . . . . . . . . . . . . . . .348
Postal Code Centroid Matches (Z Category) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .348
Geographic Centroid Matches (G category) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .348
Non-Match Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .349
MapXtreme
14
Developer Guide
Table of Contents
MapXtreme
15
Developer Guide
Table of Contents
16
Developer Guide
Table of Contents
17
Developer Guide
Table of Contents
18
Developer Guide
Table of Contents
19
Developer Guide
Table of Contents
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629
MapXtreme
20
Developer Guide
Introduction to
MapXtreme
In this chapter:
Overview of MapXtreme
MapXtreme is Pitney Bowes Softwares premier Windows software development toolkit that allows
.NET-experienced developers to create powerful location-enhanced desktop and client/server
applications.
From this single SDK, you can develop applications using your favorite .NET programming
language, share and reuse code between desktop and web deployments, access data from a wide
variety of sources using standard protocols, and more.
This is all possible through MapXtremes object model, an API of 100 percent managed code that
was developed on Microsofts .NET Framework. The Frameworks Common Language Runtime
(CLR) provides the foundation that makes simplified development a reality.
The following components and features are included in MapXtreme:
Product framework: The MapXtreme Object Model is built using the Microsoft .NET Framework
4.0. See Object Model Overview for more information.
Development Environment Tools: A variety of templates, controls, sample code and tools help
you develop Windows Forms and ASP.NET applications within Visual Studio. You can extend
some of these components to provide more advanced functionality available through the object
model. Two data management utilities are included for managing tables that you will use in your
application (Geodictionary Manager) and manage workspaces for ease of use and portability
(Workspace Manager). See Chapter 5: Web Applications, Controls, and Tools and
.Chapter 7: Desktop Applications, Controls, Dialogs, and Tools.
Full Mapping and Analytical capabilities: Map creation and display, data access, thematic
mapping, raster and grid handling, object processing and presentation, and more.
Scalable Infrastructure: Session object pooling and caching capabilities offer big performance
gains for web applications. Maintain session and user information by saving information to
MapXtremes XML-based workspace format. See Chapter 9: Working with Core MapXtreme
Classes.
Runtime Deployment: MapXtreme uses Windows Installer technology (merge modules) that
developers can use to install or redistribute runtime components used in deployed applications.
See Deploying Your Application.
Extensive Documentation: Product documentation is at your fingertips as integrated
components in the Visual Studio development environment. The MapXtreme Learning
Resources page keeps you connected to all product resources, including whats new and
changed in this release. Its available from the Start menu.
Key Features
MapXtreme is packed with features and conveniences to help you build your Windows Forms or
ASP.NET Web applications efficiently. Regardless if you are making the map the cornerstone of your
application or are adding some basic mapping functionality to support your existing application, the
framework and tools you use are the same. Here is an overview of MapXtremes capabilities:
If you are new to Pitney Bowes Softwares mapping products, be sure to also see Chapter 3:
Mapping Concepts for additional help on the basics.
MapXtreme v7.1
22
Developer Guide
Purpose
Data access
Web Services
This common mapping operation allows you to find just the data
that matches your criteria, by using attributes or spatial queries.
Thematic mapping
One of the most widely used ways of analyzing your data is to show
the visual relationship and underlying data through theme maps.
MapXtreme supports the creation and use of six themes: ranged,
individual value, graduated symbol, dot density, and pie and bar
charts.
Labeling
Map Styling
Labeling is one form of map styling that you can control on your
map in nearly infinite ways. Style also refers to the color, patterns,
fonts, line styles and symbols of map features that is used in many
areas of MapXtreme, including features, adornments (map titles),
dialog boxes and text.
MapXtreme v7.1
23
Developer Guide
Purpose
Some features or tools in this product may not be supported for some languages or in some regions.
Please consult your local customer service representative for details.
Migrating to MapXtreme
The following is a table that compares features and functionality from MapX and MapXtreme v3.0
with that of MapXtreme .NET. As with any new architecture of a product, note that the equivalent
may not be exact. Use the MapXtreme topics in the right column of this list to find further details
elsewhere in this Developer Guide and in the online help and object model. A full list of the MapX
object model and the equivalent functionality in MapXtreme is covered in Appendix J: Migrating to
MapXtreme.
MapX5.0 /MapXtreme3.0
Map object
MapXtreme
Map class: holds collection of Layers.
MapControl: way to view a map on a form.
MapInfo.Mapping namespace
MapXBroker
Layer-centric model
Tablecentric model
Related topics: Table metadata (TableInfo class), Feature class,
Column class (MI_Geometry, MI_Style, MI_Key), MapInfo
ADO.NET data provider.
MapInfo.Data namespace
MapXtreme v7.1
24
Developer Guide
MapXtreme
Add a temporary column to an Table using the
Table.AddColumns() method.
Related topic: Geodictionary Manager
MapInfo.Data namespace
Annotations
Thematic mapping
FeatureFactory
Tools
MapXtreme v7.1
25
Developer Guide
MapXtreme
New table structure, RasterImageInfo, GridImageInfo.
Related topics: controllable styles: brightness, contrast,
color/grayscale, translucency, one-color transparency.
MapInfo.Raster namespace
Selection object
Style Object
Style class: new object model. Styles are now objects, not
properties of other objects; information is stored in column
MI_Style.
Related topics: FeatureStyleModifiers,
FeatureOverrideStyleModifiers in the MapInfo.Mapping
namespace.
MapInfo.Styles namespace
Support Resources
MapInfo is committed to supporting new MapInfo developers as well as our long time customers. We
provide a wide variety of tools to help you make the transition or get up and running quickly in the
Visual Studio environment with the following resources.
MapXtreme v7.1
26
Developer Guide
The above-mentioned email address should not be used for questions specific to the
software or clarification about subjects contained in the documentation. Please send those
questions to Technical Support (see below).
If you are new to using or developing with MapInfo mapping products, be sure to see Chapter 3:
Mapping Concepts.
To get the latest release information, be sure to download a copy of the MapXtreme Release Notes
from the Pitney Bowes Software website.
Technical Support
Pitney Bowes Software offers unparalleled technical support for users of MapInfo software products.
Our Technical Support department provides technical assistance to registered users of MapInfo
software so you don't need to be an expert in all aspects of our products in order to get results.
See the Pitney Bowes Software Web site at www.pb.com/software for information on the tech
support offerings.
MapXtreme v7.1
27
Developer Guide
Getting Started
This chapter provides all the information you need to install, configure, and
deploy your first MapXtreme application.
In this chapter:
Installation Requirements
Pitney Bowes Software Inc.has tested and supports MapXtreme on the following.
Architecture
64-bit
32-bit
Operating Systems
Browsers
Supported databases
Support *
MDAC 2.8
Recommended development environments (IDE). Others can be used, however, the MapXtreme installer will
not integrate its templates, samples, and help system.
**
The MapXtreme Learning Resources displays in Internet Explorer automatically, regardless of your default
browser setting. This will not change your default browser setting.
MapXtreme v7.1
29
Developer Guide
L
L
MapXtreme does not support the Express Editions of Microsoft Visual Studio.
MapXtreme does not support the Borland Delphi development framework, nor does it
support the Cold Fusion or HAHT Web development frameworks.
Processor
Video Card
Types of Installations
MapXtreme provides two installation types: one for Development (SDK) and one for Deployment
(Runtime). Each is selectable from the product CD Browser.
MapXtreme v7.1
30
Developer Guide
MapXtreme Licensing
All MapXtreme installations require a license (.lic) file. Some licenses are provided in the installation,
others must be obtained from Pitney Bowes Software Inc. The following topics describe the types of
licenses and how you can obtain one from Pitney Bowes Software.
Types of Licenses
Depending on your purpose and needs, three types of licenses are available for MapXtreme SDK
(developer), runtime (deployment), and trial licenses.
SDK License
The SDK (Software Development Kit) license (MapXtremeSDK.lic) is for developers to create
desktop and web applications. Applications developed using this license will display a small
watermark in the upper-left corner of the map window.
Runtime License
Runtime, or deployment, licenses are required for all runtime desktop and web installations.
For desktop runtime deployments built using the NCP version of MapXtreme, the license (e.g.,
MapXtremeDesktop.lic) can be used on multiple installations.
MapXtreme v7.1
31
Developer Guide
For desktop runtime deployments built using the SCP version of MapXtreme, a license (e.g.,
MapXtremeDesktopIntl.lic, for example) is required for every installation.
For web runtime deployments built using the NCP or SCP version of MapXtreme, a license (e.g.,
MapXtremeWeb.lic) is required for every installation.
See Runtime Licenses for Deployment for information on packaging licenses in your distribution.
Trial License
The trial license (MapXtremeTrial.lic) is provided in the SDK and the Evaluation version of
MapXtreme. It expires 60 days from the date of installation. Applications that are developed using
the trial license display a watermark on the map that also indicates the number of days remaining for
the trial license.
Obtaining a License
SDK Licenses for Development
Users of the non-copy protected Software Development Kit (NCP SDK) automatically receive a
perpetual SDK license (MapXtremeSDK.lic), as well as a trial license when they install. With the
perpetual license you can continue to use the SDK as long as you want. No other SDK license is
necessary.
Users of the copy-protected SDK (SCP SDK) receive a trial license only. To use the SDK
permanently, you must obtain a perpetual SDK license from Pitney Bowes Software. To do this, run
MILicenseNodeID.exe (found under Program Files\Common files\MapInfo\MapXtreme\7.x.x\License
Tool) to generate a unique machine-specific hardware ID contained in a text file called
MILicenseNodeID.txt. Pitney Bowes Software uses this information to generate a custom license for
your particular installation. For complete details on obtaining a license, see the Software Copy
Protection Notice in the product box or installed under Program Files\MapInfo\MapXtreme\7.x.x\
Documentation\PDF\SoftwareCopyProtectionNotice_SCP.pdf. Contact Pitney Bowes Software (or
its representative) at the appropriate email or fax number for your region as provided on the notice.
When you receive your permanent license, copy it to the Program Files\Common Files\
MapInfo\MapXtreme\7.x.x folder prior to first use of the deployed application.
Evaluation users will be required to purchase the product before receiving a permanent license.
MapXtreme v7.1
32
Developer Guide
Deployment
Type
SDK Version of
MapXtreme
NodeLocked?
Desktop
Non-copy-protected
(NCP)
No
Desktop
Copy-protected
(SCP)
Yes
Web
NCP
Yes
Web
SCP
Yes
To generate a node ID for the deployment machine, run the licensing tool MILicenseNodeID.exe and
submit the resulting text file to Customer Service. The license tool is installed with the MapXtreme
SDK into Program Files\Common Files\MapInfo\MapXtreme\7.x.x\License Tool. See the Software
Copy Protection license application document in your MapXtreme package or under Program
Files\MapInfo\MapXtreme\7.x.x\Documentation\PDF.
The license tool is included in the merge module MapInfoMXTConfig_7.x.x.msm. Your users will get
this tool automatically when you include the MapInfoCoreEngine.msm in your distribution. See
Steps for Deploying an Application Using the Runtime Installer.
Generally, web licenses cannot be used for desktop deployments and vice versa. If it is an
SCP version, then the license (web or desktop) is node-locked to the machine on which you
are deploying.
When contacting Pitney Bowes Software for a license, specify the version of MapXtreme.
License Name
Location of License
Developer
SDK NCP
MapXtremeSDK.lic
Program Files\Common
Files\MapInfo\MapXtreme\7.x.x
SDK SCP
MapXtremeSDK.lic
Program Files\Common
Files\MapInfo\MapXtreme\7.x.x
Runtime
MapXtreme v7.1
33
Developer Guide
License Name
Location of License
Web NCP
MapXtremeWeb.lic
Program Files\Common
Files\MapInfo\MapXtreme\7.x.x
Web SCP
MapXtremeWeb.lic
Program Files\Common
Files\MapInfo\MapXtreme\7.x.x
MapXtremeTrial.lic
Program Files\Common
Files\MapInfo\MapXtreme\7.x.x
Trial
SDK NCP
SDK SCP
Evaluation
MapXtreme v7.1
34
Developer Guide
Troubleshooting
If you encounter problems with MapXtreme licensing, use the following table to help analyze and
solve the problem. For any issue, always check that the correct licenses are installed in the correct
locations (see Locations of License Files).
Possible Cause
Solution
"Licensing ErrorUnable to
Initialize MILicensing object."
Permissions needed
MapXtreme v7.1
35
Developer Guide
Possible Cause
Solution
Install the trial on a different
machine or purchase a valid
license.
The merge modules (MSM) in The merge modules are left out Purchase a runtime license.
of the trial version because the
the trial version are missing
it is not meant to be deployed.
(\Common files\Merge
Modules\).
Check whether the backup
process is running under the
same ID as the Exponare
process. If yes, then there is a
possibility of Terminal Services
being the problem. A new license
will fix the problem.
An invalid license file may have Find and delete old invalid
licenses. Place new license in the
been present in the old
appropriate directory.
directory and would have
caused the failure.
MapXtreme v7.1
Terminal Services
36
Developer Guide
Possible Cause
Solution
Obtain a new license
Virus software strips content from license email, leaving Null in the license file.
License generator occasionally creates corrupt license files.
Administrator Privileges
To install MapXtreme, you must be an Administrator on the machine or the current user must be a
member of the group Administrator. This applies to both types of installation (SDK and Runtime).
For Windows Vista, Windows 7 and Windows Server 2008, regular administration rights are
not sufficient because the installer must register the COM+ object. Vista users must rightclick Setup.exe and choose: 'Run as administrator' to obtain system privileges for the
installer.
L
MapXtreme v7.1
You may use a different development environment than Visual Studio, however, the
templates, samples, and the online help system will not be integrated.
37
Developer Guide
38
Developer Guide
<configuration>
<appSettings>
<add key="MapInfo.Engine.Session.Workspace"
value="C:\Programmer\MapInfo\MapXtreme\7.x.x\Samples\Data\World.mws"
/>
</appSettings>
</configuration>
You do not need to run this data installer in order to use the sample applications that ship with
MapXtreme. Basic sample data is automatically installed to the \Data folder for this purpose.
The MapXtreme CD Browser also provides a link to the PDF version of this Developer Guide.
MapXtreme v7.1
39
Developer Guide
The Deployment installation requires a runtime license. See Runtime Licenses for
Deployment.
4. Choose Install SDK or Install Runtime. At the Welcome dialog box, click Next to proceed. For
deployment installations skip to step 10.
You may also review the installation instructions and install sample data from this page.
5. At the Installer Welcome dialog box, read the information in the panel and click Next to proceed.
6. Choose to accept the License Agreement. Click Next. The Customer Information dialog box
appears.
MapXtreme v7.1
40
Developer Guide
8. At the Setup Type dialog box, select Complete or Custom. Choose Custom if you want the
features to be installed or to install to a location other than the default (C:\Program
Files\MapInfo\MapXtreme\7.x.x). Click Next. If you chose Complete proceed to step 10. If you
chose Custom continue to step 9.
MapXtreme v7.1
If you install MapXtreme to a location other than the default or on a version of Windows
XP other than the English US (ENU), you will need to edit the web.config file of any
sample web application you intend to run after installation. See the sample web
applications ReadMe.rtf file for instructions on editing the web.config file.
41
Developer Guide
10. At the Ready to Install the Program dialog box, click Install.
MapXtreme v7.1
42
Developer Guide
Upgrading to MapXtreme
MapXtreme installs into its own directory using the form \<installdir>\MapInfo\MapXtreme\7.x.x.x,
where X.x.x is the current release. It will not overwrite a previous version. This allows you to
maintain side-by-side installations of different releases of the product.
For a side-by-side installation, copy your old license file to the location of the newest installation
(Program Files\Common Files\MapInfo\MapXtreme\7.x.x.).
Note, when using a side by side install, you must close Visual Studio before opening a project of a
different type. For web applications, you will also need to reset Internet Information Services (IIS).
Use the iisreset.exe command in a console window or from the Start > Run menu option.
MapXtreme v7.1
43
Developer Guide
MapXtreme v7.1
44
Developer Guide
MapXtreme v7.1
45
Developer Guide
Map Applications
1. From the Visual Studio File menu, select New Project. The New Project dialog box appears.
2. In the Installed Templates frame of the New Project dialog box, under the Visual Basic folder,
choose Windows.
3. In the Templates frame of the New Project dialog box, select MapXtreme 7.x.x MapForm
Application.
MapXtreme v7.1
46
Developer Guide
4. Choose an appropriate name and click OK. MapXtreme creates the application.
Under Solution Explorer double-click MapForm.vb and MapForm.vb [Design] appears.
MapXtreme v7.1
47
Developer Guide
7. Use the controls in the toolbar to manipulate the map as you would with any other Pitney Bowes
Software mapping application.
3. Set the name of the application and solution and the location for the project. Click OK.
4. Under Solution Explorer double-click MapForm.aspx to see the design view view of the
MapControl and some tools.
MapXtreme v7.1
48
Developer Guide
7. Use the controls in the toolbar to manipulate the map as you would with any other Pitney Bowes
Software mapping application.
If you are unable to run the application, be sure to check that the ASP.NET State Service is running
on your system (Control Panel > Administrative Tools > Services > ASP.NET State Service).
MapXtreme v7.1
49
Developer Guide
MapXtreme Controls
Once you have created a basic application using one of our templates, enhancements are possible
using a variety of MapXtreme controls provided in the Toolbox.
For desktop map applications built using Windows Forms, MapXtreme Windows Controls are
available. Any of the controls found in the MapXtreme Windows Controls tab of the Visual Studio
Toolbox can be added to your form. See Chapter 7: Desktop Applications, Controls, Dialogs,
and Tools.
For MapXtreme ASP.NET web applications, MapXtreme Web Controls are available. Any of the
controls found in the MapXtreme Web Controls tab of the Toolbox, can be added to your form. See
Chapter 5: Web Applications, Controls, and Tools for more information.
MapXtreme v7.1
50
Developer Guide
51
Developer Guide
52
Developer Guide
To run the runtime installer with minimal UI, execute the runtime installer like this:
MXTRunNCP.exe /v"/qb"
To run the runtime installer silently, execute the runtime installer like this:
MXTRunNCP.exe /v"/qn"
If you are using a software copy protected version of MapXtreme, the runtime executable is called
MXTRunSCP.exe.
MapXtreme v7.1
53
Developer Guide
Included Assemblies
none
Contains custom
symbols
Required
when the
application
expects to
use the
stock
bitmap
symbols
Contains
assemblies with
MapInfo.Windows.Dialogs
.NET controls for
MapInfo.Windows.Framework use in C# and VB
.NET desktop
MapInfo.CommonDialogExt
applications
Required
when the
application
uses the
'Desktop'
tools
none
Required
when the
application
expects to
use the
stock
TrueType
fonts
MapInfoCustSymb_7.x.x.msm
Desktop
MapInfoDesktop_7.x.x.msm
Fonts
MapInfo.Windows
Contains
MapInfo fonts
such as
Symbols,
Cartographic,
Real Estate,
Arrows,
Miscellaneous,
Oil&Gas,
Transportation,
Weather, and
Shields.
MIFonts_7.x.x.msm
MapXtreme v7.1
When
Required
Purpose
54
Developer Guide
Included Assemblies
Mapping
MapInfo.CoreEngine
MapInfoCoreEngine_7.x.x.msm
MapInfo.CoreEngine.Wrappe
r
MapinfoMXTConfig_7.x.x.msm
MapInfoCoreEngineIntl.msm *
MapInfoCoreResJPN_7.x.x.msm
MapInfo.CoreTypes
MapInfo.WMS.Client
MapInfo.Windows.Printing
MapInfoCoreResCHN_7.x.x.msm
MapInfo.Ellis.ExtensibleData
Provider
When
Required
Purpose
Provides the
core mapping
functionality.
They also install
the common
configuration and
default reference
files for these
assemblies.
Required
Installs the.NET
assembly
MapInfo.Web,
and a number of
'web resources'
to be used in
web-based
applications.
Required
for any
application
that uses
the stock
web
controls
MapInfo.LinearReferencing
MapInfo.Ogc
MapInfo.WorkspaceManager.
Extension
Web Controls
MapInfo.Web
MapInfoWeb_7.x.x.msm
MapInfo.WebControls
MapInfo.Services
MapInfoServices_7.x.x.msm
MapXtreme v7.1
55
Contains the
assemblies for
geocoding and
routing
Required if
your
application
requires
geocoding
and
routing
Developer Guide
Included Assemblies
MapInfo.WFS.Server
Contains the
assemblies
needed for WFS.
Required if
your
application
uses a
Web
Feature
Service for
data
transforma
tion
MapInfo.WMS.Server
Contains the
assemblies
needed for
WMS.
Required if
your
application
uses a
Web Map
Service for
retrieving
digital
images.
MapInfoWFS_7.x.x.msm
WMS
When
Required
Purpose
MapInfoWMS_7.x.x.msm
MapXtreme v7.1
56
Developer Guide
Filename
Abbreviation file
MAPINFOW.ABB
Pen file
MAPINFOW.PEN
Projection file
MapInfoCoordinateSystemSet.xml
MapInfow.fnt
CustSymb
Nadcon files
*.las, *.los
jgd2000 files
jgd2000.*
MapXtreme v7.1
57
Developer Guide
What was used to deploy the application (for example runtime, SDK, Setup.exe, NCP/SCP?)
Is the license file located in C:\Program Files\Common Files\MapInfo\MapXtreme\7.x.x?
Are there additional .lic files on the machine? If so, remove them.
Is the customer on the deployment machine logged on as the administrator?
Is the 4.0 Framework installed on the deployment machine?
Is the CoreEngine registered as a COM+ application on the deployment machine?
Is the Visual C++ 10.0 CRT (runtime) installed on the machine?
MapXtreme v7.1
58
Developer Guide
Mapping Concepts
In this chapter:
Maps
Tables
Layers
Features
Labels and Legends
Themes
Tools
Workspaces
Coordinate Systems and Projections
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.
The map is contained in a MapControl. The MapControl also provides basic tools for viewing the
map (pan, zoom in, zoom out, center).
You create a map in a variety of ways:
Use the MapXtreme Workspace Manager to build and save a map workspace. (See Features of
the Workspace Manager).
Use a MapXtreme template that provides a MapControl that you are drag and drop onto a Visual
Studio form (See Chapter 7: Desktop Applications, Controls, Dialogs, and Tools for desktop
applications and Chapter 5: Web Applications, Controls, and Tools for web applications.
Use the MapXtreme Object Model to programmatically build mapping into your application (See
MapFactory and the MapInfo.Mapping namespace in the Developer Reference (online help).
Tables
Tables contain the data you wish to display on the map. Tables hold rows and columns of information
that describe the features, including their geometry, style, and attributes. MapXtreme supports tables
from a wide variety of sources including, native tables (MapInfo .TAB), relational database
management systems (RDBMS), dBase, MS Access, ASCII files, and ESRI ShapeFiles. Speciality
tables include raster, grid, seamless, views, WMS, and ADO.NET. The type of table is available
through the TableInfo class. Tables are opened and closed via the Catalog in the MapInfo.Data
namespace. See Chapter 8: Working with Data.
MapXtreme v7.1
60
Developer Guide
Layers
Maps are made up of layers. Layers contain map features, such as postal code boundaries, schools,
or streets networks. It is important to understand the order of the layers. 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.
Layers in MapXtreme can represent more than features. Layers can be raster or grid images,
seamless maps (joined maps), contain labels or user-drawn features, or contain an object theme,
such as a pie theme. Layers can be grouped for easier positioning and to facilitate animation of their
features. The main interface is IMapLayer. For more information see Layers.
Features
Features are described by their geometry, style, data source, key and attributes. Typically a feature
is a row in a table. Supported geometries include closed objects that cover a given area (Polygons,
MultiPolygons, Rings, Rectangle, RoundedRectangles, and Ellipses); point objects that represent
single locations of data (Points, MultiPoints); and line objects that cover a given distance (Curves,
MultiCurves and LegacyArcs).
One of the main uses of computerized maps is to gather information about the features. In
MapXtreme features are returned in FeatureCollections by any of several methods, either created
from scratch using a schema, selected using selection tools or methods or by searching the Catalog
for those that meet a specific set of criteria.
Feature classes are located in the MapInfo.Data namespace.
61
Developer Guide
Themes
Computer maps are not only useful for visibly showing spatial relationships among the map features,
but you can analyze the underlying data that is associated with the features to learn more about
what you see. A common analytical technique is to create a theme based on a feature layer in which
the data is ranked in specific ways. 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.
MapXtreme v7.1
62
Developer Guide
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.
The MapInfo.Mapping.Thematics namespace contains classes that implement themes as style
overrides on Feature layers and as Object themes. Modifier themes change the style, while object
themes add a new layer. All themes implement the ITheme interface.
Tools
Most mapping applications provide an assortment of toolbar buttons (tools) to aid with common
drawing tasks (such as drawing a line on the map) and navigation tasks (such as zooming in).
MapXtreme provides a number of mapping tools, plus you can also create your own custom tools.
The tools are divided into desktop tools and web tools, the API for each contained in their own
namespace (MapInfo.Tools for desktop and MapInfo.WebControls for web tools.)
For more information on desktop tools in MapXtreme see MapXtreme Desktop Tools API. For
more information on web tools see Chapter 5: Web Applications, Controls, and Tools.
Workspaces
While not strictly a mapping concept, workspaces are included here because they will make working
with all the mapping elements easier. MapXtreme supports an XML-based workspace format that
uses the .MWS extension. In it are all the settings for your maps. The format for the workspace is
explained in Appendix C: Understanding the MapInfo Workspace. MapXtreme provides a utility
called Workspace Manager to help you construct workspaces and save them for later use. See
Chapter 23: Workspace Manager.
MapXtreme v7.1
63
Developer Guide
MapXtreme v7.1
64
Developer Guide
MapXtreme v7.1
65
Developer Guide
Understanding the
MapXtreme Architecture
This chapter focuses on the design of the MapXtreme architecture so you can
make informed choices for your development needs. Understanding the
architecture of the product will help you to create applications that efficiently use
the features and capabilities of the product.
In this chapter:
MapXtreme Architecture
MapXtreme is built on top of Microsofts .NET framework and utilizes the functionality that its
infrastructure includes. This Pitney Bowes Software initiative enables you to leverage the power and
adaptability of developing your applications on the .NET framework. We have also worked hard to
combine the power and ease of our Windows products into one comprehensive object model. The
object model is the basis for Pitney Bowes Softwares partners and customers, as well as Pitney
Bowes Software itself, for developing Windows-based products for the foreseeable future.
With similar code, you can develop an application that can be deployed on either a desktop or the
Web. If you develop an application for the desktop, you can then adjust the application for
subsequent web deployment with only minimal code changes.
The following figure illustrates the MapXtreme architecture. The MapInfo.CoreEngine.dll assembly
and MapInfo.CoreTypes.dll assembly contain most of the core mapping and data access
functionality. On top of the Core Engine are the MapInfo.Windows and MapInfo.Web namespaces
that contain controls, tools, and other functionality specific to each deployment environment. Any
application that gets developed from the MapXtreme object model is built atop of the
MapInfo.Windows or MapInfo.Web namespace.
MapXtreme Architecture
MapXtreme v7.1
67
Developer Guide
MapInfo.Data Namespace
MapInfo.Data.Find Namespace
MapInfo.Engine Namespace
MapInfo.Geometry Namespace
MapInfo.Mapping Namespace
MapInfo.Persistence Namespace
MapInfo.Raster Namespace
MapInfo.Styles Namespace
MapInfo.WebControls Namespace
MapInfo.Tools Namespace
MapInfo.Geocoding Namespace
MapInfo.Routing Namespace
The complete object model is organized by namespace in the MapXtreme Programmers Reference,
which is integrated into Visual Studio.
If you have used MapX or the non-.NET version of MapXtreme (MapXtreme for Windows v3), be
sure to review Appendix J: Migrating to MapXtreme for a comparison of the two products object
models.
MapInfo.Data Namespace
The MapInfo.Data namespace contains the classes and interfaces that implement the MapInfo Data
Provider. The object model has several different classes to access data. Depending on the format in
which your data is stored, there are specific classes to use to access it. Additionally, we now
implement ADO.NET access to any data that is contained in formats not covered by any other class.
For details on the MapInfo.Data namespace, see Chapter 8: Working with Data and Chapter 11:
Accessing Data from a DBMS.
MapXtreme v7.1
68
Developer Guide
MapInfo.Data.Find Namespace
The MapInfo.Data.Find namespace contains the classes used for searching through data. The
namespace facilitates the search for an object by specifying a mappable table and column (it must
be indexed) on which to perform the search. For details on the MapInfo.Data.Find namespace, see
Chapter 13: Finding Locations.
MapInfo.Engine Namespace
The MapInfo.Engine namespace contains all classes directly related to the core functionality that
drives all applications based on MapXtreme. This includes the core Session class which is the
starting point for all MapXtreme applications. For details on the MapInfo.Engine namespace, see
Chapter 9: Working with Core MapXtreme Classes.
MapInfo.Geometry Namespace
The MapInfo.Geometry namespace is an extensible hierarchy based on OGC (Open GIS
Consortium) standards, coordinate system interoperability, and object processing. The
MapInfo.Geometry namespace contains classes, interfaces, and enumerations for creating and
editing Geometry objects. For details on the MapInfo.Geometry namespace, see Chapter 16:
Spatial Objects and Coordinate Systems.
MapInfo.Mapping Namespace
The MapInfo.Mapping namespace contains classes, interfaces, and enumerations for creating,
displaying, and exporting maps, layers, modifiers, and labels. For details on the MapInfo.Mapping
namespace, see Chapter 12: Adding Mapping Capability to Your Applications.
MapInfo.Mapping.Legends Namespace
The MapInfo.Mapping.Legends namespace contains classes, interfaces, and enumerations for
creating and displaying Cartographic and Thematic Legends. For more information, see Legends
and Using Themes and Legends.
MapInfo.Mapping.Thematics Namespace
The MapInfo.Mapping.Thematics namespace contains classes that implement themes as styles of
layers and as layers themselves. Themes can be applied to Modifier themes to change the style,
while object themes add a new layer. All themes implement the ITheme interface. For details on the
MapInfo.Mapping.Thematics namespace, see Chapter 14: Using Themes and Legends.
MapInfo.Persistence Namespace
The MapInfo.Persistence namespace contains classes that support the reading and writing of XMLbased workspaces to enable the saving and retrieval of mapping workspaces. See Appendix C:
Understanding the MapInfo Workspace.
MapXtreme v7.1
69
Developer Guide
MapInfo.Raster Namespace
The MapInfo.Raster namespace exposes the full functionality of Pitney Bowes Softwares C/C++
Raster and Grid APIs. Raster images can be opened for querying using
MapInfo.Raster.RasterRead. Grid images can be opened for querying using
MapInfo.Raster.GridRead. Hillshading can be added to existing grids using
MapInfo.Raster.HillshadeWrite. Related classes include MapInfo.Raster.RasterInfo and
MapInfo.Raster.GridInfo. For details on the MapInfo.Raster namespace, see Chapter 17: Working
with Rasters and Grids.
MapInfo.Styles Namespace
The MapInfo.Styles namespace highlights the Styles object model. The Styles class is the base
class of all styles. For details on the MapInfo.Styles namespace, see Chapter 15: Stylizing Your
Maps.
MapInfo.WebControls Namespace
The MapInfo.WebControls namespace provides support for using Visual Studio templates for a
MapXtreme ASP.NET application. There are MapControl and LayerControl design-time
enhancements available from this namespace, as well as web tools. For details on the
MapInfo.WebControls namespaces, see Chapter 5: Web Applications, Controls, and Tools.
MapInfo.Windows Namespace
The MapInfo.Windows namespace contains classes that implement various windows controls and
their requisite components for use with developing forms in Windows applications. The
Windows.Dialogs namespace contains classes that implement various dialog boxes and dialog box
components to be used in Windows applications. For details on the MapInfo.Windows namespace,
see Chapter 7: Desktop Applications, Controls, Dialogs, and Tools.
MapInfo.Tools Namespace
The MapInfo.Tools namespace contains classes for creating and implementing many types of tools
to use in your desktop map application. For details on the MapInfo.Tools namespace, see Overview
of the MapInfo.Tools Namespace.
MapInfo.Geocoding Namespace
The MapInfo.Geocoding namespace contains the classes, interfaces and enumerations that define
the MapXtreme client for geocoding. Geocoding using either the MapInfo geocoding server or the
MapInfo Location Utility service is supported. The URL of a running geocoding server or Location
Utility service must be available in order to perform geocoding. The interface of the geocoding server
and Location Utility service are similar, since they both use the same classes for geocode requests,
constraints, responses, result codes, and input and candidate addresses. See Chapter 18:
Geocoding.
MapXtreme v7.1
70
Developer Guide
MapInfo.Routing Namespace
The MapInfo.Routing namespace contains classes, interfaces, and enumerations which comprise
the .NET client for Routing. The MapInfo.Routing namespace contains classes that support
point-to-point, multi-point, matrix and isogram routing. optimized for shortest time or shortest
distance. It interacts with other MapInfo routing server products. The ability to avoid certain points is
also available. Routing results can include step by step directions and/or a route geometry which
can be displayed on a map. See Chapter 20: Routing.
Application Architectures
Now that you have had an overview of the MapXtreme namespaces, the next step is to consider the
architecture of the application you plan to build.
Using MapXtreme, you can build both web and desktop applications. The follow sections illustrate
possible architectures for web and desktop applications. The designs are based on the Model-ViewController paradigm that separates an application's data model, user interface, and control logic into
three distinct components. This allows for modifications to one component with minimal impact to
the others. Chapter 5: Web Applications, Controls, and Toolsand Chapter 7: Desktop
Applications, Controls, Dialogs, and Tools provides important additional information on key
design elements and decisions you need to consider when planning your MapXtreme application.
MapXtreme v7.1
71
Developer Guide
Architecture Description
The Web application illustrated above takes into account the following components and capabilities:
72
Developer Guide
MapXtreme v7.1
73
Developer Guide
The desktop application architecture is similar to the web application architecture in its Model-ViewController design.
Separate components are used for the presentation layer, application model and business logic. Use
the Workspace Manager to build any base maps that you need. Use Windows controls and dialogs
to give your application a rich user experience. You can also concurrently use dynamic data content
from a variety of sources, and control the flow and logic of the application.
See Chapter 7: Desktop Applications, Controls, Dialogs, and Tools for more information.
MapXtreme v7.1
74
Developer Guide
Web Applications,
Controls, and Tools
In this chapter:
MapXtreme Session
Background Map
MapControl
Map Tools
MapXtreme Session
The MapXtreme Session is the starting point for all MapXtreme applications. It manages the
initialization of resources needed for a MapXtreme application. The MapXtreme Session also
provides access to other important objects such as Catalog, MapFactory, CoordSysFactory,
Selections, and others.
To access the MapXtreme Session, call the MapInfo.Engine.Session.Current() method. Each thread
in your process has a MapXtreme Session object available. There can be only one MapXtreme
Session per thread and this session cannot be shared by multiple threads. See Session Interface.
Web applications can have one MapXtreme Session object per user, or pooled MapXtreme
Sessions available to many users. Both development models are discussed in Chapter 6:
Understanding State Management.
MapXtreme v7.1
76
Developer Guide
Background Map
The background map, in the form of an image, is the most visual component of a MapXtreme web
application. It provides the user of the application with information about map features and shows
their relationship to other map features. Typically, a background map is made up of reference layers,
such as administrative boundaries, street networks, and points of interest. Custom data related to
the application, such as points representing office locations, cell towers, or ATM machines, are
additional layers. The reference layers and the custom layers do not change based on the users
interaction with the application. What typically changes is the display of the map. A user may zoom
into a particular location or create a thematic shading that overlays the map based on criteria the
user submitted in a web request.
The background map is presented to the user in its initial, or "clean" state. This state is an important
consideration when you design a pooled application since your application must handle changes in
user state.
The background map is pre-loaded into the application from an XML-based workspace (.mws). The
workspace is identified in the Web.config file of the application. See What Should the Initial Map
Look Like?. The MapXtreme web template and sample applications provide Web.config files that
include hard-coded paths to sample data. If you base your web application on one of these, be sure
to adjust the path to your own data.
The Workspace Manager utility provided with MapXtreme is an example of a desktop application
that assists you with building a background map. See Chapter 23: Workspace Manager.
MapControl
MapControl is a MapXtreme web server control containing an instance of a Map object. The
MapControl is the main web control in a MapXtreme application; it displays the background map and
responds to tool interactions on the map. Behind the scenes, the Map object is obtained from the
MapFactory using the MapAlias property of the MapControl. The map is rendered and exported as
an image and returned to the browser in the controls <img> tag.
The sample applications that ship with MapXtreme have a MapControl built in, as does the
MapXtreme Web application template. You will see, however, that in design mode, the map is not
rendered. That is because to get a map from a web MapControl, there must be a running web
application on the server to serve up the map image along with some dynamically generated
javascript. That is only available at run/debug time.
If you start from a Visual Studio Visual Basic or C# ASP..NET template, you must manually
add the MapControl and tools to your web form in order for the MapXtreme resources to be
included in your project.
MapXtreme v7.1
77
Developer Guide
MapXtreme v7.1
78
Developer Guide
Map Tools
MapXtreme provides a number of map tools to assist you in navigating and interacting with the
background map. These tools are contained in the Visual Studio toolbox. Use them by dragging and
dropping the tool onto a web form.
Many of these tools are built into the MapXtreme web application template and sample applications,
including:
The LegendControl, Distance tool and selection tools are located in the MapXtreme portion of the
Visual Studio toolbox.
Tools are discussed in Description of Web Controls and Tools.
A generic WebTool, the base tool for all MapXtreme map tools is also located in the toolbox. Use this
tool if you wish to add custom behaviors to a tool. See Creating a Custom Tool.
MapXtreme v7.1
79
Developer Guide
Visual Studio toolbox under the MapXtreme heading. Drag and drop these controls onto your
Web Form to add mapping functionality to your project.
Web Application template: Start with the MapXtreme web application template (Visual Studio
File > New Project menu) to build a mapping prototype that requires no coding.
Sample Applications: Task-oriented samples are located In the \Samples\Visual Studio
20xx\Web\Features folder. Source code is also provided for you to learn from or extend for your
own needs.
The API for Web controls and tools is contained in the MapInfo.WebControls namespace. See the
Developer Reference for more information.
80
Developer Guide
Customizable
If the provided tools do not offer you the functionality to meet your needs, consider modifying them.
This can be as simple as changing a built-in tool property or as complicated as writing your own
JavaScript and server-side class to extend its functionality. Source code for the web controls and
tools is provided in the Samples\MapXtremeWebControlsSourceCode folder. See Creating a
Custom Tool.
MapXtreme provides an ASP.NET AJAX sample application that demonstrates how to use
Microsoft's ASP.NET AJAX controls in a MapXtreme web mapping application. See ASP.NET AJAX
and MapXtreme Web Applications.
Description
MapControl
LayerControl
MapXtreme v7.1
Allows you to display map feature layers and label layers in a tree view
structure. This control can turn the visibility on or off for a particular layer
and displays a read-only current zoom value. The visibility changes are
persistent only for the active life of the application using the
LayerControl.
81
Developer Guide
Map Tools
Description
CenterTool
DistanceTool
Allows you to get the distance between two or more points by clicking
on the map.
NavigationTools
Allow you to pan the map by fixed directions: North, South, East, West,
NorthEast, NorthWest, SouthEast, and SouthWest.
PanTool
Allows you to reposition the map within its window by dragging in any
direction.
PointSelectionTool
Allows you to select a feature (nearest to the point) when clicked on the
map.
PolygonSelectionTool
Allows you to select all features whose centroids lie within the polygon.
The selection area is drawn on the map using mouse clicks
representing the nodes of the polygon. A double click closes/ends the
polygon.
RadiusSelectionTool
Allows you to select all features whose centroids lie within the radius.
The radius is drawn on the map using mouse clicks representing the
center and boundary of the circle. The selection radius is drawn on the
map using a click and drag operation.
RectangleSelectionTool
Allows you to select all features whose centroids lie within the rectangle.
The rectangle selection area is drawn on the map using a click and drag
operation.
MapXtreme v7.1
82
Developer Guide
Allows you to zoom a map to a series of preset levels between 500 and
12,500 map units.
ZoomInTool
ZoomOutTool
Allows you to draw a rectangle representing the view to zoom out of the
map.
A background map is loaded via a pre-defined workspace. At design time, set the MapControl
MapAlias property to the map alias of the map defined in the preloaded workspace. At runtime,
the corresponding map is loaded into the MapControl, ready for users to interact with it using
map tools.
The first time a page is rendered, Page_Load and Page_Unload are called. Page_Load
initializes the state of the application, either to a default state for a new session, or restores state
if the session is not new. Page_Unload stores the state of any changes, in anticipation of another
request.
The StateManager is implemented in an application as a class, and an instance of that class is
put in the MapXtreme Session. SaveState and RestoreState methods are called from this object.
The SaveState and RestoreState methods are called every time a tool is used. If Manual mode is
used for state management, a StateManager class instance must be in the session.
(MapInfo.Engine.Session.State is set to Manual in your Web.config file.) For more on state
management, see State Management.
Error processing is done in the global_asax.cs/.vb file in the application_error event handler. See
Error Management.
Events are handled through client-side JavaScript commands that send a request to the server.
A server-side command class does server-side processing. See Event Handling.
MapXtreme v7.1
83
Developer Guide
Drawing and mouse operations (for example, rubber band rectangle, mouse click)
Collecting data from mouse operations (for example, getting the screen coordinates for a zoomin operation)
Sending the url request to the server
Carrying out the business logic of the tool (for example, calculating the distance between two
points)
MapXtreme v7.1
84
Developer Guide
1. A user draws a rectangle around the general area of Europe displayed in a MapControl using a
Zoom-In tool.
MapXtreme v7.1
85
Developer Guide
1.
In this situation, you will notice that the MapXtreme web controls and tools display red Xs in the Designer
instead of their icons. To display the icons properly, copy the MapXtremeWebResources folder from one of
the MapXtreme sample applications and paste it into your project where your Web.config and default.aspx
files are located. Close and re-open the web page to see the icons. To avoid this manual step. choose
option "a" instead.
MapXtreme v7.1
86
Developer Guide
Event Handling
Error Management
State Management
Event Handling
Map tool events are handled through client-side JavaScript commands that send a request to the
server. On the server-side a command class derived from MapBaseCommand does processing for
the tool.
In many command cases, the result of the server-side processing is sent back to the client. This is
an image in the case of the MapControl or XML in the case of the LayerControl. Then, only a portion
of the web page is updated with the command result via client-side JavaScript (for example, a new
map image is displayed after panning).
Error Management
Error handling in the Web controls can be handled in many ways, and it is very specific to the
application. Therefore, this section only explains one of the ways of handling errors. Since the
response expected by the client side is an image, we can catch the exception using a detailed
message, and send the response back with both an image and an error message. As a result, the
MapControl will now contain the error message.
MapXtreme v7.1
87
Developer Guide
State Management
The MapInfo.WebControls.StateManager is an abstract class that includes methods SaveState and
RestoreState. MapXtremes map tools call RestoreState and SaveState before and after the
processing, respectively. Since state management is application specific, it is your responsibility to
implement these methods in a concrete class in the application. This allows you to control what gets
restored and saved and how things are restored and saved.
For more information on state management, see Chapter 6: Understanding State Management.
Properties for the tool are defined either in the class or on the web page. The custom tool is
referenced on the web page by the tool class name.
The code used in the following procedure can be found under the Samples folder under
\Web\Features\CustomTools\CustomToolsCS.
To create a custom tool:
MapXtreme v7.1
88
Developer Guide
89
Developer Guide
The assembly name is MapInfo.WebControls.dll and is installed in the global assembly cache.
This assembly has a specific version number which is used by our templates and sample
applications.
The controls in the assembly are installed in the toolbox in Visual Studio.
The assembly has references to MapInfo.CoreEngine.dll, MapInfo.CoreEngine.Wrapper.dll and
MapInfo.CoreTypes.dll.
Resources such as images and scripts are installed in the C:\Program Files\Common
Files\MapInfo\MapXtreme\7.x.x\MapXtremeWebResources folder.
MapXtreme v7.1
90
Developer Guide
You can insert the Web controls project and resources right into your Web application solution. In
this case, change the URLs for your resources (scripts and images) to begin with the project
root. This prevents you from having to create virtual directories.
You do not have to use the global assembly cache and a strongly named assembly. You can set
the Copy property for the assembly to true, and have the assembly in the bin folder of your
application.
MapXtreme v7.1
91
Developer Guide
3. Add a PointSelect tool to your Web Form and add the code below in the forms Page_Load
method:
MapInfo.WebControls.MapControlModel controlModel =
MapControlModel.SetDefaultModelInSession();
controlModel.Commands.Add(new CustomWebTools.Info());
4. Match the properties of the PointSelect tool to those of the InfoTool from the sample application.
Set these in the tools Properties window.
These properties include: ClientCommand, ClientInteraction, Command, CursorImageURL,
InactiveImageURL. and MapControlID.
5. Switch the form to the HTML view and add the following line after the <form> tag.
<script language="javascript" src="CustomCommand.js"
type="text/javascript"></script>
6. Add a <div> like the one in the sample application to hold the information retrieved by the tool.
<div id="Info" class="infoDiv">
Div element to display selected feature information in
html table.</div>
7. Build the Web Application.
92
Developer Guide
The AJAXDemo sample requires that the Microsoft ASP.NET AJAX Extensions 1.0 or later
be installed on your system.
The following section provides the steps to add AJAX controls to your MapXtreme application.
Before proceeding, as an exercise in understanding AJAX, its a good idea to create a web
application using the "ASP.NET AJAX-Enabled Web Site" template that is provided with the AJAX
extensions. Examine its Web.config file; the httpHandlers section and the httpModules section
contain settings that you may need to copy into your application.
You should also familiarize yourself with the AJAXDemo sample web application. The steps that
follow refer to JavaScript code and Web.config settings taken from this sample.
Do not move MapXtreme controls, such as the MapControl or the LayerControl, inside
the UpdatePanel. For a detailed example, see the AJAXDemo sample application.
5. Open your application's Web.config file, and locate the httpHandlers section. Depending on the
contents of your web application, the httpHandlers section might contain just one or two entries one for MapController.ashx, and, if your application contains the LayerControl, one for
LayerController.ashx.
<httpHandlers>
<add verb="*" path="MapController.ashx" . . .
<add verb="*" path="LayerController.ashx" . . .
</httpHandlers>
6. Open the Web.config file from the AJAXDemo sample application, and locate its httpHandlers
section, which contains additional entries needed by ASP.NET AJAX:
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" . . .
<add verb="*" path="*_AppService.axd" . . .
MapXtreme v7.1
93
Developer Guide
In the <script> block, delete the DisplayEventInfo function and any calls to it. The
DisplayEventInfo function is a debugging tool for the AJAXDemo application; it is not needed in
other applications.
10. If you renamed your UpdatePanel, edit the <script> block to use the new UpdatePanel name.
(The UpdatePanel name is passed as the second parameter to the TargetPanelWasUpdated
function; the default name is "UpdatePanel1".)
11. If you use more than one UpdatePanel in your application, but you do not want all of the
UpdatePanels to affect the map, then you should set each UpdatePanel's UpdateMode property
to Conditional. For details, see the ReadMe file provided with the AJAXDemo sample
application.
For additional details about the Web.config settings required by ASP.NET AJAX extensions, please
consult Microsoft's ASP.NET AJAX documentation.
94
Developer Guide
The MapXtreme Tile Handler API is included under the MapInfo.WebControls.Tiling namespace.
See the Developer Reference for details. Source code for the Tile Handler is provided in the
\Samples\WebControlsSourceCode folder.
/>
/>
/>
/>
95
Developer Guide
Description
server
webapp
MapXtreme v7.1
96
Developer Guide
Description
TileServer
mapname
level
x;y
ext
Caching
The MapXtreme Tile Handler supports caching of frequently used tiles so that application
performance does not suffer. Caching instructions are included in the web.config file following
Microsofts.NET Framework HttpCacheability.
Five types of caching (plus a no cache option) are supported. These enumerated values are used to
set the Cache-Control HTTP header.
NoCache
Private
Public
MapXtreme v7.1
97
Developer Guide
ServerAndNoCache
Applies the settings of both Server and NoCache to indicate that the
content is cached at the server but all others are explicitly denied the
ability to cache the response.
ServerAndPrivate
Indicates that the response is cached at the server and at the client
but nowhere else. Proxy servers are not allowed to cache the
response.
To specify a cache option, modify your web.config file to point to the key
MapInfo.Engine.Session.Cacheability, as follows.
<appSettings>
<add key="MapInfo.Engine.Session.Cacheability"
value="private"></add>
</appSettings>
Caching Expiration
You can also set an expiration date for your cached tiles. Set an expiration date when the data in the
tile needs to be refreshed. By expiring tiles, users of your application will receive only the most
up-to-date information displayed.
To set the cache expiration, add a key to the web.config file, as follows:
<appSettings>
<add key="MapInfo.Engine.Session.CacheExpires"
value="4/1/2010"></add>
</appSettings>
The value can be any string that can be successfully parsed by Microsofts DateTime.Parse(String)
method.
Note that Microsoft limits the expiration date to one year. Any date beyond one year will not be
honored.
MapXtreme v7.1
98
Developer Guide
Loading Data
Replacing Controls
State and Event Management
Loading Data
The only way to load data with MapXtreme Web controls is by using a preloaded workspace. The
MapControl points to the MapAlias in the workspace and tries to display the map, not load the map.
The preloaded workspace is specified in the Web.config file. See What Should the Initial Map
Look Like?.
In the case where the MapControl is used to display multiple map images, set up the data so that all
maps are in one location, and change the MapAlias of the MapControl to choose the maps.
1.
In MapXtreme releases prior to version 6.5, the web controls required a postback page that called
Page_Load and Page_Unload every time a tool was used. These controls have been replaced by more
efficient JavaScript-enabled partial-page update controls. We provide the postback controls for backward
compatibility, but they have been marked Obsolete. Information on these controls is contained in the
MapInfo.Web.UI.WebControls namespace. For the JavaScript controls API, see the MapInfo.WebControls
namespace.
MapXtreme v7.1
99
Developer Guide
Replacing Controls
Replacing controls can be done in various ways, either by deleting the older Web controls from the
form and dragging and dropping the new Web controls on the form, or by creating new Web forms,
dragging and dropping the new controls and then start adding functionality from the old forms to the
new forms. Make sure to set the appropriate MapAlias for the MapControl and set the appropriate
MapControlID for all dependent tools and the LayerControl.
The MapControlID must be manually entered into the properties for the dependent controls. If
there is a MapControl on the same page as the dependent control with the same ID, the tools
and LayerControl will pick that one.
Since the frame pages render in a particular order, the MapXtreme session will not be a new
session for frames rendered after the first frame. To ensure the StateManager is in place,
implement the following code. Ensure there is a StateManager class registered regardless of
what page is loaded, The following code is executed before RestoreState is called.
MapXtreme v7.1
100
Developer Guide
MapXtreme v7.1
101
Developer Guide
Understanding State
Management
This chapter describes concepts and best practices for state managementa
subject of great importance when writing web applications.
In this chapter:
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .103
Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .103
What is State Management? . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105
InProc Development Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107
State Management For Pooled Objects . . . . . . . . . . . . . . . . . . . .110
A Detailed Look at Manual State Management . . . . . . . . . . . . . .115
A Closer Look at the MapXtreme Session . . . . . . . . . . . . . . . . . .121
Overview
State management is a key consideration in the design and implementation of a MapXtreme web
application. How the changes a web site visitor makes when interacting with your web application is
central to a successful user experience and to building a scalable, high performing application.
Before getting too far into this subject, the following section is a "must read" for what follows in this
chapter. Understanding the difference between MapXtreme Session and HTTP Session, user state
and application state, clean and dirty MapXtreme Session objects, and more, will better prepare you
for planning and building your web application successfully right from the beginning.
Terminology
MapXtreme Session - The MapInfo.Engine.Session object that holds the Catalog, MapFactory, and
CoordSysFactory. The user interacts with an instance of a MapXtreme Session object.
HTTP Session - The System.Web.HttpSessionState object where the user's changes are saved
between requests. These changes are saved and restored for each request. The user's changes are
known as the user state.
Browser Session -The period of time a unique user interacts with the web application. This is also
referred to as the ASP.NET Session.
InProc Development model - A web application development model in which each user has his
own instance of the MapXtreme Session object. Any changes the user makes during the browser
session do not affect other users. The entire MapXtreme web application is stored in memory with
the current application state and is associated with this individual user. This model is useful for
small, light-use web applications where the number of users is known, such as a departments
intranet. Contrast this with the more scalable Pooled Development model in which users share the
MapXtreme Session and system resources. See InProc Development Model on page 112.
Pooled Development model - A model in which multiple MapXtreme Session instances are
available from a COM+ pool associated with the web application and are activated to serve web
requests. Each of the pooled MapXtreme Session objects is used to handle requests from multiple
web users. This model is more complicated than the InProc model, since your application must
manage the state of the MapXtreme Session for each user. However, this is a more efficient use of
system resources. Use this model to build scalable applications. See State Management For
Pooled Objects on page 115.
State Management - A general term in web application development that deals with saving and
restoring information from a browser session.
Background map - The initial map(s) that is pre-loaded with the web application as defined in the
Web.config file. This map contains reference layers, such as street networks and postal boundaries,
as well as application-specific data such as store locations or cell towers. This base workspace will
be pre-loaded in MapXtreme Session instances and will be available unless the application allows
the user to change the base maps. See What Should the Initial Map Look Like? on page 111.
MapXtreme v7.1
103
Developer Guide
New user to site, the available MapXtreme Session instance from the pool is clean, with the
background map in its initial state.
New user to site, the available MapXtreme Session instance from the pool is dirty (map has
changes from another user)
Returning user, the available MapXtreme Session instance from the pool is clean.
Returning user, the available MapXtreme Session instance from the pool is dirty (map has
changes from this or another user)
MapXtreme v7.1
InProc - user state is stored in memory for the lifetime of the ASP.NET Session.
StateServer - user state is saved on the server so user changes can be retrieved at a later
time.
SQLServer - user state is saved to an SQL Server database for later access.
104
Developer Guide
You can use InProc state management, which is easy to code; however, it is not appropriate for
all applications because it taxes server resources.
You can use a Pooled architecture with automatic state management. This model is easy to
code, but the resulting application may not be fast enough, depending on your needs.
You can use a Pooled architecture with manual state management. This model requires more
coding on your part. You must write code to save and restore the appropriate MapXtreme
Session objects that comprise the user's state. However, this model produces the most scalable
applications, so it is the best choice for applications that have large numbers of users.
Thus, there are trade-offs associated with each option. You must consider many factors when
designing web applications using MapXtreme. Some factors are MapXtreme design decisions and
others are Microsoft technology design patterns. This chapter will walk you through some of the
decisions you must make and show you how to make the correct choices for your type of
application.
It is strongly recommended that you think about state management before you write your web
application. The type of state management that you choose will affect how your write your
application. If you write a web application, and then later decide to adopt a different type of state
management, you may need to rewrite significant parts of your application.
105
Developer Guide
106
Developer Guide
All of these operations can be supported in a mapping application. However, if you decide to
implement a web application using a pooled model, you should be aware that pooled applications
need to include code that carefully saves and restores all changes the user has made to the map.
For example, if your web application allows users to place annotations on the map, then you will
need to write code to save each user's custom annotations, and then write code to restore that
user's custom annotations with each subsequent request.
If your application uses the pooled model with manual state management, then your state
management code will grow more complex as you add more and more features that allow the user
to modify the map. As you consider features that allow the user to modify the map in various ways,
remember to set aside time for the development and testing of your state management code as well.
MapXtreme v7.1
107
Developer Guide
MapXtreme v7.1
108
Developer Guide
MapXtreme v7.1
109
Developer Guide
What is Pooling?
In the pooled model, your application creates a finite number of MapXtreme Session objects on the
server. Each one of those object instances is then shared within the application and re-used; each
MapXtreme Session handles requests from multiple users, as illustrated in the following diagram.
MapXtreme v7.1
110
Developer Guide
Improves overall response time for web applications by running several ASP.NET requests
concurrently.
Conserves resources by reducing the number of concurrent MapXtreme Session instances.
Maximizes CPU utilization by reducing the number of requests running at the same time (and
reducing thread context switching). This is particularly useful when requests are CPU intensive
(for example, Map image exports). The general recommendation is to have a pool size of 1-2
session instances per CPU.
However, a pooled application can make an application more complicated. MapXtreme Sessions
(and their maps) are shared and re-used; therefore, you need to take steps to ensure that each Map
is re-set to an appropriate state each time your application handles a client request.
For example, suppose a client requests a map of Germany. You cannot simply fetch a MapXtreme
Session from the pool and then use its Map to render an image, because there is no guarantee that
particular map is zoomed in on Germany. The Map that services the request must be set to an
appropriate, known state. As the application developer, you must manage the state of the object to
ensure that the object is in an appropriate state before you use it to service the current request.
MapXtreme v7.1
111
Developer Guide
MapXtreme v7.1
112
Developer Guide
Clean *
Dirty
Clean *
Dirty
MapXtreme Session and its background map are in their initial state.
MapXtreme Session and/or its background map contain another user's changes.
MapXtreme v7.1
113
Developer Guide
For pooled objects and automatic state management, set Pooled to true, and set State to
HttpSessionState.
For pooled objects and manual state management, set Pooled to true, and set State to Manual.
Place the logic that determines the users current state into the Page_Load method. See
Implementing a StateManager on page 122.
MapXtreme v7.1
114
Developer Guide
User State
Your application must now consider the user's current state and the state of the MapXtreme Session
object when it was retrieved from the pool. In this situation you will have to decide:
Do you return the pooled object clean to the pool in your SaveState method?
Do you let go of the pooled object and then restore any state in the RestoreState method?
The correct choice here is not always clear since many variables about the difference in state from
one user to another may lead you to leave the session object dirty prior to releasing it back to the
pool. Another application may save time by waiting for the Page_Load to clean up or to check if the
Session needs cleaning.
The example in the section Manual State Management: A Walk-Through on page 118 followed
the second option here: to clean up the pooled object in the RestoreState method.
The next section provides more information on how to save and restore state.
MapXtreme v7.1
115
Developer Guide
Options on the web form allow the user to create various types of thematic shading on the map.
These themes modify the appearance of regions (country boundaries) in the table world.tab. The
attribute data for the themes comes from a Microsoft Access database, eworld.mdb (included within
the Visual Studio project).
In this sample, the world.mws workspace file is pre-loaded when the MapXtreme Session is created;
however, the columns from eworld are added later, when a client accesses the application.
To get better performance, put attribute column information into a workspace file, so that all
needed data will be pre-loaded at the MapInfo Session creation time.
Application Settings
First let's take a look at the parts of the Web.config file that contain relevant application settings.
Near the top of the Web.config file you will find these settings:
<configuration>
<appSettings>
<!--Use this setting to turn Session pooling on/off (true/false)-->
<add key="MapInfo.Engine.Session.Pooled" value="true" />
<!--Use this setting to save Session state automatically
(HttpSessionState) or manually (Manual)-->
<add key="MapInfo.Engine.Session.State" value="Manual" />
<!--Use this setting to preload a workspace on Session creation-->
<add key="MapInfo.Engine.Session.Workspace" value="c:\Program
Files\MapInfo\MapXtreme\7.x.x\Samples\Data\World.mws" />
The settings are explained below:
MapXtreme v7.1
116
Developer Guide
Farther down in the Web.config file, you will find this setting:
<sessionState mode="StateServer"
stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data
source=127.0.0.1;user id=sa;password=" cookieless="false" timeout="20" />
This indicates how you wish to save state; in this case, to the StateServer where the information can
be retrieved at a later time. You can also set this to SQLServer, where state is saved to a database.
Implementing a StateManager
The Thematic sample application uses manual state management, which means it requires an
implementation of a StateManager class to save and restore the appropriate MapXtreme Session
changes.
This class inherits from the abstract base class MapInfo.WebControls.StateManager and must
implement the following methods:
Public Overrides Sub RestoreState()
Public Overrides Sub SaveState()
If you use the " template to create a new web site in Visual Studio, the resulting project
includes an implementation of the StateManager, called AppStateManager.
The exact contents of the AppStateManager class vary from application to application. The more
options your application provides, allowing the user to customize the map, the more code you need
to add to the AppStateManager, to save and restore those customizations. This is why the
AppStateManager that is provided with the Thematics sample application contains more code than
the AppStateManager that you get when you create a new project from the MapXtreme Web Site
template.
For example, the thematic sample handles customizations to theme layers, theme tables, attribute
tables, and a group layer. The web template, in contrast, has code to handle customizations to
layers and selections.
MapXtreme v7.1
117
Developer Guide
MapXtreme v7.1
118
Developer Guide
MapXtreme v7.1
119
Developer Guide
Use the ManualSerializer class to carry out saving and restoring objects. Do not store
MapXtreme objects directly into the HttpSessionState using syntax such as:
HttpContext.Current.Session.Item("myTable") = _
MapInfo.Engine.Session.Current.Catalog("myTable")
120
Developer Guide
This Page_Unload method will not get called if you use Server.Transfer or
Response.Redirect with endResponse flag as true, because those methods will ignore this
event handler. You could explicitly invoke
MapInfo.WebControls.StateManager.GetStateManagerFromSession().SaveState() before
processing Server.Transfer or Response.Redirect with endResponse flag as true to work
around this issue.
MapXtreme v7.1
121
Developer Guide
MapXtreme v7.1
122
Developer Guide
Further Reading
The MapXtreme Session is highly configurable and is designed to work in conjunction with Microsoft
COM+ and web technologies. To better understand how best to use this, you need to understand the
Microsoft web delivery architecture. There are many places to get more information on the topics
listed above. Here are some links to very good information on web architecture:
COM+ pooling
IIS 7.0
IIS 6.0
MapXtreme v7.1
123
Developer Guide
Desktop Applications,
Controls, Dialogs, and
Tools
This chapter provides information on planning a desktop application, as well as,
an overview of the myriad desktop controls, dialogs, and tools available in
MapXtreme.
In this chapter:
MapXtreme v7.1
125
Developer Guide
MapInfo.Windows.Controls Namespace
The MapInfo.Windows.Controls namespace contains classes that implement controls in desktop
applications. The use of Windows controls is quite simple as you drop the desired controls onto your
form and use the various properties to configure them to your specifications. You will find that the
controls in this namespace are similar to controls found in the MapInfo.WebControls namespace.
MapXtreme v7.1
126
Developer Guide
Some controls do not display at design time. When dragged and dropped onto a form they
merely appear as a rectangle. These controls display properly at run time.
The desktop controls included with MapXtreme can be categorized into standard controls and
map-specific controls. Standard controls include buttons, view tools, label tools, all kinds of boxes,
etc. These are quite similar to (and in many cases, inherited from) classes that exist within the
System.Windows.Forms namespace.
The map-specific controls are specific to Pitney Bowes Softwares mapping implementations. These
include controls that set or modify aspects of object styles, labels, layers, coordinate systems,
themes, and other related functions.
Visual Studio Toolbox and Designer showing the list of available MapXtreme controls.
The most complex of the controls is the Layer Control, which is available as either a modal Dialog
Box, or as a control that you can display directly on your form. The Layer Control has an API that
allows extensive customization; see the LayerControlDemo sample application for examples.
MapXtreme v7.1
127
Developer Guide
If you are not creating your project from one of our templates, please make sure to add
references to the appropriate components (for example, MapInfo.CoreEngine,
MapInfo.Windows, MapInfo.Windows.Dialogs, and MapInfo.Windows.Framework). See also
MapXtreme Merge Modules.
MapControl
The MapControl is necessary for every application that displays a map. To add a MapControl to your
form, drag it onto your form from the toolbox in Visual Studio. Once the MapControl is on your form
there are several operations you can perform on it to make your map more useful to the user.
Modifications to the MapControl can be performed via the Properties Window when the MapControl
is selected on your form. Right-click on the MapControl in design-mode to display a context menu
with the following choices: Load Map, Clear Map, Layer Control, and Create Thematic. Load Map
opens a standard file chooser from which the developer can choose a map to preload into the
MapControl. Clear Map clears any map already in the control, either when adding the MapControl to
the form or somewhere in the middle of the design process. Layer Control launches a Layer Control
dialog box that allows you to customize the map (see Layer Control). Create Thematic launches
the CreateThemeWizard (see CreateThemeWizard) allowing you to create a theme on the map.
MapXtreme v7.1
128
Developer Guide
MapToolStripButtons
MapXtreme provides ready-to-use map tools in its Windows Form templates and in the Visual Studio
designer toolbox. Tools are added to the form by adding a ToolStripButton to a .NET ToolStrip.
The properties for each tool is set on the button. The MapToolBar, which had been responsible for
managing the current tool is no longer required. The MapToolBar has been retained for backward
compatibility and future use if you choose. It is still provided in the Visual Studio toolbox.
The 22 ToolStripButtons include the same mapping activities that have always been available in the
MapToolBar, including navigation, selections, adding features, labeling, opening tables and
displaying a layer control.
MapXtreme v7.1
129
Developer Guide
All but two of the ToolStripButtons can be added to a ToolStrip or StatusStrip. The tools that display
the zoom level and scale of the current map view, can only be added to the StatusStrip.
To add a new ToolStripButton, in Visual Studio choose the ToolStrip from the toolbox under Menus
and Toolbars. A split button appears on the form displaying a small down arrow. Click the arrow to
display the list supported ToolStripButtons and choose what you need. Once added to the
MapControl, the tool is immediately associated with it.
The API for the ToolStripButtons is contained in the MapInfo.Windows.Controls namespace. The
abstract base class from which all the ToolStripButtons are derived is the
MapInfo.Windows.Controls.MapToolStripButtonBase, which in turn was inherited from the .Net
System.Windows.Controls.ToolsStripButton class.
For information on how to use the ToolStripButtons programmatically, view the code in the MapForm
template and visit the Developer Reference. For information on the behaviors of each tool, see the
individual MapTool classes in MapInfo.Tools namespace.
The MapToolBar
Beginning with version 7.0, the MapToolBar has been replaced in the MapForm template by a
ToolStrip. See MapToolStripButtons. The MapToolBar is still available in the Visual Studio toolbox.
This section outlines instructions on how to add a MapToolBar to a MapForm.
The MapToolBar combines several of the map tool controls (e.g., zoom in, open table) into a single
control. The default collection of tools includes: OpenTable, LayerControl, Select, ZoomIn,
ZoomOut, Pan, and Center.
To add a MapToolBar to your MapForm, drag it from the Visual Studio toolbox. (The MapToolBar is
no longer provided in the MapForm templates.)
MapXtreme v7.1
130
Developer Guide
If you would like to add a customized tool you need to click on the arrow next to the Add
button and choose ToolBarButton. You need to write a customized handler for the new
button.
MapXtreme v7.1
131
Developer Guide
5. Click OK.
The MapToolBarButton is now created and added to the button bar. The newly added tool works
in the default manner.
MapXtreme v7.1
132
Developer Guide
Layer Control
The Layer Control dialog box shows all the layers that make up the current map and the status of the
layers attributes. These attributes are: visible, editable, selectable, and auto label. The icons above
each check box column represent the attributes types. ToolTips display over the attribute icons when
you move your cursor over them to help familiarize yourself with each icon. It is easy to change a
layers, or multiple layers attributes using the check boxes.
The Layer Control also has options available to change the Display and Label settings; modify any
thematic maps you have created, and reorder, add, or remove layers.
You can rearrange layers in the LayerControl by dragging and dropping them in the Layer Control
Layers list.
Dropping a layer onto a Label Layer adds a new set of labels to the Label Layer. This can
happen by accidentfor example, if you were attempting to move a layer to the spot just
above the Label Layer.
Tip: If you want the dropped layer to be placed outside of the Label Layer, hold down the
Shift key before you drop the layer. As you press and release the Shift key, the cursor
changes to indicate whether the dropped layer will go above or inside the target layer onto
which you are dropping.
The Layer Control puts all the functionality of the Layer Control dialog box onto a form. A single line
of code is necessary in the Form_Load() method to link the Layer Control to the MapControls map.
layerControl1.Map = mapControl1.Map;
To better understand the complexities and capabilities of the Layer Control, run the MapXtreme
utility called Workspace Manager. This tool includes a working example of Layer Control. See
Chapter 23 Workspace Manager. Workspace Manager is available from the Program Menu under
MapInfo\MapXtreme\7.x.x.
MapXtreme v7.1
133
Developer Guide
MapInfo.Windows.Dialogs Namespace
The MapInfo.Windows.Dialogs namespace contains classes that create dialog boxes with specific
functions. Contrary to controls, dialog boxes are not visible during design-time and can only be
created and configured in code. You can create your own customized dialog boxes using classes
from the MapInfo.Windows.Dialogs namespace and then utilize them by calling the
System.Windows.Forms.Form.ShowDialog() method.
The stock dialogs are built from the MapXtreme object models public API. There are no hidden
internal fields or anything private. You can use these dialogs or customize them for your needs, or
write your own from scratch. You may wish to provide fewer controls on a stock dialog so that your
users are restricted from changing some behavior.
To use a particular dialog box in your application, add the MapInfo.Windows.Dialogs namespace to
your code as follows:
using MapInfo.Windows.Dialogs
private void DoLayerControl()
{
LayerControlDlg layerControl = new LayerControlDlg();
layerControl.Map = mapControl1.Map;
layerControl.ShowDialog(this);
}
The code above displays the LayerControl dialog box when the DoLayerControl() method is called.
MapXtreme v7.1
134
Developer Guide
Stock Dialogs
MapXtreme ships with many stock dialogs and controls to handle tasks of manipulating the
MapXtreme objects. All the dialogs and controls used in Workspace Manager are available for use in
your application. The dialogs are simply containers for the low level controls. These controls are
designed to work specifically with many of the MapXtreme objects.
The controls that ship with MapXtreme are used by the stock dialogs to create the basic UI
components. The controls are placed in dialogs to create specific UI components. You can, in the
same way, use the base controls to design your own dialogs. Simply create a dialog class and start
dragging the controls onto the surface to create your dialog.
The stock dialogs also can be customized through visual inheritance. You can derive a class from
our dialogs and customize some of the behaviors by overriding methods and properties. Other
dialogs such as the Layer Control are customizable, so you can change the default behavior to hide
controls you don't want users to access, change the look of the icons, or remove tabs.
Basically you have control over all the UI components that ship with MapXtreme. This allows you to
create your own custom interface. Using any of the methods described allows you to create a
customized desktop application that exposes only what you need rather than everything MapXtreme
defines.
CreateThemeWizard
The CreateThemeWizard class is a convenience class that you can add to your application. This
class is used to guide the user through the process of creating a new theme by launching a wizard (a
set of dialog boxes). There are three basic steps to creating a theme: 1) Select the theme type; 2)
Select the table and columns to use for the theme; and 3) Modify the theme attributes (style, number
of ranges, etc.). The wizard ties all these settings together into a sequence of dialog boxes to make
theme creation as simple as possible for the end users of MapXtreme applications.
MapXtreme v7.1
135
Developer Guide
MapXtreme v7.1
136
Developer Guide
MapXtreme v7.1
137
Developer Guide
Create Theme: Step 3 of 3 dialog box (Ranged Theme) After Settings Change
Programmatic checks look for changes in the values of the Settings tab and if the theme bins need
to be recomputed after:
The CreateThemeWizard is accessible from many different places at design time and at runtime,
depending on the controls in your application. At design-time the CreateThemeWizard can be
accessed from the menu at the bottom of the MapControl properties window and also from the Layer
Control by right-clicking on a layer and choosing Add Theme.
MapXtreme v7.1
138
Developer Guide
139
Developer Guide
MapXtreme v7.1
140
Developer Guide
Tools are ultimately derived from the MapTool class. Select and Add tools are derived from the
SelectMapTool and AddMapTool classes, respectively.
The Tools included in this namespace can be divided into four categories: View tools, Select tools,
Add tools and Custom tools.
Within the Add, Custom and Select tool categories are tools for drawing or selecting these geometric
objects: Ellipse, Arc, Circle, Rectangle, Polygon, Point, Line, and Polyline.
All of the tools have properties associated with them which implement three interfaces:
IMapToolProperties, ISelectMapToolProperties, and IAddMapToolProperties.
MapXtreme v7.1
141
Developer Guide
View Tools
The View tools (ZoomMapTool, CenterMapTool, and PanMapTool) change the view of the map
accordingly to the tool being used. These tools are part of the default tool collection. If you begin
building your desktop applications with a MapXtreme template, these tools will appear on the default
toolbar.
The LabelMapTool allows you to label features on the map. This tool is not included in the default
tool collection. on the MapForm template. To add it to the MapControl, first add a ToolStrip from the
Visual Studio Toolbox, right-click on the context menu item LabelToolStripButton.
To add it. click on the Collections ... button under the Buttons property of the MapToolBar.
Select Tools
The Select family of tools (SelectMapTool, SelectPointMapTool, SelectPolygonMapTool,
SelectRadiusMapTool, SelectRectMapTool, and SelectRegionMapTool) select points and regions
that fall within the geometric object shaped by the use of these tools. For example, the
SelectRectMapTool selects objects that fall within the rectangle. SelectMapTool is the abstract base
class that the other select tools derive from.
MapXtreme does not support the intersection of an object with a polyline, hence there is no
select polyline tool.
MapXtreme v7.1
142
Developer Guide
Add Tools
The Add family of tools (AddArcMapTool, AddCircleMapTool, AddEllipseMapTool, AddLineMapTool,
AddPointMapTool, AddPolygonMapTool, AddPolylineMapTool, and AddRectangleMapTool) are all
based on the AddMapTool class. The Add tools allows you to draw a particular geometric object on
your map. In order to add an object to a map, you must have an active insertion layer in your map
where the object resides after it is created. The size and shape of the particular object depends on
the tool used and can be constrained through the use of the modifier keys (Shift and Ctrl) while the
tool is being used.
For more information on Add tool properties see MapInfo.Tools.MapTool.IAddMapToolProperties in
the MapXtreme Developer Reference Help.
Custom Tools
The Custom tools (CustomArcMapTool, CustomCircleMapTool, CustomEllipseMapTool,
CustomLineMapTool, CustomPointMapTool, CustomPolygonMapTool, CustomPolylineMapTool, and
CustomRectangleMapTool) are very basic tools that only fire events. Use these classes to design
custom behaviors for specific tools. For example, you can use the CustomEllipseMapTool to draw
green Ellipses with a red outline every time the tools is used. Use the various tool events (see Tool
Events on page 155) to specify particular behaviors to respond to specific events generated by the
tools.
Custom tools are not included in the default tools collection. If you wish to assign a custom tool to a
mouse button, you may provide any string you wish to identify the tool.
For more on customizing tools, see Customizing Tools on page 154.
MapXtreme v7.1
143
Developer Guide
Shape Tools
MapXtreme provides a group of tools for drawing geometric features on your map. Most of these
tools are used by click-and-drag. As you click and then drag to another location on your map, a
rubber-band image is displayed showing the current size and shape of the object being drawn. Each
of these tools uses the Esc key to cancel the current operation (if appropriate).
The following are types of shape tools MapXtreme supports.
Line Tools
The tools included in this group are AddLineMapTool and CustomLineMapTool. These tools draw a
Line. The tool is activated by clicking and dragging from the beginning point to the end point.
Releasing the mouse button creates the Line. If the Shift key is pressed while dragging, the angle of
the Line is constrained to multiples of 45. If the Ctrl key is pressed while dragging, the line doubles
in length and height. Pressing Esc before releasing the mouse cancels the operation.
Polyline Tools
The tools included in this group are AddPolylineMapTool and CustomPolylineMapTool. These tools
draw a Line with multiple segments. The tool is activated by clicking on a point and then clicking on
a subsequent point. When you are done clicking on points, click again on the last point and the
Polyline is drawn. If the Shift key is pressed while dragging, the angle of the Line is constrained to
multiples of 45. The Ctrl key has no effect on this tool. Pressing Esc before completing the line,
cancels the operation.
Circle Tools
The tools included in this group are AddCircleMapTool and CustomCircleMapTool. The Circle tools
draw a Circle. This is equivalent to using the Ellipse tool while holding down the Shift key. The tool is
activated by clicking and dragging from the center point of the Circle center to a point on the
perimeter. As you drag, you will see the size of the Circle expand around that center point. Releasing
MapXtreme v7.1
144
Developer Guide
Rectangle Tools
The tools included in this group are AddRectangleMapTool and CustomRectangleMapTool. These
tools draw a Rectangle. The tool is activated by clicking and dragging from one corner to the
opposite corner. Releasing the mouse button creates the Rectangle. Note that the drawn object is
always axis-aligned. If the Shift key is pressed while dragging, the Rectangle is constrained to a
square. If the Ctrl key is pressed while dragging, the Rectangle is drawn with the starting point in the
center. Pressing the Esc key before releasing the mouse cancels the operation.
Using InfoTips
An InfoTip is a small text box that can appear when the mouse hovers over a map feature. A map is
associated with an instance of MapInfo.Tools.MapTools, which contains all the tools (instances of
MapInfo.Tools.MapTool) that can be used on the map.
The MapInfo.Tools.MapTools class has three properties that control the appearance of InfoTips.
They are:
Note that as long as the mouse is moving, InfoTips will not appear. An InfoTip will only appear when
the mouse is over a feature with a label and has been idle for at least the interval specified by
InfoTipTimerDelay. The InfoTip will disappear when the mouse is moved or when the mouse has
been idle for longer than the time specified by the InfoTipDisplayDelay provided that time is greater
than zero.
You can prevent InfoTips from being displayed at all with:
mapControl1.Tools.InfoTipsEnabled = false;
You can set the delay before an InfoTip is displayed to one second with:
mapControl1.Tools.InfoTipTimerDelay = 1000;
You can set the length of time an InfoTip is displayed even though the mouse remains idle to 2.5
seconds with:
mapControl1.Tools.InfoTipDisplayDelay = 2500;
See the MapInfo.Tools.MapTools class in the MapXtreme Developer Reference for more information
on using InfoTips in the API.
MapXtreme v7.1
145
Developer Guide
Customizing Tools
Tools for desktop applications can be customized in two ways: by creating a subclass of an existing
tool, or by using one of the tools in the Custom Tools group. Any of the Tool classes provided in
MapXtreme can be customized by creating a subclass derived from the desired particular Tool class.
An example of this is deriving a new tool class from the AddLineTool class. The tool could be
changed to a particular behavior (e.g., always beep when line is drawn), a particular appearance
(e.g., always draw the line in red), or to a particular functionality (e.g., always constrain line drawing
to 90 degree increments).
Another example would be to create two different tools based upon the same tool. The AddPointTool
could be used to subclass two other tools that each use different symbols for indicating two kinds of
points on a map. Assign one tool to the left mouse button and assign the other to the right mouse
button.
The following code example illustrates a customization of the AddPolygonTool.
VB example:
Dim
Dim
Dim
Dim
insertionlayerfilter As IMapLayerFilter
style As MapInfo.Styles.CompositeStyle
addmaptoolproperties As MapInfo.Tools.AddMapToolProperties
maptool As MapInfo.Tools.MapTool
insertionlayerfilter = _
MapLayerFilterFactory.FilterByLayerType(LayerType.Normal)
style = New MapInfo.Styles.CompositeStyle
addmaptoolproperties = New _
MapInfo.Tools.AddMapToolProperties(MapLayerFilterFactory.Filter_
ForTools(MapControl1.Map, insertionlayerfilter, _
MapLayerFilterFactory.FilterVisibleLayers(True), _
"CustomPolygonAddMapToolProperties", Nothing), style)
maptool = New MapInfo.Tools.AddMapTool(MapControl1.Viewer, _
MapControl1.Handle.ToInt32(), MapControl1.Tools, New _
MapInfo.Tools.MouseToolProperties(Cursors.Default, _
Cursors.Default Cursors.Default),_
MapControl1.Tools.MapToolProperties, addmaptoolproperties)
Additionally, MapXtreme ships with a desktop tools sample application that you can analyze the
implementation and customize it for your needs. See
..\MapInfo\MapXtreme\7.x.x\Samples\Desktop\Features\DesktopTools\cs under your installation of
MapXtreme.
MapXtreme v7.1
146
Developer Guide
Tool Events
The MapInfo.Tools namespace supports tool events with information and the ability to cancel the
tools operation. A Select Tools event lists the items being selected or deselected. Events can be
fired at every stage of use of a particular tool. In your code you can trap certain moments in the
lifecycle of the usage of a tool. Adding code to particular events gives you the maximum flexibility on
customizing the use of each tool in your mapping application.
The events in the namespace are as follows:
MapXtreme v7.1
FeatureAddingEventArgs
FeatureAddedEventArgs
FeatureSelectingEventArgs
FeatureSelectedEventArgs
FeatureChangingEventArgs
FeatureChangedEventArgs
NodeChangedEventArgs
NodeChangingEventArgs
ToolActivatedEventArgs
ToolActivatingEventArgs
ToolEndingEventArgs
ToolUsedEventArgs
147
Developer Guide
Reshaping a Feature
1. Load a map into the MapControl and zoom in on the Feature you wish to modify.
4. On the Options tab, select the Selectable and Editable check boxes.
MapXtreme v7.1
148
Developer Guide
6. On the Editing tab, select Allow Node Editing from the Editing mode combo box.
7. Click OK to accept your changes. The map display will change and display the object's nodes.
MapXtreme v7.1
149
Developer Guide
Adding Nodes
To add nodes to a Feature Geometry:
1. Open the LayerControl again and select the root node of the map.
2. On the Editing tab, select Allow node adding from the Editing Mode combo box.
MapXtreme v7.1
150
Developer Guide
6. On the Options tab, select the Selectable and Editable check boxes.
MapXtreme v7.1
151
Developer Guide
The MapInfo.Data namespace contains the classes and interfaces that provide
multiple ways of accessing data from a MapXtreme application.
In this chapter:
This chapter is organized to follow the MapXtreme Data Access Model diagram above, and includes
these topics:
Data access is central to any MapXtreme application, and covers a wide variety of topics. Within the
topics listed above are other important topics of information that should not be overlooked.
MapXtreme v7.1
160
Developer Guide
Tables
The Table class is the basic unit of all data access. Table, Column, and all TAB file metadata
information is accessible from a MapInfo Table. Tables may be mappable (contain a column of type
FeatureGeometry) or non-mappable. Tables also may be open and accessed without displaying a
map.
Table Aliases
When tables are opened, they can be assigned a name (or alias) which is used while the table is
open for referencing the table. For example, the table may be referred to by its alias in SQL
statements. A table that is opened from a TAB file is assigned a default alias if no alias is specified.
The default alias is based upon the name of the TAB file. This property is optional and may be set to
null. However, it is good practice to assign an alias.
Columns
A Column object identifies the properties of a column in a table, feature, or feature collection and
specifies the column's name (alias), data type, width (for string and decimal columns), and other
properties of the column.
MapXtreme v7.1
161
Developer Guide
Description
Int
Provides a 32-bit signed integer. This maps to the .NET Framework datatype
Int32.
SmallInt
Provides a 16-bit signed integer. This maps to the .NET Framework datatype
Int16.
Double
A floating point number within the range of -1.79E +308 through 1.79E +308.
This maps to Double.
dBaseDecimal
Boolean
String
Date *
DateTime *
Provides a combined date and time value. The DateTime type is mapped to
System.DateTime.
Time
Provides a time value. Supports the Time type in MapInfo Professional tables
(TAB files) version 9.0 and later. The Time type is implemented as a structure
in the MapInfo.Data namespace.
FeatureGeometry
Provides a FeatureGeometry.
Binary
Key
Provides a key from a table. This is the data type of the Key pseudo column
on a Table.
CoordSys
Provides a coordinate system. This type exists only for the purposes of
binding a coordinate system object to an MICommand for functions which
require the specification of a coordinate system.
Style
Raster
Provides a RasterInfo from table's raster column. This is the data type of the
RasterInfo object stored in raster column on a Table.
MapXtreme v7.1
162
Developer Guide
Description
Grid
A GridInfo from table's grid column. This is the data type of the GridInfo object
stored in grid column on a Table.
Wms
Provides a WmsClient from the table's Wms column. This is the data type of
the WmsClient object stored in the Wms column on a Table.
Mem tables
Native tables (TAB files)
ADO.NET
Oracle via OCI
MS SQL Server via ODBC
The ASCII and dBase, and Microsoft Access data sources are not supported.
Date and DateTime Support in Remote Databases
Remote databases may not support all the data types that MapXtreme supports. The table below
shows the date and time-based types supported in native TAB files and in each supported database.
MapXtreme
Native TAB
Files
Date
Date
Time
Time
DateTime
DateTime
MapXtreme v7.1
ADO.NET
Oracle (OCI)
MS SQL
Server
Date
DateTime
DateTime
163
DateTime
Developer Guide
MapXtreme 6.7.x
Return Column Type / Value
MapXtreme 6.8.0 *
Return Column Type / Value
SQL Server/DateTime
Date/System.DateTime
DateTime/System.DateTime
Oracle/TimeStamp
Date/System.DateTime
DateTime/System.DateTime
Oracle/Date
Date/System.DateTime
Date/MapInfo.Data.Date
The following sections provide you with MI_Key, MI_Geometry, and MI_Style column information.
MI_Key
All tables have a pseudo column named MI_Key which returns instances of Key. The MI_Key
pseudo column is similar in concept to the rowid pseudo column in MapInfo Professional and
MapBasic. Unlike rowid, this column is not a numeric column. A Key instance may be converted to
or from a string literal.
MI_Geometry
A Geometry column object in a table, feature, or feature collection contains FeatureGeometry
objects and specifies properties such as the coordinate system of the column and the entire bounds
of all the geometry objects it contains.
Geometry columns for most table types are given the name Obj. To be compatible with previous
versions of MapX and MapInfo Professional, the alias Obj is resolved to the first GeometryColumn
in the table. Additionally, the alias MI_Geometry may also be used for any table to refer to the
same column that Obj refers to.
MI_Style
Tables with a Geometry column also have a column with the name MI_Style, or if not found, from
the first column with type MIDbType.Style. This column is used to hold the style information for
Geometry objects such as line width for polygons and symbol size for points. This column cannot be
updated independently. The Style and Geometry columns must be updated at the same time.
The MI_Style column is created automatically when you are opening a table in MapInfo native format
(.TAB). For all other table types, you must specifically create the column. If you use
MapInfo.Data.ColumnFactory.CreateStyleColumn it will create a column with the name (alias) of
"MI_Style" and a data type of MIDbType.Style.
When using MISQL to insert rows into a table, be sure to include the MI_Style column in the insert
statement. See the code example below:
MapXtreme v7.1
164
Developer Guide
Catalog
The Catalog is essentially the manager of the MapXtreme data access model. The Catalog holds a
list of tables that are currently open in the MapXtreme Session. Tables are also opened, created and
closed from the Catalog. The Catalog can be thought of as a single database holding all the tables
opened in it, regardless of their actual data source.
Each MapXtreme Session manages a single Catalog.
Catalog initially contains no tables. When a table is opened, an alias (or name) is assigned to the
table or provided by the caller. The alias is used to identify the table in queries and other operations.
Tables can be mappable (contain a spatial component) or be non-mappable and contain only data
columns. The MapXtreme Catalog can open both types and use either in queries and joins.
Catalog provides facilities for creating new table definitions and enumerating through tables which
are currently opened. Catalog also contains search methods that can be used to access data in
open tables.
The Catalog has an SQL engine that allows you to select, insert, update, and delete tables and data
within tables. The SQL engine allows you to join any tables defined in the catalog (for example,
Native to SQLServer, or SQLServer to Oracle). The Catalog handles the integration from various
sources so you dont have to. This is a powerful tool when organizing data from various sources.
The MapXtreme Catalog is exposed through the MapInfo ADO.NET Data Provider. Access to tables
and result sets is controlled through this interface. See MapInfo ADO.NET Data Provider.
Code Sample
The following example illustrates how to access the Catalog off the MapXtreme Session object,
open some tables and enumerate through all the tables in the Catalog followed by only the editable
tables in the Catalog.
MapXtreme v7.1
165
Developer Guide
dBase
MapXtreme v7.1
166
Developer Guide
Data stored in a delimited .CSV or text file. The maximum string length is
255 characters (including up to two quotation marks). ASCII tables are
Insert only.
The table may have an associated .MAP file containing FeatureGeometry
and Style information. Non-spatial data is stored in a .CSV or .TXT file.
MS Access
Shapefile
MemTable
RDBMS Server
MapXtreme v7.1
167
Developer Guide
Raster
Grid
WMS
Seamless
A table that combines two or more base tables with contiguous geography.
It displays as a single map layer.
Seamless tables are specifically tuned for spatial queries, such as drawing
a map, which uses seamless tables for optimally querying appropriate
component tables. Component tables that make up a seamless table may
be vector or raster. They must all have the same schema. They are readonly. The underlying component tables cannot be modified directly. Sorting
and aggregating operations examine every record of every component
tables (could be have a significant performance impact when working with
vector tables.)
MapXtreme v7.1
168
Developer Guide
ResultSet
Catalog.GetTable
The MapInfo.Data.Catalog.GetTable method returns the Table object referenced by the TableAlias
parameter. This must be a table which has already been opened. If no such table is found (or the
table has subsequently been closed), then the method returns null.
Catalog.Item (Indexer)
MapInfo.Data.Catalog.Item property can be used as an indexer for locating a Table by its Alias. This
is functionally equivalent to using the Catalog.GetTable method but generates code that is easier to
read. The Alias must specify a table which has already been opened.
VB example:
Public Shared Sub MapInfo_Data_Catalog2()
Dim tbl As Table
For Each tbl In Session.Current.Catalog
System.Console.WriteLine("Table: " + tbl.Alias)
Next
End Sub
MapXtreme v7.1
169
Developer Guide
TableEnumerators
Table enumerators may be obtained through the various overloaded EnumerateTables methods. A
table enumerator may be created with a filter. The filter determines which tables are actually
included in the enumeration while the enumerator simply provides the mechanics of enumeration.
You can create your own table filters to use in the TableEnumerator. You can also create your own
table enumerator by implementing the ITableEnumerator interface.
VB example:
Public Shared Sub MapInfo_Data_Catalog3(ByVal catalog As Catalog)
Dim te As ITableEnumerator = _
catalog.EnumerateTables(TableFilterFactory.FilterEditableTables())
While te.MoveNext()
Dim tbl As Table = te.Current
End While
End Sub
Closing a Table
Three methods are available to close tables. MapInfo.Data.Catalog.CloseAll closes all open tables
while Catalog.CloseTable closes a single, open table. The Table class also has a Close method.
Packing a Table
The MapInfo.Data.Table.Pack method removes records from the table that were previously marked
for deletion. When the table is packed, the table's TablePacked event is raised. The arguments for
the event indicate whether or not the table's keys changed as a result of the pack (which would be
caused by removing deleted records). Keys only change if the PackType includes
RemoveDeletedRecords and if there actually were deleted records in the middle of the table. If the
only deleted records in the table are at the end of the table, then no keys are changed. The event
does not indicate that keys were changed.
Since ResultSet tables hold collections of keys, these are vulnerable to pack operations on
the table from which they were derived. The ResultSet is no longer valid if the keys have
changed.
PackGeometry Indicates that the geometry objects are packed. Packing the objects attempts
to remove as much unused space as possible. A fully packed RTree (the spatial index used to
spatially access the geometry objects) may reduce performance by causing many more
unnecessary reads. To balance disk space and processing speed, packing the geometry objects
may continue to leave some unused space in the RTree. Also note: a packed RTree results in a
slight performance penalty for insert and update operations as there is a higher likelihood that
the RTree needs to be expanded.
MapXtreme v7.1
170
Developer Guide
RebuildGeometry Rebuilding the geometry objects removes unused space that has resulted
from a series of insert, update, and/or delete operations. Unlike packing the geometry objects,
this option intentionally leaves unused space in the RTree index to improve the performance of
future insert and update operations.
PackIndex Non-spatial indices are maintained as B*trees. These structures do not always
have filled internal or leaf nodes. This is intentional by default to allow room for the index to
accommodate insert and update operations without requiring a significant restructuring of the
index. The unused space may be exacerbated by the occurrence of insert, update, or delete
operations. Packing an index fully packs every internal and leaf node (except possibly the last
node). This option reduces the disk space used by the index as much as possible and also
improves the read-performance of the index. There is a performance penalty for insert and
update operations on a fully packed index.
RebuildIndex Rebuilding an index does not fully pack the internal and leaf nodes like the
PackIndex option. Instead, rebuilding an index recreates the index with the amount of unused
space that is intentionally put into the index to balance disk space, read performance, and modify
performance. After several modification operations, an index may contain a considerable amount
of unused space. This option regains that unused space.
RemoveDeletedRecords Some data sources, including MapInfo Native and dBase data
sources, do not physically remove records when they are deleted. To physically remove the
deleted records, the table must be packed with this option specified. The record number is
typically used as the record key for these data source types. Removing deleted records from a
table may cause keys to become invalid since they may change as a result of the pack.
CompactDb If the table's data source is Microsoft Access (TableType of Access), then the MDB
file containing the table's data may also be compressed using the Pack method and specifying
this option.
All This is a convenience option that is equivalent to PackGeometry | PackIndex |
RemoveDeletedRecords.
MapXtreme v7.1
171
Developer Guide
TableInfo is used to open tables and create new tables. It is also used for retrieving information
about the open table.
Classes that derive from TableInfo include provider-specific metadata. There is a TableInfo
implementation for every MapXtreme supported table type. See Data Sources.
TableInfo instances may be constructed manually, or from a .TAB file definition (without opening the
table), as shown below.
TableInfo.CreateFromFile()
TableInfo contains properties for enabling Table Services, including caching and making a table
mappable via a spatial schema. See Working with the Cache and Making Tables Mappable.
MapXtreme provides table column metadata support for M and Z values. This feature is useful when
you want to know whether geometries of a particular data provider can support 3D and Measured
values without evaluating its individual geometries.
Metadata for a table can be accessed from the table's TableInfo property. From the table metadata
you can access the GeometryColumn to interrogate if the table supports M or Z values and what the
range of values for that table is if the range is known. For more information on support for M and Z
values, see Support for M and Z Values.
MapXtreme v7.1
172
Developer Guide
MapXtreme v7.1
173
Developer Guide
174
Developer Guide
175
Developer Guide
TableAddColumns is not supported for the following table types: Server, View, Seamless,
AdoNet, ResultSet, or Drilldown. MapXtreme checks for the table and throws an exception if
it encounters one of these table types.
VB example:
Public Shared Sub MapInfo_Data_TableAddColumns(ByVal miTable As Table)
Dim NewCols As Columns = New Columns
NewCols.Add(New Column("PopDensity1990", "Pop_1990 / _
MI_Area(Obj, 'sq mi', 'Spherical')"))
NewCols.Add(New Column("PopDensity2000", "Pop_2000 / _
MI_Area(Obj, 'sq mi', 'Spherical')"))
miTable.AddColumns(NewCols)
End Sub
The expression string Pop_1990 / MI_Area(Obj, 'sq mi', 'Spherical') represents
derived information that will be placed in the temporary column. It says For each record divide
population by area in square miles to yield the population density. The SQL function MI_Area () in
the expression will derive the area from the geometry of the record.
Using the AddColumns method may offer performance improvements in desktop applications where
the join can be performed once, rather than on each subsequent access (as in the case of a view).
For more information and code examples, see the MapInfo.Data.Table.AddColumns class in the
Developer Reference Help system.
For more information on creating expressions, see Chapter 10: Creating Expressions.
MapXtreme v7.1
176
Developer Guide
Data Sources
The following table lists the data sources supported by MapXtreme. Each type of data source is
accessed by a specific data provider, a TableInfo class that is derived from MapInfo.Data.TableInfo.
For a short summary of each data type see Supported Table Types.
Data Source
Class
Native (MapInfo.TAB)
TableInfoNative
dBase
TableInfodBase
MS Access
TableInfoMSAccess
ASCII
TableInfoAscii
RSBMS Server
TableInfoServer
ESRI Shapefile
TableInfoShapefile
Seamless
TableInfoSeamless
Raster
TableInfoRaster
Grid
TableInfoGrid
WMS
TableInfoWMS
ADONET
TableInfoAdoNet
MemTable
TableInfoMemTable
View
TableInfoView
ResultSet
TableInfoResultSet
MapXtreme v7.1
177
Developer Guide
The best method to access data is to open it directly using one of the TableInfo classes that are
specific to where your data resides.
Use the second method (TableInfoAdoNet) to access data that is not internally supported but has an
ADO.NET provider.
A third method allows developers to integrate data to the Catalog who may interact with HTTP
services that return XML or GML.
MapXtreme v7.1
178
Developer Guide
179
Developer Guide
L
MapXtreme v7.1
The steps outlined below refer specifically to ADO.NET tables created from a DataTable.
180
Developer Guide
MapXtreme v7.1
181
Developer Guide
When ExecuteReader is called on this command object, it must produce a data reader that has
the same columns as the sequential command object and in the same order.
The FetchByKeyCommand must contain a Parameters collection and must contain one
parameter for each member of the key. For example, if the TableInfo.KeyColumns specifies a
key as consisting of the city and state columns, then the FetchByKeyCommand must contain
two parameter objects. The first parameter object is assigned a value representing the first
column specified in the TableInfo.KeyColumns collection (e.g., a value for city), the second
parameter object is assigned a value representing the second column specified in the
TableInfo.KeyColumns collection (e.g., a value for state), and so on. When ExecuteReader is
called on the FetchByKeyCommand, the reader must return the record which represent s the
specified key.
This example illustrates how to create a MapInfo Table that accesses data through the ADO.NET
connected command objects.
VB example:
Public Shared Sub MapInfo_Data_TableInfoAdoNet2(ByVal connection _
As MIConnection)
Dim ti As TableInfoAdoNet = New TableInfoAdoNet("EuropeanCities")
Dim _conn As OleDbConnection = New _
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data _
Source=C:\Data\EuropeCities.mdb")
Dim selectQuery As String = "SELECT City, Country, Continent, _
Pop_1994 FROM EuropeCities"
Dim _OleDbCommand As OleDbCommand = New OleDbCommand(selectQuery)
_OleDbCommand.Connection = _conn
selectQuery = selectQuery + " where City = @City AND _
Country = @Country"
Dim _OleDbKeyCommand As OleDbCommand = New _
OleDbCommand(selectQuery)
_OleDbKeyCommand.Parameters.Add("@City", OleDbType.Char)
_OleDbKeyCommand.Parameters.Add("@Country", OleDbType.Char)
_OleDbKeyCommand.Connection = _conn
'
'
'
'
' Tell the table which column(s) constitute a key - for this table
' it is acompound key consisting of values from the City and County
' columns.
Dim sc As StringCollection = New StringCollection
sc.Add("City")
sc.Add("Country")
MapXtreme v7.1
182
Developer Guide
Data Binding
Data binding is the process of bringing data from a data source into MapXtreme. Data binding of
external data (ADO.NET and other legacy sources) to MapInfo.Data.Table is accomplished by
opening an ADO.NET DataTable as a Table using TableInfoAdoNet. The table can then be joined
with another table, joined to itself or use Table.AddColumns to bind columns to a second table.
To join a table to itself, following this example:
Select ... From T as A, T as B Where A.X = B.Y
If an application has data stored in a DataTable or data that is accessible through an ADO.NET data
provider, that data can be presented to the Catalog and treated as a MapInfo table. This would be
primarily useful if the data were not accessible through one of the other table types.
For example, if the data is stored in a dBase file, Microsoft Access table, or is accessible through
ODBC or Oracle's OCI interface, it is recommended that those TableInfo types be used to access
the data. Data which cannot be accessed through one of these types of tables, but that can be
loaded into a DataTable or is accessible through some ADO.NET Data Provider that implements the
Command, Parameter and DataReader object types can still be accessed by the Catalog.
An application may need to make data available as a MapInfo native table so that queries can be
executed to join the data with other MapInfo table data. It may also need to be made available to the
Catalog so it can be used as the source data in a call to the Table.AddColumns.
183
Developer Guide
View Tables
A view is a way to relate information from one or more tables based on a named select statement.
The Catalog allows you to create views based on any table definition. View tables have the following
characteristics:
For more information and code examples, see the MapInfo.Data.TableInfoView class in the
Developer Reference Help system.
MapXtreme v7.1
184
Developer Guide
Result Sets
ResultSets are similar to view tables in that both are defined using a MapInfo SQL select statement
and have an associated name (Alias). ResultSets, however, have a fixed membership of records
based on the evaluation of the where clause (if any) at the time the result set is created. Any access
to the data in a ResultSet always reflects the data in the source table. However changes to the
source data will not cause the ResultSet to add/remove a record based on the original where clause.
ResultSets manage a set of keys internally.
In general ResultSets are lightweight and temporary. Some of the characteristics of result sets are:
For more information, see the MapInfo.Data.TableInfoResultSet class in the Developer Reference
Help system.
Source Rows
Source rows represent a match between the table records involved in Table.AddColumns. When
adding temporary columns to a table, multiple records from the data source may be aggregated
together to compute a value for each record in the destination table (also referred to as the bind
table). The MapInfo.Data.SourceRows class is a collection of SourceRows that identify the records
from the data source that were aggregated together,
SourceRows only exist if the BindType property is DynamicCopy, which indicates that changes to
the source data are propagated to the temporaryr column automatically.
Table.AddColumns is not supported for the following table types: Server, View, Seamless,
AdoNet, ResultSet, or Drilldown.
The GeoDictionary
The GeoDictionary maintains information about which map entities can be matched to which
information. The GeoDictionaries class is a collection of GeoDictionary objects. The
MapInfo.Data.GeoDictionary namespace provides support for data autobinding by being a
programmatic representation of the GeoDictionary file. The GeoDictionary file contains information
about tables (TAB files only). The GeoDictionary is used to automatically determine the table to
which application data should be bound. The GeoDictionary is persisted in a file (typically
GeoDict.DCT) and is maintained using the GeoDictionaryManager utility application (see
Chapter 24: Using the GeoDictionary Manager).
MapXtreme v7.1
185
Developer Guide
It is the MatchResolver object with which the GeoDictionary communicates during the match
process to solve the ambiguity. It provides the matching algorithm. The basic class selects the first or
the one with the highest matching percentage. This class is not sealed and client applications may
derive their own class from this and override its behavior.
SpatialSchemaXY
SpatialSchemaXY uses the X and Y values of each record in the table to construct point objects and
store them in a temporary column known as MI_Geometry. This spatial schema may be applied to
tables of any data source except Seamless, View, and ResultSet.
By having a GeometryColumn, the table can now be displayed as a layer in a Map and used for
spatial analysis.
SpatialSchemaXY has the following characteristics:
This spatial schema can be used for traditional server XY data without a MapCatalog. (Using a
MapCatalog may offer better performance on RDBMS's, since more work is done on the server. See
The MapInfo_MapCatalog.)
MI_Geometry is a temporary column unless you write out the TAB file explicitly using the
TableInfo.WriteToTab method. The schema is automatically regenerated when the table is opened.
MapXtreme v7.1
186
Developer Guide
SpatialSchemaPointRef
This spatial schema uses a value in the table's data to create a Point geometry object by matching
the value against an equivalent value in a mappable table.
For example, if your table of customers contains addresses with postal codes, the customer records
can be tied to the spatial points in a postal code reference table.
SpatialSchemaPointRef is actually a join between two tables, one containing data and the other
containing a join column and an object column. The join column contains the same values as the
data column in the non-mappable table, such as postal codes. The result of applying
SpatialSchemaPointRef is a table that contains a spatial geometry column for records that were
previously non-spatial. This geometry column has the following characteristics:
The data table may match more than one record in the geometry table. When this happens the
similar rows are aggregated into a MultiPoint geometry.
The geometry is the centroid of the geometry from the other table.
MapXtreme v7.1
187
Developer Guide
MapXtreme v7.1
188
Developer Guide
The following sections present the key interfaces and classes for accessing data via the MapInfo
ADO.NET Data Provider.
MIConnection
MICommand
MIDataReader
MapInfo SQL
MIConnection
An MIConnection represents a connection to the Catalog. The connection provides a starting point
for issuing SQL commands and obtaining results. Whereas most data provider connections allow
the user to immediately begin issuing queries or other commands against existing tables (or schema
objects), the MapInfo ADO.NET Data Provider initially has no tables available. Tables need to be
opened or created before they can be accessed. When opened, a name (alias) can be associated
with the table which is used when resolving identifiers in the query engine.
Connections are not pooled in the MapInfo Data Provider and there is no connection string required
to create a new connection.
The MapInfo.Engine.Session class creates and initializes the Catalog which may be accessed
through the Session.Current.Catalog property. The MIConnection.Open method obtains a reference
to the Catalog using the Session.Current.Catalog property and the MIConnection.Close method sets
the internal reference to the Catalog to null.
VB example:
Public Shared Sub MapInfo_Data_MIConnection()
Dim connection As MIConnection = New MIConnection
Dim command As MICommand = connection.CreateCommand()
MapXtreme v7.1
189
Developer Guide
MICommand
MICommand provides the necessary interface for executing SQL commands against the MapInfo
Data Provider. MICommand creates MIDataReader and MIScrollableReader instances for obtaining
data via the ExecuteReader and ExecuteScrollableReader methods, respectively.
Supported Commands
The commands that are understood by the MICommand are:
Select
SELECT < select_list >
FROM { < table_source > } [ ,...n ]
[ WHERE < search_condition > ]
[ GROUP BY expression [ ,...n ] ]
[ ORDER BY {expression | column_position [ ASC | DESC ] } [ ,...n ]]
< select_list > ::=
{
*
| { table_name | table_alias }.*
| { expression } [ [ AS ] column_alias ]
} [ ,...n ]
< table_source > ::=
table_name [ [ AS ] table_alias ]
MapXtreme v7.1
190
Developer Guide
ExecuteFeatureCollection
The ExecuteFeatureCollection method in the MICommand class is the bridge between the MapInfo
ADO.NET Data Provider and the Feature object model. This method executes command text (SQL
statements) against the data source connection, and builds an IResultSetFeatureCollection. The
Feature model is discussed in Features and Feature Collections.
MapXtreme v7.1
191
Developer Guide
MIDataReader
The MIDataReader provides forward-only, read-only access to the data returned from executing a
SQL Select statement. To create a MIDataReader, you must call the ExecuteReader method of the
MICommand object, rather than directly using a constructor.
The MapInfo Data Provider allows multiple MIDataReader instances to be in use on the same
connection. However, if the Table being accessed resides on a Microsoft SQL Server database, only
one MIDataReader may be open at a time.
IsClosed and RecordsAffected are the only properties that you can call after the MIDataReader is
closed.Although the RecordsAffected property may be accessed while the MIDataReader exists,
always call Close before returning the value of RecordsAffected to ensure an accurate return value.
You must explicitly call the Close method when you are through using the MIDataReader.
When accessing the DataReader through the IEnumerator or IFeatureEnumerator interface, Close()
is automatically called when MoveNext() returns false. Only one enumerator can be used on a
DataReader.
The MIDataReader provides a means of reading a forward-only stream of rows from the MapInfo
data provider. This cursor type is the best performing for accessing a selection of rows since there is
little setup or overhead.
ReadPrevious
Rewind
Unwind
ReadTop
ReadBottom
AtTop / AtBottom
MapXtreme v7.1
192
Developer Guide
MapInfo SQL
The MapInfo SQL Language allows you to add powerful analytical processing to your MapXtreme
application. MapXtreme exposes SQL processing to users via the MapInfo ADO.NET Data Provider
for accessing data (specifically the MICommand object). Expressions are also used for labeling,
thematics, legends, AddColumns, Feature searching, and Selection processing.
MapInfo SQL is standardized based on SQL-3 Specification. For example, you will find that:
A complete reference including code examples for the MapInfo SQL language is provided in the
MapInfo SQL Reference, which you can view directly from Visual Studios Help system.
Feature
Features are described by their geometry, style, data source, key and attributes. Typically a feature
is a row in a table. A features geometry is a FeatureGeometry object. FeatureGeometries can cover
a given area (MultiPolygon), a location (Points, MultiPoints); and distance (MultiCurves,
LegacyArcs). Additional Geometry classes that derive from FeatureGeometry and are used for map
features are FeatureGeometryCollection and LegacyText. (Rectangle, rounded rectangle and ellipse
objects also derive from FeatureGeometry, but are used primarily for cosmetic display purposes.)
One of the main uses of computerized maps is to gather information about the features. In
MapXtreme features are returned in FeatureCollections by any of several methods, either created
from scratch using a schema, selected using selection tools or methods or by searching the Catalog
for those that meet a specific set of criteria.
MapXtreme v7.1
193
Developer Guide
Feature.Update
Table.UpdateFeature
Table.InsertFeature
Feature Collections
Feature collections are a group of Feature objects. All Features in a collection share the same
Schema (columns). The Feature collection has a schema which is the schema of all of its member
feature instances. Some Feature collections own their Features while other Feature collections
maintain references to Features.
194
Developer Guide
195
Developer Guide
Behavior
SearchAll
SearchNearest
Returns the rows with table geometries that are closest to the given
search point.
SearchWhere
SearchWithinDistance
SearchWithinFeature
Returns the rows where the table geometry is contained within the
search features's geometry.
SearchWithinGeometry
Returns the rows where the table geometry is contained within the
search geometry.
SearchWithinRect
Returns the rows where the table geometry intersects the given
rectangle.
SearchIntersectsFeature
Returns the rows where the table geometry intersects with the
search features's geometry.
MapXtreme v7.1
196
Developer Guide
Behavior
SearchIntersectsGeometry
Returns the rows where the table geometry intersects with the
search geometry.
SearchWithinScreenRadius
SearchWithinScreenRect
Returns the rows where the table geometry intersects the given
screen rectangle.
MapXtreme ships with a Search sample application that you can run and learn more about each
search type. The illustration below shows the Search menu with the SearchInfoFactory methods that
use a spatial reference. The Map Search menu has methods for searching based on a drawn screen
geometry object (circle or rectangle). The Query Definition menu highlights the use of various filters
that act on an SQL statement. Find the sample in the
..\MapInfo\MapXtreme\7.x.x\Samples\Desktop\Features\Search folder.
Code Samples
This section includes several code samples that pertain to SearchInfoFactory methods.
SearchNearest
Using the SearchNearest method, the code simulates the Select Point tool behavior to select the
topmost items under a mouse click and add them to the selection.
VB example:
Public Shared Sub MapInfo_Mapping_SearchInfoFactory(ByVal _
mapControl1 As MapControl)
' Get a point from mouse click. Hard coded value use in sample.
Dim pt As System.Drawing.Point = New System.Drawing.Point(100, 100)
' Assumes there is a MapControl with a map in it.
MapXtreme v7.1
197
Developer Guide
198
Developer Guide
MapXtreme v7.1
199
Developer Guide
Analyzing Data
Once your data is available in the Catalog, you will want to analyze it to meet your business
objectives. The Catalog has an SQL processor that allows you parse and aggregate your data. Here
you have two options:
200
Developer Guide
MapXtreme v7.1
201
Developer Guide
Only request the data you need (especially from an RDBMS). This limits the amount of data sent
over the connection.
For web applications, put attribute column information into the workspace file, so that all needed
data will be pre-loaded at the MapInfo Session creation time. For an example, see Overview of
the Thematics Sample.
Only sort tables if you need an ordered list. This process takes time to read through the entire
table to build an order. Also it will be slower if there is no index on the column.
Only scroll if you need random access to a table. This also builds indexes to speed up access
and remember order. Data readers access the data directly with no need to read extra data.
Use consistent coordinate systems for Join and Search operations. This eliminates the need to
convert geometries for every access.
Use indexed columns for Join / Filter / Sort / Aggregate operations.
Use CentroidWithin, ContainCentroid, and EnvelopesIntersect prior to actually checking for
geometry intersects. These tests are very quick and in most cases eliminate a lot of geometries
from your list with little effort.
Use BeginAccess/EndAccess (especially for file-based tables) when performing multiple queries
and/or edits.
Try to avoid calls such as Area and Buffer in the Where clause because the operation will have
to be done each time a new cursor is created.
Try to avoid calls such as Area and Buffer in the Select list when defining a view or result set for
similar reasons.
Use result sets for intermediate results or operations where you manage keys. These are very
light weight and afford quick direct access back to the original data.
MapXtreme v7.1
202
Developer Guide
The MapInfo.Engine namespace contains the interfaces and classes that relate
directly to the core functionality that drives all applications based on
MapXtreme. This includes the core ISession interface which is the starting point
for all MapXtreme applications. Classes in this namespace include Session and
Selections, and SearchPath. Other types in the namespace are supporting
classes, delegates, structures, and enumerations for Collections, Resources,
and CustomProperties.
In this chapter:
Session Interface
The ISession interface is the starting point for all MapXtreme-based applications. It manages the
initialization of resources needed for a MapXtreme application.
An instance of ISession holds components of the MapXtreme object model such as the DataAccess
engine, MapFactory, CoordSysFactory so that the desktop or web application can do work. The
following diagram illustrates the classes that implement ISession interface.
For an ASP.NET application each client request has its own ISession instance. This instance resides
in the calling context and is available throughout the lifetime of the client's request.
For a single-threaded desktop application there is only one instance. On a multi-threaded desktop
application there is one instance per thread.
The MapInfo.Engine.Session class provides access to the ISession object. To get the current
ISession instance, access the MapInfo.Engine.Session.Current property.
Session Management
Session management is a key topic to understand when you are designing your application. While a
desktop applications session management is straightforward (each user has his own ISession
instance), a web application needs to factor in, perhaps, an unknown number of users who will user
your application. It will have to know how to handle each users state so that the correct information
and visual display is returned to the correct user.
MapXtreme provides templates for building web applications that help you manage state properly.
This topic is discussed in greater detail in Chapter 6: Understanding State Management. Key
decisions about state management, pooling, performance and data access are presented to help
you make informed decisions during the design phase of your project, before you start coding.
MapXtreme v7.1
204
Developer Guide
Session.Dispose()
Session.Dispose() disposes the ISession instance that is accessible through the Session.Current
property. This method is used only for multi-threaded desktop applications.
Do not use this for web applications or single-threaded desktop applications. For web applications,
ISession is managed by WebSessionActivator.
For single-threaded desktop application, Dispose is called automatically when the application is
shutdown or when the AppDomain using MapXtreme is unloaded.
Session.Dispose(HttpSessionState)
Use Session.Dispose(HttpSessionState) for web applications that use the default session state
settings in which the ISession is stored in memory. Do not call this method for any other
configuration since the ISession instance is not stored in memory in any other configuration.
The state settings are represented in the Web.config file of your application project by the following
keys:
<add key="MapInfo.Engine.Session.State" value="HttpSessionState" />
<sessionState mode="InProc" />
The first setting is an application-specific setting that controls the mechanism for saving and
restoring the state of the MapInfo.Engine.ISession instance. This instance is accessible through the
MapInfo.Engine.Session.Current property. The HttpSessionState setting indicates that the session is
saved and restored through the ASP.NET session state. This state is exposed through the current
HttpContext and is of type HttpSessionState.
The second setting is an ASP.NET setting that controls how the HttpSessionState is saved and
restored. InProc indicates that the state of the ASP.NET session is to be placed in memory and is
unique to each ASP.NET ISession instance. This is the default setting.
When you use these settings, there is an ISession instance for each ASP.NET session and it is
stored in the HttpSessionState throughout the lifetime of the ASP.NET session. In order for the
ISession instance to be properly disposed of when the session times-out or ends, you must add the
following statement to the Session_End method in your Global.asax source code file.
VB example:
MapInfo.Engine.Session.Dispose(Me.Session)
Protected Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
MapInfo.Engine.Session.Dispose(Me.Session)
End Sub
Making this call will ensure that the ISession instance is properly disposed of and that memory is
reclaimed.
MapXtreme v7.1
205
Developer Guide
ISessionEventHandlers
MapXtreme provides a MapInfo.Engine.ISessionEventHandler interface for loading custom DLLs
that extend MapXtremes functionality. Use this interface to autoload any extension DLLs that you
need for your application, such as extensible data providers, persistence providers, and styles that a
default workspace may use. When MapXtreme starts up, it will initialize these assemblies and carry
out the required instructions.
For example, MapXtreme provides a SpatiaLite sample implementation that, when compiled, yields
an assembly that contains code to support the SpatiaLite data provider as well as to load the data
provider when a MapXtreme session initializes.
In order for SessionEventHandler assemblies to be initialized on startup, they must be located in the
\Common Files\MapInfo\MapXtreme\7.x.x\SessionEventHandlers folder. In fact, any assembly in
this folder with the file suffix of .SessionEventHandler.DLL will be loaded.
The ISessionEventHandler interface provides two methods that can be called to load any extension
code you need for your application and provide additional initialization functionality.
void BeforeWorkspaceLoad(ISession session)
is called before any default workspaces are loaded, and could be used to set up any extensible data
providers, edp callbacks, edp persistance providers, named connections, load or create styles, open
tables, database connections etc. that might be used by a default workspace.
void AfterWorkspaceLoad(ISession session)
is called after any default workspaces (specified in app.config or web.config) are loaded. This is a
good place to do any final session initialization that your application could need.
When MapXtreme finds classes in the assembly that implement the ISessionEventHandler interface,
it constructs an instance of the class and adds it to an internal collection. Whenever a new
MapXtreme Session instance is created (once for a desktop application, can be multiple sessions for
web applications), all of the Session handlers are called with the instance of the session being
initialized.
Since there can be multiple SessionEvent handlers loaded and the order in which they are called is
indeterminate, if you are writing a handler, do not make any assumptions about what is already in
the session (ie: maps, tables, etc) .
Use this capability with caution! Any MapXtreme session created on that computer will load these
session event handlers. Adding handlers that display dialog windows or other user interface
components may cause web applications to hang as these dialogs will be displayed on the server.
MapXtreme v7.1
206
Developer Guide
Serialization
Serialization is the process of converting an object into a stream of data in order to preserve it on the
server. This process is an essential part of maintaining objects in MapXtreme web applications. If the
objects are not maintained the server would need to recreate the object (such as a map) for each
web request. When an object is requested, it is deserialized (or recreated from the stream of data)
and then modified. This algorithm does not make a copy of the object (as other serialization
algorithms do) such that the object being deserialized is created only once.
The serialization is performed by formatters that are embedded in the Microsoft.NET Framework.
Two different formatters are included in the Framework, one for binary objects, BinaryFormatter, and
one for SOAP objects, SOAPFormatter (SOAP is a lightweight protocol intended for exchanging
structured information in a distributed environment, such as the web.). SOAPFormatter is relatively
faster than BinaryFormatter. SOAPFormatter is used for certain basic types of data (Int, Byte,
Decimal, etc.) and BinaryFormatter is called for complex of objects. See the Microsoft MSDN
documentation for more information about the SOAPFormatter and the BinaryFormatter.
To pass an object to one of these formatters, use the GetObjectData() method. To deserialize the
object (restore it from the stream) use the SetObjectData() method.
Any object that supports the ISerializable interface will automatically be restored, or deserialized.
The ASP.NET framework automatically deserializes the context.Session[] array after
HttpApplication.BeginRequest. MapInfo.Engine.Session is set up in HttpApplication.BeginRequest
handler so objects are deserialized into the MapInfo.Engine.Session.
MapXtreme v7.1
207
Developer Guide
Persistence
Persistence in MapXtreme is the is the process of storing application objects to MapInfo Workspace
(.MWS) files, which exist in XML format. Persisting and de-persisting ISession objects is done using
the WorkSpacePersistence and WorkSpaceLoader classes. These two classes will write out and
read in .MWS files. The application can write out the workspace (a copy of the Session), and apply
the contents of the workspace file to a new Session object, creating a clone of the Session.
VB example:
Public Shared Sub MapInfo_Persistence_WorkSpacePersistenceSave()
' Create a named connection point to "D:\data\version2"
Dim info As NamedConnectionInfo = New NamedConnectionInfo("file",_
ConnectionMethod.FilePath, "D:\data\version2")
Session.Current.Catalog.NamedConnections.Add("MyDataFolder",_
info)
' Create a map
Dim map As Map =
Session.Current.MapFactory.CreateEmptyMap("MyMap",_
"MyMapAlias", New Size(400, 400))
Dim table As Table =
Session.Current.Catalog.OpenTable("MyDataFolder", _
"myTableAlias", "Seamless\Lines - NYALBA\SeamCapDist.TAB")
map.Layers.Add(New FeatureLayer(table))
'
Note that adding a workspace (using the WorkSpaceLoader class) is an cumulative process. To
ensure the Mapxtreme Session only contains the contents of the new workspace file, call Reload()
method on the ISession object first. This method clears the Session state and reloads pre-defined
workspaces in the applications Web.config file.
For more information on persistence and the XML schema, see Appendix C: Understanding the
MapInfo Workspace.
MapXtreme v7.1
208
Developer Guide
Setting Preferences
If you only want to save a specific type of name resource and leave the others as is, you must set a
preference using PreferenceForNamedResource property available on the WorkspacePersistence
object. By default it is set to NameResourcePreference.All. You can set other values as well such as
NameResourcePreference.PreferNamedTables to save only Tables as named resources. To store
more than one resource as named resources use the OR operator. For example:
NameResourcePreference.PreferNamedTables |
NameResourcePreference.PreferNamedLayers.
For more information, see INamedResourceResolver in the Developer Reference.
Selection Class
A Selection is a collection of IResultSetFeatureCollection objects that holds lists of features. These
features are a subset of rows in a table. They could be property boundaries, street networks, cell
tower locations, or natural features such as rivers. They are typically drawn with special highlighting
when they display in a Map. There can only be one IResultSetFeatureCollection for a given table in
a Selection.
There can be more than one Selection in a ISession. The Selections collection contains all of the
selections in the application. There is always at least one selection, known as the DefaultSelection.
MapXtreme v7.1
209
Developer Guide
SelectionChangedEvent
A delegate method is attached to the SelectionChangedEvent in order to receive notification that this
selection has changed. For example, if a record is added, the SelectionChangedEvent is fired.
MapXtreme v7.1
210
Developer Guide
211
Developer Guide
MapXtreme v7.1
212
Developer Guide
Event Arguments
The MapInfo.Engine namespace contains various event argument classes that provide data for
events. Refer to the online help for more information. Some of the event argument classes include:
Exceptions
The Engine namespace contains various exception classes. Refer to the online help for more
information. Some of the exception classes include:
ResourceNotFoundException Throws this type of exception when the requested object is not
found in the Resource table.
ResourceTypeMismatchException The exception that is thrown when the object read from
Resources was not of the expected type.
TimeoutException The exception is thrown on Current timeout while waiting for a pooled
ISession to become available.
MapXtreme v7.1
213
Developer Guide
Creating Expressions
In this chapter:
10
Expressions Overview
Expressions are statements that are used to describe and format data. For example, in English, an
expression might read like a median income of more than $50,000, or female percent of
population.
Expressions are formed using column names, constants (i.e., specific data values), along with
functions and operators that act upon the columns and constants. The operators and functions are
defined in the MapInfo SQL Language, developed to support MapXtreme and other MapInfo .NET
supported products going forward. For details, see the MapInfo SQL Reference via the Help Viewer
in Visual Studio.
Use expressions to make the most of your data. By using expressions you can:
Show only the columns and rows of data that interest you.
Derive new columns by calculating new values based on the contents of your existing columns.
Aggregate data to work with subtotals instead of the entire table.
Combine data from two or more tables into one results table.
Many of the data sets you will use include more objects and information than necessary for your
projects. In many cases it is easier to work with a subset of the complete data product. For example,
if you were tracking crime statistics for a certain county by census tract, you would not need the
census tracts for the entire state. You would use an expression to extract just the census tracts for
the county.
Expressions are used throughout MapXtreme, in the following areas:
SQL statements (select, insert, update, delete, group by, order by)
SQL functions that take expressions as an arguments (e.g., the geometry argument in MI_Area()
is an expression that returns a geometry object.)
Adding columns (MapInfo.Data.Table.AddColumn creates a temporary column based on an
expression.)
Feature searches (SearchInfo and SearchInfoFactory)
Themes (FeatureStyleModifier)
Labels (LabelModifier)
InfoTips (FeatureLayer, MapTools)
Expression dialog
Creating Expressions
The simplest possible expression consists of a constant, such as 2 (numeric example) or Friday
(text example).
Other simple expressions consist of a column name, for example:
POP_2000
STATE
When you request specific multiple columns in a select statement, for example, these columns
together are known as an expression list.
MapXtreme v7.1
215
Developer Guide
> 500000
<= POP_1990
<> Ontario
Columbia AND VALUE >= 250000
Supported operators in MapInfo SQL are defined in the MapInfo SQL Reference online via the
integrated Help in Visual Studio (look for MapInfo SQL Reference in the Dynamic Help contents
pane).
Boolean expressions are used in the where clause of an SQL statement. The where clause is the
expression that controls the rows that are returned (the rows that result in True).
For example, the boolean expression in this statement follows WHERE. Only objects in the Europe
table that fall within the boundary of France will be returned as True.
"SELECT * FROM Europe WHERE MI_Geometry within @France";
Functions In Expressions
Functions in MapXtreme are used to create even more complex expressions to retrieve data that
meets specific criteria. For example, MapInfo SQL supports many of the usual database functions
that work with strings, dates, and numbers. Beginning with MapXtreme 7.1, DateTime and Time
functions are also supported.
The most powerful functions in MapInfo SQL are those that take advantage of the spatial nature of
mapping data. These geographic functions are used to create new geometries, measure area and
length, return spatial information, validate spatial relationships among geometries, and others.
Supported functions are defined in the MapInfo SQL reference.
MapXtreme v7.1
216
Developer Guide
If a DateTime column or Time column is used alone in an expression, it is formatted using the
current locale.
If a DateTime or Time column is in an expression, its string value is TimeToNumber or
DateToNumber + space + TimetoNumber.
Operator math on Time or DateTime is not supported. You can add a number to a Date, but not
to a Time or DateTime.
Expression Examples
The following highlights some uses of expressions in various areas of MapXtreme.
217
Developer Guide
218
Developer Guide
MapXtreme v7.1
219
Developer Guide
MapXtreme v7.1
220
Developer Guide
In this chapter:
11
You can add a table from data in a DBMS using the TableInfoServer class in the MapInfo.Data
namespace.
The details for adding spatial data are included in the following sections.
MapXtreme v7.1
222
Developer Guide
Geometry Conversion
The table below shows the translation from MapXtreme objects to Oracle Spatial
(SDO_GEOMETRY).
From MapInfo
To Oracle
NULL geometry
NULL
Point
1 POINT
Polygon
FeatureGeometryCollection
MultiPoint
5 MULTIPOINT
MultiCurve
MultiPolygon
Ellipse
NULL
LegacyArc
NULL
MapXtreme v7.1
223
Developer Guide
To Oracle
Rectangle
NULL
LegacyText
NULL
RoundedRectangle
NULL
PieTheme, BarTheme
NULL
The table below describes the translation from Oracle (GTYPES) to MapInfo Spatial objects.
From Oracle GTYPES
To MapInfo
Point
MultiCurve
MultiPolygon
FeatureGeometryCollection
MultiPoint
MultiCurve
MultiPolygon
*Some data loss may occur when translating to or from MapInfo object format. They are interpreted
(when possible) as single point SDO_POINTTYPE values if not already NULL. They grab the first
point in the ordered array which would be interpreted as a NULL geometry.
Tables that contain M and/or Z values now return FeatureGeometry objects that contain the data for
the dimensions present. FeatureGeometry instances inserted or updated into an Oracle table will
preserve each of the four dimensions of the new geometry (XYZM) that the Oracle table is defined to
support. For geometries containing dimensions unsupported by the Oracle table, the values for
MapXtreme v7.1
224
Developer Guide
Centroid Support
A MapXtreme application uses the SDO_POINT as the centroid value for polygons. This centroid
feature is used to position labels, and also affects the tool selection of the object. The Oracle
SDO_GEOMETRY.SDO_POINT_TYPE field (if not NULL) is interpreted as the feature centroid if the
point exists inside the region. If the point exists outside of the region, its centroid is calculated as
always.
There is currently no method or tool in MapXtreme to set the centroid of a region feature, but
one may read and use a stored centroid.
MapXtreme v7.1
225
Developer Guide
1.
MapXtreme v7.1
226
Developer Guide
MapXtreme FeatureGeometry
FeatureGeometry
Point
Point
LineString
MultiCurve
Polygon
Multipolygon
MultiPoint
MultiPoint
MultiLineString
MultiCurve
MultiPolygon
MultiPolygon
GeometryCollection
FeatureGeometryCollection
MultiPoint
MultiCurve
MultiPolygon
An EMPTY GEOMETRY/GEOGRAPHY,
e.g., Point empty
NULL
This table shows how a MapXtreme FeatureGeometry is written back to SQL Server 2008
SQL Server 2008 Spatial
GEOGRAPHY or GEOMETRY
MapXtreme FeatureGeometry
Point
Point
MultiPoint
MultiPoint
Point
MultiCurve
MultiLineString
LineString
Multipolygon
MultiPolygon
MapXtreme v7.1
227
Developer Guide
MapXtreme FeatureGeometry
FeatureGeometryCollection
GeometryCollection *
Rectangle
NULL
RoundedRectangle
NULL
Ellipse
NULL
LegacyArc
NULL
LegacyText
NULL
This GeometryCollection may contain any or all of the following types: MultiPoint,
MultiLineString, and MultiPolygon.
SQL Server 2008 provides new types for date and time information. The following table shows how
date and time types are mapped to MapXtreme date and time types. MapXtreme introduced support
for Time and DateTime beginning with v. 6.8.
SQL Server
MapXtreme
Date
Date
Time
Time
DateTime
DateTime
SmallDateTime
DateTime
DateTime2
DateTime
DateTimeOffset
No support
Spatial tables from SQL Server 2008 must be registered in the MapInfo_MapCatalog so that
MapXtreme understands what it reads.
The MapCatalog provides four new spatialcolumn values to represent SQL Server 2008 tables:
17.x for GEOMETRY without M and Z values
18.x for GEOGRAPHY without M and Z values
20.x for GEOMETRY with M and Z values
21.x for GEOGRAPHY with M and Z values.
Data can be uploaded using MapInfo Professional or EasyLoader or you can use MapInfo
Professional to make existing data mappable, which will create the entry in the MapCatalog. See
The MapInfo_MapCatalog for more information on the MapCatalog.
MapXtreme supports SQL Server 2008 tables created in MapInfo Professional (table versions 900,
950 and 1000) and EasyLoader.
MapXtreme v7.1
228
Developer Guide
Description
A number that controls the display of the connection dialog box:
0 Suppresses the connection dialog.
1 Displays the connection dialog.
2 Displays the connection dialog, but only if needed (i.e., if not all required
information was provided) [default].
L
DSN=
ASP.NET Applications which use Pooling must have a DLG=0 clause in the
connection string for ODBC.
DRIVER=
Specifies the exact driver name of the installed driver. Used instead of the DSN=
syntax key.
Example:
DRIVER={SQL Server}
UID=
PWD=
Specifies the users password for the data source, if required. Passwords do not
need to be in the connection string for the two strings to match. If two tables are in
the same database, the connection string is the same.
MapXtreme v7.1
Connection attributes/parameters do not have to be in order and one may use a dialog to get
a connection from an existing connection pool to avoid redundant connections. In previous
version of our API, if you used a dialog each time to connect to the same database, or if you
did not order the connection keywords in the connection string in the documented order, the
connection would not be shared and you would get multiple connections.
229
Developer Guide
Description
SRVR=
Reflects the service name for the server set in the Oracle Net8 EasyConfig utility.
This is required for Oracle connectivity, but does not apply to ODBC connections.
UID=
PWD=
MapXtreme v7.1
230
Developer Guide
Example
Select Obj from rdbsdata
Select sw_geometry from rdbsdata
select sw_member, ST_Buffer(geometry, 66.0, 0.1) from rdbsdata
// a geometry function
Select st_geometry(st_point(72.5, 42.5) from rdbsdata
// a geometry constructor
MapXtreme v7.1
231
Developer Guide
Example
Select customer_id mi_prinx, obj from customer_view
The column alias mi_prinx is used to identify and use the customer_id column as the key column
for the table. You can alternately alias the desired key column in the create view statement to identify
the key column automatically for any query on that view.
Example
Create view customer_view as select customer_id mi_prinx, geoloc from
customer
In general, if a column name or column alias of prinx, or mi_prinx is found in the result set, that
column is used as the key column for the table. This enables the application/query writer to specify
the key column they desire.
MapXtreme v7.1
232
Developer Guide
Performance Issues
Establishing a connection with the database server may take several seconds. This is a one-time
cost, incurred when the table is first opened.
The map-display speed depends on how much data is retrieved from the server. In some cases,
displaying a map from a server is noticeably slower than displaying a map from a local file. Speed
also depends on whether your MapXtreme application has already cached the map features that are
being displayed.
MapXtreme v7.1
233
Developer Guide
MapXtreme v7.1
234
Developer Guide
Description
OFF
A value of 'Off' means that the table will not use the cache at all. All data
operations will go directly to the database server.
ON
Caching is enabled and the table automatically performs caching based on the
map view (center/zoom). The user may additionally control the cache through the
cache constraint objects.
The cached table maintains the record cache in a fashion that best improves
standard map operations. The cache is maintained to contain, at a minimum, all
the records displayed in the current window of each Map the table is in (and
visible). Once an initial map window has been cached, pan and zoom operations
that fall entirely within the initial extents of the cache access the cached records
and do not need to query the database. If a pan/zoom operation falls outside the
cached region, the table adds the new map window MBR (view) to the cache and
obtains the missing records from the database server and adds them to the cache.
The old map view is not initially discarded; rather, an internal history of previous
map views is maintained. To avoid having a cache that grows excessively large,
there are controls that can be placed on the table's cache to determine when to
discard old cached views (map window MBR regions). These controls are
properties of the CacheParameters object, which can be set at the time the table is
initially opened. This allows the developer to set limits on the maximum amount of
memory or disk space used by the cache, the maximum number of previous map
window views to maintain in the history, the maximum number of records to
maintain in the cache, and/or the maximum amount of time old map window views
are allowed to remain in the cache history. These limits can be used individually or
in combination to provide the cache management that best suits the application's
needs.
ON is the default setting for the CacheParameter setting for a TableInfoServer. For
other TableInfo data sources, the default is OFF. For example, TAB files are not
cached by default.
MapXtreme v7.1
235
Developer Guide
Description
A value of USER for the LayerInfo CACHE parameter means that your application
creates a cache, but the only records that are placed in the cache are those
specified by the application developer. The mechanisms available for specifying
which records are placed in the cache are BoundConstraint, FeaturesConstraint,
and AllFeaturesConstraint objects. The word constraint implies that these objects
are constraining the cache to include the specified records. The BoundsConstraint
object can be used to place all records into the cache for which the MBR of the
feature intersects the MBR of the constraint.
A FeaturesConstraint object can be used to add specific records to the cache. For
example, if an analysis is going to be performed that involves multiple steps and/or
reads of the Feature or RowValues of the feature, possibly on a set of features
returned from a Layer.Search, Layer.SearchWithinDistance, etc., it may be
advantageous to place these records into the local cache for the duration of the
analysis and remove them when finished. The FeaturesConstraint provides this
capability. If an application is going to perform an analytically intensive operation
that may hit every record, it may be desirable to temporarily cache the entire set of
data for the layer. This is accomplished by using the AllFeaturesConstraint. These
cache constraint objects can also be used when the cache is set to ON. In this
case, they may add records to the cache but have no effect on the cache's history
of previous map window views. The constraint objects can also be used when the
cache is set to OFF or ALL in which case they have no effect.
L
ALL
The entire table is cached. With this option, the table's data is retrieved from the
server once and accessed locally from that point forward. To refresh the data in the
cache, use the Refresh method on the table.
If you try to cache too much data or too many tables, virtual memory usage may be forced, and
performance gain could be lost.
The MapInfo_MapCatalog
In order to display data on a map, your MapXtreme application needs to access a special table,
known as the MapInfo_MapCatalog. One catalog must be created per database before any tables in
that database can be viewed as a map layer in a MapXtreme application. The MapCatalog must
contain information about the spatial columns in each of the mappable tables you want to access
from the database. The MapInfo EasyLoader utility automatically inserts the appropriate row into the
MapInfo_MapCatalog when the table is uploaded into the database.
MapXtreme v7.1
236
Developer Guide
MapXtreme v7.1
237
Developer Guide
It is important that the structure of the table looks exactly like this statement. The only
substitution that can be made is for databases that support varchar or text data types;
these data types can be substituted for the Char data type.
3. Create a unique index on the TABLENAME and the OWNERNAME, so only one table for each
owner can be made mappable.
create unique index mapcat_i1
on mapinfo.mapinfo_mapcatalog (OwnerName,TableName)
4. Grant Select, Update, Insert, and Delete privileges on the MAPINFO_MAPCATALOG. This
allows users to make tables mappable.
grant select, insert, update, delete on mapinfo.mapinfo_mapcatalog to
public
MapXtreme v7.1
238
Developer Guide
MapXtreme v7.1
239
Developer Guide
Values to Assign
MapInfo Spatial Object Format
1: Point layer in X/Y columns indexed
with micode (a serialized quadtree key)
4: Point layer in X/Y columns
Examples
14.0 = SQL Server
14.1
14.2
14.3
Maps to
MapInfo.GeometryColumn.PredominantGeometry
Type, and
Has<Line/Point/Region/Text>Geometries
TABLENAME
MapXtreme v7.1
STATES
240
Developer Guide
Values to Assign
Examples
OWNERNAME
BOB
SPATIALCOLUMN
SW_GEOMETRY
DB_X_LL
360
Maps to MapInfo.Data.GeometryColumn.Bounds
DB_Y_LL
90
DB_X_UR
360
DB_Y_UR
90
VIEW_X_LL
-180
-45
VIEW_X_UR
180
VIEW_Y_UR
45
COORDINATESYSTEM
Earth Projection 1,
0
Maps to MapInfo.Data.GeometryColumn.CoordSys
MapXtreme v7.1
241
Developer Guide
Values to Assign
A MapInfo Symbol clause (if the layer contains only
points); or a Symbol clause followed by a Pen
clause (indicating styles for linear features)
followed by another Pen clause (indicating styles
for the borders of regions) followed by a Brush
clause.
Examples
Symbol(35,0,12)
Pen(1,2,0)
Pen(1,2,0)
Brush(2,255,255)
Maps to
MapInfo.Data.GeometryColumn.DefaultStyle
XCOLUMNNAME
NO_COLUMN
Maps to MapInfo.Data.SpatialSchemaXY
YCOLUMNNAME
NO_COLUMN
Maps to MapInfo.Data.SpatialSchemaXY
RENDITIONTYPE
0 or 1
MapXtreme v7.1
242
Developer Guide
Values to Assign
If RENDITIONTYPE is 1, this field stores the name
of the column in the spatial table that contains style
information. This column is automatically added to
any query against the table and is maintained
(updated) as the object is updated. Users should
NOT specify this column in their queries as
problems can occur with intersect or update
statements. Queries which include this column in
the select clause (excluding the wildcard character
Examples
MI_SYMBOLOGY
NULL
NUMBER_ROWS
NULL
Per-Record Styles
Per-record style support brings a feature to spatial database implementations that has long been
available in MapInfo TAB files. Specifically, it allows each geometry in a single table to have its own
style. For example, a single 'public institution' table in Oracle Spatial can have schools, town halls,
libraries, and police departments and each point type would be represented with its own symbol (i.e.,
a school symbol for all the schools). Similarly, a single road table in SpatialWare SQL Server may
have different road types such that streets are shown as a single pixel black line, secondary roads
as a double pixel red line and interstates as parallel red lines.
To use per-record styles, your table must be represented with an entry in the MapCatalog with
appropriate settings for RENDITIONTYPE, RENDITIONCOLUMN, and RENDITIONTABLE.
MapXtreme v7.1
If these columns are not present, the tables default style will be applied to all objects.
243
Developer Guide
Example
Symbol(35,0,12)
Symbol(64,255,12,"MapInfo
Weather",17,0)
Symbol("sign.bmp", 255, 18, 0)
Example
Pen(1, 2, 0)
Example
Brush(pattern,color,backgroundcolor)
The MapXtreme Styles API is discussed in Chapter 15: Stylizing Your Maps. Style patterns are
presented in Appendix F: Style Lookups.
MapXtreme v7.1
244
Developer Guide
Troubleshooting
If you encounter problems with your SpatialWare or Oracle applications, use the following table to
help analyze and solve the problem.
Problem Description
Possible Cause
Solution
MapXtreme v7.1
245
Developer Guide
Adding Mapping
Capability to Your
Applications
We use the MapInfo.Mapping namespaces to add mapping functionality to your
application. This chapter explains how to use the Mapping namespaces to
enhance your mapping application.
In this chapter:
12
MapExport
The MapExport class is used to export a Map to an image. The properties of this class specify each
aspect of the image, such as BorderPen, ExportSize, Format, etc.
MapExport supports several different image formats including: BMP (default), WBMP, WMF, EMF,
GIF, J2K, JPG, PNG, PSD, TIFF, TIFFCymk, and TIFFLzw. When performance is an issue, the BMP,
GIF, JPG, PNG, and TIFF formats can also be exported using the .NET framework API instead of the
LEADTOOLS API. While the export speed may differ, the quality of the images exported is the same
for both methods.
To select a format, set the ExportFormat property to one of the above formats (e.g.,
ExportFormat.WindowsPNG).
MapXtreme v7.1
The LegendExport class also exports files in these formats using the .NET framework and
LEADTOOLS APIs.
247
Developer Guide
Map
The Map class contains everything that you can put in a map. A Map object is placed in a
MapControl object for a desktop application or attached to a MapExport object for a web application.
A Map has the following properties:
Bounds
Center
Zoom
Scale
Size
Rotation
DisplayTransform
DisplayCoordSys
Each Map has a Layers collection, which holds all the layers that comprise the map (see Layers),
and a single Adornment collection, which contains all of the maps adornments. Adornments include
Legends, Titles, and Scalebars (see Legends Overview).
MapFactory
The MapFactory class contains the objects used to create maps from Geosets, workspaces, and
lists of tables. MapFactory also functions as a container of, and tracks, the collection of all maps
created in a particular session.
248
Developer Guide
MapLoader
The MapLoader class provides a mechanism to load the layers of a map from Geoset files, XML
Workspace files, or TAB files. For each type of map to load, there is a subclass of MapLoader that is
used to load the map. These subclasses include MapGeosetLoader, MapWorkspaceLoader, and
MapTableLoader.
VB example:
Public Shared Sub MapInfo_Mapping_MapLoad()
Create an empty map
Dim map As Map = _
MapInfo.Engine.Session.Current.MapFactory.CreateEmptyMap(New Size(400,_
300))
Create a maploader. Make sure that Session.Current.TableSearchPath
points to the folder with the tables in it
Dim tl As MapTableLoader = New MapTableLoader("ocean.tab", _
"usa.tab", "mexico.tab", "us_hiway.tab")
Load tables into a map
map.Load(tl)
End Sub
MapViewList, MapView
These classes contain the objects that help to maintain a list of the previous and next views for a
Map. Use the MapViewList class as a convenience to step through your stack of map views,
displaying them with the MapView class which provides the specifics (Name, Center, and Zoom) of
each map view.
MapXtreme provides a VB sample for MapViewList in <MapXtreme Install Directory>\MapInfo\
MapXtreme\7.x.x\Samples\Desktop\Features.
MapControl
The MapControl class contains the objects that allow the user to visualize a map on a screen. Add a
MapControl to a Windows Form to view a map. A MapControl also holds the MapTools collection. A
version of MapControl exists for web applications as well.
The MapControl class for use in desktop applications is in the MapInfo.Windows.Controls
namespace. For a working example of a desktop MapControl, run Workspace Manager from the
Start menu. See also Chapter 23: Workspace Manager.
The MapControl class for use in web applications is in the MapInfo.WebControls namespace. See
Web Control Architecture. For a tutorial on how to create an overview map for a web application,
see the Tutorials section of Learning Resources, available from the Start menu.
MapXtreme v7.1
249
Developer Guide
Layers
The following section discusses the Layers objects and classes. The diagram below is a UML
representation of the Layers hierarchy.
FeatureLayer
A FeatureLayer is a layer that displays Features from a Table. For example, a layer of region objects
representing world countries is a FeatureLayer. FeatureLayers can be native .TAB data, remote
RDB, seamless, or raster data.
Layers
Each map has a collection of FeatureLayers represented by the Layers class. The order in the
collection is the order in which the layers are drawn. Methods in the collection class include Add,
Insert, Move, and Delete. The Layers collection is derived from the LayersBase class. The best way
to enumerate through the layers is to use a Layer filter.
In order to change a layer it first needs to be made editable. This can be done changing its setting in
the LayerControl or programmatically by changing its EditMode property. Once a layer is editable,
features in that layer can be moved, resized, or deleted.
Any edits made to a particular layer take effect immediately so exercise caution when
selecting features in an editable layer.
To implement a filter use the MapLayerFilterFactory class. This class allows you to create a filter
from a set of stock filters such as layer types or all visible layers. To create your own filter write a
class that implements the interface, IMapLayerFilter.
MapXtreme v7.1
250
Developer Guide
MapLayer
The MapLayer class is the base class of any layer. This class implements the IMapLayer interface.
Properties include Enabled, VisibleZoomRange, Name, and Alias. Use this class to access generic
layer properties.
UserDrawLayer
The UserDrawLayer is an abstract class that allows you to override the draw method to draw your
own layer. It provides an efficient way to add custom objects on top of a MapControl using Windows
drawing methods, instead of creating new features using map coordinates and actually adding them
to a map.
ObjectThemeLayer
The ObjectThemeLayer class contains one of three different types of themes (pie chart, bar chart,
and graduated symbol). This layer behaves just like other layers and can be grouped, have visibility
set, etc.
GroupLayer
This is class represents a group of layers that are moved and turned on/off in unison. A GroupLayer
is a LayersBase collection combined with an IMapLayer. This object also supports the ability to do
AnimationLayers.
If the layer is in a group with a VolatilityHint equal to Animate then only those layers within that group
need to be redrawn. If the Layer has a VolatilityHint equal to CacheIfPossible or Normal then all
layers need to be redrawn.
LabelLayer
The LabelLayer class is responsible for generating labels and drawing them at a particular layer
position in a map. See LabelLayer and Label Layer Settings.
GraticuleLayer
This class is used to display a grid of longitude and latitude lines in the map window. See Graticule
Layers.
Layer Filters
The IMapLayersFilter and IMapLayersFilterFactory interfaces provide support for layer enumeration.
MapXtreme v7.1
251
Developer Guide
IVisibilityConstraint
The IVisibilityConstraint is an interface which determines whether a particular object is visible or not.
This interface is implemented by a wide number of types, including all Layer types, LabelModifiers,
FeatureStyleModifiers, and Themes.
252
Developer Guide
Labels
The following section discusses the Labels objects and classes. The diagram below is a UML
representation of the Labels hierarchy.
MapXtreme v7.1
253
Developer Guide
LabelLayer
The LabelLayer class allows the separate ordering of labels and layers. A LabelLayer is a kind of
MapLayer and behaves as such. This similarity to MapLayer supports the placement of a
LabelLayer anywhere you can put a MapLayer allowing for relative positioning of the Labels
compared to the other layers in the map. Each LabelLayer is made up of LayerSources and acts as
a collection of those objects.
LabelSource
The LabelSource class graphically displays geographies as labels based on a data source and rules
that define how the source is labeled. The LabelSource is added to a LabelLayer on the Map so that
it is drawn. The LabelLayer provides positioning within the Map as well as the rules that govern the
interaction with other LabelSources. To use LabelSource class, specify a table from where to get the
data (MITable), an expression which defines the label text, and other default label properties
accordingly.
LabelModifier
The LabelModifier class is used to modify the default properties used to make a label. When the
LabelLayer generates labels for each LabelSource in its Sources collection, it first uses the
DefaultLabelProperties to generate each label. It then uses each visible LabelModifier in the
Modifiers collection.
MapXtreme v7.1
254
Developer Guide
ILabelSourceFilter
This interface allows you to enumerate through the collection of LabelSource objects in a
LabelLayer filtering on specific rules. You can also implement this interface to define your own
filtering rules.
LabelProperties
This class has label property information, such as style, positioning, etc. It supports the
representation of sparse label properties. This is very useful when using a LabelModifier to modify
only a portion of the label properties. This class also allows you to set prioritization and improved
placement of labels.
Generating Labels
The LabelLayer class generates labels when the map draws or when you call the
LabelLayer.Refresh method. Each visible label source is considered. You can have more than one
layer of labels in a map.
To generate a label for each feature in the source's table that is within current map view, the
LabelLayer class does the following:
1. Uses the DefaultLabelProperties property as the starting set of properties used to build the label.
2. Calls the Modify method of each visible label modifier in the Modifiers collection, if any. This
allows each modifier the opportunity for changing the label properties used to build the label.
3. Performs visibility constraint checks to decide whether to keep the label.
a. Checks for label visibility by comparing the visibility constraints against the current map
zoom/scale.
b. If the label is visible and overlaps and duplicates are not allowed on this label, checks for
overlap and duplicates against other existing labels. If any are found, uses Label Priorities
to decide which label to keep.
4. Adds the label to the generated labels collection if it succeeds visibility constraints.
Note that Label generation rules only apply within each label layer and not the entire map. For
example, if you set the AllowOverlap property to False in all label sources contained within all the
label layers in a map, labels from one label layer will still overlap with labels from another label layer
because the labels are generated independently between label layers.
Use the LabelLayer.Refresh method if the map has not yet drawn to generate the labels based on
the current map view.
MapXtreme v7.1
255
Developer Guide
Label Priorities
Label priorities determine which labels within the same LabelLayer are generated when either
AllowOverlap or AllowDuplicates is set to False. Note: as stated in Generating Labels, each label
layer is independent of each other, so different overlap or duplicate settings in other layers do not
factor in here.
When a label overlaps with or is a duplicate of another label in the same layer, the priorities of both
labels are compared to determine which label to keep. The process first compares the priority of
each label (known as the inter-label source). The label with higher priority is kept.
MapXtreme provides two levels of priorities for controlling the display of labels: Major and Minor.
This allows you to group and subgroup prioritization. For example, you might want cities with large
populations to have labels with a higher priority than small towns. However, you can also add a
modifier to bump up the major priority of one small town to give it a chance over the major cities.
When the Major priority is set to null (nothing in Visual Basic), the value used is the inverse of the
label's LabelSource position within a LabelLayer. The higher the index position the lower the priority.
For example, if a LabelSource is at index 3 and there are 10 LabelSources (indices from 0 to 9), the
Major priority will be 6 (the inverse of the index based on total).
When the Minor priority is set to null (Nothing in Visual Basic), the value used is based on the Key of
the Feature being labeled. The inverse of a numeric representation of the key against the number of
rows in the Table is used. For example, if there are 10 rows in the Table, the minor priority of the
label for feature in row ID 7 defaults to 3 (10 - 7 = 3). If the key is not numeric the minor priority
defaults to 0.
When Major priorities are equal, the label with the higher Minor priority is kept.
To create a priority, use an expression that results in a numeric value. For example, the expression
in C# that results in a numeric value could be a field of numeric type or an expression like the ASC
value of the first letter in the field's value:
"(1/Asc(Country))*1e6"
256
Developer Guide
Curved Labels
Curved labels are labels that follow the curve of a line. They enhance the appearance of map
features that are made up of lines, such as streets and rivers.
Curved labels are generated in the Workspace Manager by selecting the label layer, then selecting
Curve labels along segments in the Position tab. See Curved Labels.
To render curved labels via the API, use the ILayout interface and the UseRelativeOrientation
property. For labels to curve along the geometry, specify MapInfo.Text.RelativeOrientation.
FollowPath. See a code example in the Developer Reference under ILayout interface.
Adornments
The Adornments class is an unordered collection of a maps adornments. An adornment is either a
Legend, a Title, a Scalebar, or some other user-defined object. Each map contains a single
Adornments Collection. Each adornment belongs to a single AdornmentControl.
To create your own adornment, derive a class from the IAdornment interface and the
AdornmentControl abstract class.
MapXtreme v7.1
257
Developer Guide
Legends
Legends are for use in conjunction with themes. See Chapter 14: Using Themes and Legends for
more information about themes. Legends are created using the LegendFactory class. A Legend
consists of one or more legend frames. Each frame is either a ThemeLegendFrame or a
CartographicLegendFrame. Both kind of LegendFrames are created by using the
LegendFrameFactory class from the created Legend object. For manipulation and customization of
legends and their frames, use classes in the MapInfo.Mapping.Legends namespace. Classes in this
namespace include: CartographicLegendFrame, ThemeLegendFrame, LegendFormat,
LegendControl, and others.
You can set the size of the Legend with the Legend.Size property, but you cannot set the size of the
LegendFrames. The size of the LegendFrame is controlled by the amount of data it contains.
VB example:
Private Sub Page_Load(ByVal sender As Object, ByVal e As _
System.EventArgs)
LegendControl1.Map = MapControl1.Map
If Not IsPostBack Then
Dim normalLyr() As MapInfo.Mapping.LayerType = New _
MapInfo.Mapping.LayerType(1) {}
normalLyr(0) = MapInfo.Mapping.LayerType.Normal
Dim filter As MapInfo.Mapping.IMapLayerFilter = _
MapInfo.Mapping.MapLayerFilterFactory.FilterByLayerType(normalLyr)
Dim frame As MapInfo.Mapping.Legends.LegendFrame
Dim NewLegend As MapInfo.Mapping.Legends.Legend = _
MapControl1.Map.Legends.CreateLegend(New System.Drawing.Size(5, 5))
NewLegend.Format.FrameAlignment = _
MapInfo.Mapping.Legends.LegendFrameAlignment.Horizontal
Dim ftrLayer As MapInfo.Mapping.FeatureLayer
For Each ftrLayer In _
MapControl1.Map.Layers.GetMapLayerEnumerator(filter)
frame = _
MapInfo.Mapping.Legends.LegendFrameFactory.CreateCartographic_
LegendFrame(ftrLayer)
NewLegend.Frames.Append(frame)
Next
LegendControl1.Legend = NewLegend
Else
LegendControl1.Legend = MapControl1.Map.Legends(0)
End If
End Sub
ScaleBar Adornment
A scale bar is linear object used to measure map distances in the units of the map (such as
kilometers or feet). Use the ScaleBarAdornment class to create a ScaleBarAdornmentControl and
add the control to the map. If you attempt to add a ScaleBarAdornment to the map itself, it does
display, but without the ScaleBarAdornmentControl, the ScaleBar is not linked to the map itself.
VB example:
MapXtreme v7.1
258
Developer Guide
Title Adornment
A Title adornment is a text object drawn on the map to represent a map title or to provide a text to
clarify other information on the map. In MapXtreme you use the TitleAdornment class to create a title
and add it to the map.
VB example:
Public Shared Sub MapInfo_Mapping_TitleAdornment(ByVal mapControl1 As
MapControl)
Create a Titlebar
Dim ta As New MapInfo.Mapping.TitleAdornment(New
System.Drawing.Size(100, 50), mapControl1.Map)
ta.Title = "This is a watermark"
mapControl1.Map.Adornments.Append(ta)
End Sub
MapXtreme v7.1
259
Developer Guide
FeatureStyleModifier
This is an abstract base class from which all modifiers must derive. The IndividualValue, Ranged,
and DotDensity themes are all FeatureStyleModifier objects. You can create your own class that
derives from FeatureStyleModifier and override the Modify() method.
FeatureStyleModifiers
The FeatureStyleModifiers class is an ordered collection of FeatureStyleModifier objects contained
within each FeatureLayer. Each modifier in the collection is called in order before a features
geometry is drawn.
FeatureOverrideStyleModifier
The FeatureOverrideStyleModifier is a simple kind of FeatureStyleModifier. This class provides style
override functionality at the Layer level. The FeatureOverrideStyleModifier has a composite style
and implements the IVisibilityConstraint. This is similar to functionality found in MapX and MapInfo
Professional.
MapXtreme v7.1
260
Developer Guide
MapXtreme v7.1
261
Developer Guide
Finding Locations
In this chapter:
13
263
Developer Guide
Address to
Find
Search Table
Address
Comment
Correctable with
Abbreviation File for an
Exact Match
LaSalle Street
LaSalle St
Yes
LaSalle Ave
LaSalle Av
Yes
LaSalle Ave
LaSalle St
No
LaSalle
LaSalle St
LaSalle St
North
LaSalle St
No
LaSalle St
North
LaSalle St N
Yes
LaSalle St Apt
3
LaSalle St
Tenth St
10th St
Yes
10th Av
Tenth Av
Yes
Saint Johns
Lane
St Johns Lane
Yes
If you find that you have repeated situations that do not match due to abbreviations, you can:
MapXtreme v7.1
264
Developer Guide
Edit the abbreviations file with a text editor to add your specific abbreviations. The mapinfow.abb
is located in C:\Program Files\Common Files\MapInfo\MapXtreme\7.x.x. For more information
about editing the abbreviations file, see Fine Tuning the Find Process.
Find Results
MapXtreme returns either an exact match, one or more close matches, or a failed match. The results
depend on a number of factors including the quality of the input data and the conditions set for the
operation. Information is also returned that explains how well each portion of the address matched
(or failed to match).
MapXtreme v7.1
265
Developer Guide
Find
The Find object is used to locate a map object, street address, or street intersection within a given
mappable table. Find searches the table for a match and returns the result(s) in a FindResult object.
To use Find in MapXtreme, you must have:
The Find class provides a number of properties to control the search operation. For example, you
can limit the number of close matches to be returned (CloseMatchesMax) or indicate that you wish
to use the abbreviation file for increasing the likelihood of a match (UseAbbreviations).
MapXtreme v7.1
266
Developer Guide
Property
Description
AddressNumberAfterStreet
ChooseAlternateBoundary
ChooseClosestAddressRange
ChooseClosestObject
CloseMatchesMax
InsetDistance
A positive value representing how far from the ends of the line to
adjust the placement of an address location.
InsetPercentage
InsetUnit
OffsetDistance
OffsetUnit
UseAbbreviations
UseCloseMatches
UseInsetAsPercentage
The Find class provides four search methods: two for searching addresses or features with or
without a refining boundary, and two for searching street intersections with or without a refining
boundary.
MapXtreme v7.1
267
Developer Guide
Method
Description
Search
SearchIntersection
Dispose
.FindAddressRange
The FindAddressRange object represents an address range item returned from the Find.Search
method. The FindAddressRange object is returned as part of the FindResult object when a street
address is not found, the address number is not within the minimum/maximum address ranges for a
given street, or an address number was not specified.
Code Sample
public void GetAddressRangesOnStreetTable()
{
Table_table;
_table =
Session.Current.Catalog.OpenTable("North_Greenbush.tab");
Find _find = new Find(_table,_table.TableInfo.Columns[1]);
FindResult _findResult= _find.Search("Meadow Dr");
If ((!_findResult.ExactMatch) && (_findResult.NameResultCode ==
FindNameCode.ExactMatch)&& (findResult.AddressResultCode ==
FindAddressCode.AddressNumNotSpecified))
{
FindAddressRangeEnumerator _enum =
_findResult.GetAddressRangeEnumerator();
FindAddressRange _findAddressRange;
int _iIndex = 0;
while (_enum.MoveNext())
{
_findAddressRange = _enum.Current;
Console.WriteLine("_findAddressRange.BeginRange");
Console.WriteLine("_findAddressRange.EndRange");
_iIndex++;
}
if(_table != null)
{
_table.Close();
MapXtreme v7.1
268
Developer Guide
FindCloseMatch
The FindCloseMatch object represents a close match item returned from the Find Search method.
The object is returned as part of the FindResult object. A close match item is a returned match that
closely matches the name of the requested search.
To use this feature, you must first set the UseCloseMatches and CloseMatchesMax properties of the
Find object before you execute your search. For example if you tried to search for Washington
Street, and UseCloseMatches was set to true, a close match would be Washington Ave.
Code Sample
public void CloseMatchesOnStreetTable()
{
Table _table;
_table = Session.Current.Catalog.OpenTable("Rensselaer.tab");
Find _find = new Find(_table,_table.TableInfo.Columns[1]);
_find.UseCloseMatches = true;
_find.CloseMatchesMax = 5;
FindResult _findResult= _find.Search("70 Washington");
if ((!_findResult.ExactMatch) && (_findResult.NameResultCode ==
FindNameCode.ExactMatchNotFound))
{
FindCloseMatchEnumerator _enum =
_findResult.GetCloseMatchEnumerator();
FindCloseMatch _findCloseMatch;
int _iIndex = 0;
while (_enum.MoveNext())
{
_findCloseMatch = _enum.Current;
Console.WriteLine(_findCloseMatch.Name);
_iIndex++;
}
}
if(_table != null)
{
_table.Close();
_table = null;
}
MapXtreme v7.1
269
Developer Guide
FindResult
The FindResult class returns information from the Find.Search method in the form of properties that
explain what kind of match was made, as shown in the table below. If successful, the FoundKey
property contains the key of the object to be located. If successful, the FoundPoint property contains
the point of the object located.
Property
Description
AddressOutOfRange
AddressResultCode
Identifies the result code for the address part of the search and returns a
FindAddressCode enumeration.
BoundaryResultCode
Identifies the result code for the refining boundary part of the search and
returns a FindBoundaryCode enumeration.
ExactMatch
FoundKey
FoundPoint
IntersectionNotFound
MultipleMatches
NameResultCode
Identifies the result code for the name being searched on and returns a
FindNameCode enumeration.
ResultCode
If the Find results is an exact match, the value is one. If the Find results
in an approximate match, the value is greater than one. If the Find fails to
match the address, the result is a negative value.
UseSubstitution
FindAddressCode Enumeration
Identifies the result code for the address part of the search and is returned by the
FindResult.AddressResultCode property.
MapXtreme v7.1
This result code should only be used when searching for a street or intersection.
270
Developer Guide
Member Name
Description
ExactMatch
SideOfStreetUndetermined
WithinMinMax
NotWithinMinMax
AddressNumNotSpecified
StreetsDoNotIntersect
NoMapObjectForRowMatched
FindBoundaryCode Enumeration
Identifies the result code for the refining boundary part of the search and is returned by the
FindResult.BoundaryResultCode property. A refining boundary is used to distinguish between
multiple features with the same name.
This result code should only be used when a region is being used to refine the search.
Member Name
Description
ExactMatch
FoundInOneOtherRegion
FoundInMoreThanOneRegion
The name was found in more than one region other than
the specified region.
NoRegionSpecifiedOneMatch
NoRegionSpecifiedMultipleMatches
MultipleMatchesFound
FindNameCode Enumeration
Identifies the result code for the name being searched on and is returned by the
FindResult.NameResultCode property.
MapXtreme v7.1
271
Developer Guide
Member Name
Description
ExactMatch
SubstitutionUsed
ExactMatchNotFound
NoObjectNameSpecified
CloseMatch
272
Developer Guide
MapXtreme v7.1
273
Developer Guide
!SPACE
Simple truncation
!EOLNOSPACE
Space-delimited truncation
!EOLSPACE
Simple substitution
!NOSPACE
In order for MapXtreme to know how to interpret a line, or set of lines, in the abbreviation file, you
have to precede the line with the keyword which indicates the appropriate interpretation strategy.
When all of the entries in the abbreviation file use the default interpretation, there is no need to
precede any of them with a keyword. When there is no keyword at the beginning of the abbreviation
file, MapXtreme will treat the initial entries as requiring the default interpretation. Once you add other
types of substitution pairs, however, you have to start adding keywords.
Space-delimited Substitution
Space-delimited simple substitution is the default. What that means is this: MapXtreme compares
spaced-delimited tokens in target addresses with the rows in the address file. A space-delimited
token is a string of characters with a space before and a space after. For example, MapXtreme will
match Ave with Av in Park Ave but it will not match Avery Blvd to Avry Blvd. Both street
names contain the string Ave. But that string is bordered by spaces only in Park Ave, not in
Avery Blvd. In Avery Blvd, Ave is followed by r, not by a space.
All of the entries in the abbreviation file will receive this default interpretation. You can add other
items to receive the same treatment. For example, you might want to add the pair WK WALK so
that MapXtreme knows to interpret WK in a target address as though it were WALK. Similarly, you
might want to add a pair such as: WAY WY.
Use the keyword !SPACE to indicate space-delimited simple substitution. Entries following
!SPACE are given the default interpretation (this allows you to arrange the Abb.file contents in
some other order). When MapXtreme encounters another keyword, it switches to the indicated
interpretation strategy.
Simple Truncation
In simple truncation, MapXtreme finds an item in the address and simply ignores it and everything
after it. These items do not have to be space-delimited. This strategy is useful for dealing with
addresses such as:
123 Appian Way, Mail Stop 829
7305 Van Zandt # 23
In the first case, you want MapXtreme to ignore the comma and everything after it. In the second
case you want MapXtreme to ignore the number sign and everything after it. To deal with such cases
add the following to your abbreviation file:
!EOLNOSPACE
,
MapXtreme v7.1
274
Developer Guide
Space-Delimited Truncation
In space-delimited truncation MapXtreme looks for items which are space delimited and eliminates
those items and everything following. For example:
73 Appian Way Suite 829
3033 Van Zandt Room 202
To deal with such cases add the following to your abbreviation file:
!EOLSPACE
SUITE
ROOM"
!EOLSPACE is the keyword indicating that the following items are to be treated as cases of simple
truncation. After that we have one line with Suite and one with a ROOM. Whenever MapXtreme
encounters those tokens it will truncate the address. The examples become:
73 Appian Way
3033 Van Zandt
Simple Substitution
MapXtreme uses simple substitution to remove items from an address and otherwise does nothing.
Use it to deal with:
433 Van-Rensselaer
91 St Albans
The goal is to strip out the hyphen and the apostrophe. Make the following entries to the
abbreviation file:
!NOSPACE
NOSPACE is the keyword calling for simple substitution, and the hyphen and apostrophe on the
following lines are the tokens to be removed. The examples become:
369 VanRensselaer
91 St Albans
MapXtreme v7.1
275
Developer Guide
Legitimate Spaces
There are cases where you want to indicate a substitution in which the searched for string contains
spaces. You can use double quotes in such cases. Place a double quote:
For example, you might want to substitute STHWY for State Highway. To do that, use the
following line:
"State Highway"STHWY"
This provides a solution to a subtle problem, that of street names which match items in the
abbreviation file. For example, North St and Park Av both have initial strings which match terms in
the abbreviation file. Consequently, MapXtreme will substitute N for North to yield N St and Pk
for Park to yield Pk Av. You could add the following lines to the Abbreviation file to rectify these
substitutions:
"N ST"North ST"
"PK AV"PARK AV"
Note that these lines have to come after the entries which substitute N for North and PK for
Park. If they came before, they would have no effect. Thus:
...
...
NORTH
N
...
...
PARK
PK
..
....
"N ST"NORTH ST"
"PK AV"PARK AV"
...
...
When MapXtreme encounters NORTH N it will turn NORTH ST into N ST. When it encounters N
STNORTH ST it will then turn N ST into NORTH ST. PARK AV is treated similarly.
Special Characters
MapXtreme uses the exclamation point (!), the double quote (") and the backslash (\) as special
characters. These characters tell MapXtreme how to treat strings which follow them, but are not
themselves ordinarily treated as characters in substitution strings. The exclamation point tells
MapXtreme that the string should not be interpreted as an abbreviation. The double quote tells
MapXtreme that spaces in the string are legitimate. And the backslash tells MapXtreme to treat a
special character as an ordinary character.
When you want to use any of these in a line where they are to be treated as simple characters,
precede them by a backslash. Thus:
\!
MapXtreme v7.1
276
Developer Guide
MapXtreme v7.1
277
Developer Guide
MapXtreme provides you many options for adding thematics and legends to
your map. The following sections illustrate the different types of themes and
legends available to you and explains how to use them.
In this chapter:
14
Thematics Overview
Thematic mapping allows you to present trends in data that would be difficult to see from tabular
data. The theme is usually some piece or pieces of your data. You thematically shade a map using
data from a data source, such as a native MapInfo table. For example, you can thematically shade a
map of the United States based on the average temperature of each state. When you see red, you
know it is hot (high number of degrees); where you see blue, it is cold (low number of degrees).
Themes represent your data with shades of color, fill patterns, or symbols. There are many uses for
thematic maps to display your data. You create different thematic maps by assigning these colors,
patterns, or symbols to map objects according to specific values in your data.
Mapping.Thematics Namespace
The MapInfo.Mapping.Thematics namespace contains classes that implement themes as style
overrides on Feature layers and as Object themes. Modifier themes change the style, while object
themes add a new layer. All themes implement the ITheme interface.
Modifier Themes
An example of a feature modifier theme are ranged, individual value and dot density thematic maps.
They modify existing features in a layer. The following UML diagram gives an overview of the
modifier theme hierarchy.
MapXtreme v7.1
279
Developer Guide
Object Themes
Object themes include graduated symbol, and pie and bar charts. These themes create objects that
represent the data values. The following UML diagram gives an overview of the object theme
hierarchy.
GraduatedSymbolTheme
A graduated symbol theme is an object theme that contains point features whose symbol sizes are
based on the numeric values of the theme's expression.
For instance, use graduated symbols to show housing income for a particular segment of the
population across an area.
MapXtreme v7.1
280
Developer Guide
MapXtreme v7.1
281
Developer Guide
PieTheme
A pie theme is an object theme containing pie charts with wedges that represent each data value. In
pie charts you compare the wedges in a single pie, or examine a particular pie wedge across all of
the pies. Pie charts also enable you to compare parts of a whole.
pieTheme.DataValueAtSize /= 2
pieTheme.GraduateSizeBy = GraduateSizeBy.Constant
thmLayer.RebuildTheme()
End Sub
MapXtreme v7.1
282
Developer Guide
BarTheme
A bar theme is an object theme that contains bar charts with bars that represent each data value. A
bar chart is built for every map object (feature) at the centroid of the object, enabling you to analyze
several thematic variables in a particular chart by comparing the height of the bars.
MapXtreme v7.1
283
Developer Guide
RangedTheme
A ranged theme shows data grouped into ranges (bins) according to specific criteria. In MapXtreme
a ranged theme modifies an existing layer to reflect that criteria. It does not create a new layer, as
range themes did in previous versions of MapX and MapXtreme. When you create a ranged
thematic map, MapXtreme groups all dataset rows into ranges and assigns each rows object the
color, symbol, or line for its corresponding range.
284
Developer Guide
Equal count
Equal ranges
Standard Deviation
Natural break
Quantile
Custom
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, MapXtreme 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), its 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. MapX produces ranges 125, 2650, 5175, and 76100. Keep in mind that MapXtreme
may create ranges with no data records, depending on the distribution of your data.
Standard Deviation
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.
Natural Break
Natural Break is a way to show data that is not evenly distributed. It 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.
Quantile
Quantile is a second way to show data that is not evenly distributed. Quantiling uses two variables
expressions. For example, use the Quantile distribution method to show the literacy rate as tied to
population.
MapXtreme v7.1
285
Developer Guide
Custom Ranges
If none of the distribution methods meet your needs, you can create custom ranges using the
method DistributionMethod.CustomRanges,. See the code example in the MapXtreme Developer
Reference Help under the MapInfo.Thematics.RangedTheme.Recompute method.
VB example:
Public Shared Sub MapInfo_Mapping_Thematics_RangedTheme(ByVal map As Map)
Create a ranged theme.
Dim lyr As FeatureLayer = CType(map.Layers(0), FeatureLayer)
Dim theme As MapInfo.Mapping.Thematics.RangedTheme = New _
MapInfo.Mapping.Thematics.RangedTheme(lyr, Pop_1990/Area(obj,_
'sq mi'), PopDensity, 5,DistributionMethod.EqualCountPerRange)
Add the ranged theme to the layer.
lyr.Modifiers.Append(theme)
End Sub
RangedLabelTheme
This class creates a range theme in which labels are drawn with a range style. For a more detailed
discussion of ranged themes, see the section RangedTheme.
MapXtreme v7.1
286
Developer Guide
IndividualValueTheme
An Individual Value theme is a modifier theme that show points, lines, or boundaries that are shaded
by individual values contained in a particular field of a dataset. You can use both numerical and
nominal values in individual values maps. MapXtreme gives each unique value its own distinct style.
For example, use an IndividualValue theme to show zoning classifications for parcels of land. Each
zone (commercial, residential, industrial) would display in a different color. Parcels that match the
zone classification would be shaded in that color.
287
Developer Guide
MapXtreme v7.1
288
Developer Guide
IndividualValueLabelTheme
This class creates an individual value thematic which operates on a layer's labels. For a more
detailed discussion of individual value themes, see the section IndividualValueTheme.
MapXtreme v7.1
289
Developer Guide
DotDensityTheme
A dot density theme is a style modifier that draws the fill pattern of a region, using dots based on the
numeric value of the theme's expression.
Dot density maps use dots to represent the data value associated with a boundary or region. The
total number of dots in a region represents that regions 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.
MapXtreme v7.1
290
Developer Guide
If you have a non-numeric variable, one of your maps must be an individual values map. You cannot
create a bivariate map with two non-numeric variables.
Displaying Attributes
To display two variables within one symbol, it is important to choose a different symbol attribute for
each variable. For example, you cannot choose color for both variables because one color will
overwrite the other. Choose from the following combinations:
Symbol type should only be used for nominal or non-numeric data, as there is no inherent
association between a symbol type and a quantity.
VB example:
Public Shared Sub MapInfo_Mapping_Thematics_RangedThemeConstructor(ByVal
lyr As FeatureLayer)
Dim thm As MapInfo.Mapping.Thematics.RangedTheme = New _
MapInfo.Mapping.Thematics.RangedTheme(lyr, Literacy, Pop_1994, _
Literacy Quantile by Pop, 4)
lyr.Modifiers.Append(thm)
End Sub
Legends Overview
The MapInfo.Mapping.Legends namespace contains classes, interfaces and enumerations for
creating and displaying thematic and cartographic legends. Legends are a collection of Thematic or
Cartographic LegendFrames. Each frame contains a collection of LegendRows, Each LegendRow
has text and a style property.
MapXtreme v7.1
291
Developer Guide
Theme Legends
Theme legends provide a key of colors, symbols, and styles used for themes. This key explains
what the colors, symbols, and styles represent.
Cartographic Legends
The cartographic legend class allows you to read and write cartographic legend metadata. The
legend identifies each cartographic feature on the map using text and a style from the metadata.
MapXtreme v7.1
292
Developer Guide
Formatting a Legend
The MapInfo.Mapping.Legends.LegendFormat class contains properties that control how frames
within a legend are drawn. You can control display properties such as alignment, the number of
legend frames per row or column, spacing between frames, and whether the legend size and frame
positions should be automatically adjusted.
The LegendFormat.FrameAlignment property is used in conjunction with the FramesPerRow for
horizontal alignment and FramesPerColumn for vertical alignment.
For example, if your legend contains 10 frames, and you set the FrameAlignment to Horizontal and
the FramesPerRow to 5, the legend will display two rows of frames with five frames in each row. If
you had 10 frames per row, the 10 frames would display in a single row 10 frames wide.
Similar behavior happens with vertical alignment. If you have 10 frames and you set the
FrameAlignment to Vertical and the FramesPerColumn to 5, you will end up with 5 rows of 2 frames
(5 rows in 2 columns). The frames were aligned vertically up to 5 frames per column. When
FramesPerColumn is set to 10, the legend would contain 10 rows of 1 frame each (10 frames per
column).
The default setting for FramesPerRow and FramesPerColumn is 0. The value used is the current
number of frames in the row or column as indicated by LegendFrameRows.Count or
LegendFrameColumns.Count properties.
MapXtreme v7.1
293
Developer Guide
In this chapter:
15
Styles are used in many areas of MapXtreme including the lines, interior fills and point styles that
represent geographic features. Styles are also an integral part of labels, text, layouts, themes,
overrides, legends and selections. Style properties range from standard color fills, line width and
point size, to background effects, bitmaps as point styles, and rotation angle. Practically any style
property you can imagine is available for you to incorporate into your application. Styles can be
changed globally or per feature, overridden for the current display or made as a permanent change.
MapXtreme v7.1
295
Developer Guide
StyleFactory
A StyleFactory class is available from MapInfo.Styles that contains methods to generate MapInfo
Style objects from various types of style parameters. For example, MapInfo.Styles.
StyleFactory.FromMBstring takes a MapBasic style clause as string input and returns a
CompositeStyle. See the online Developer Reference for more information and a code example.
Style Descriptions
AreaStyle
The AreaStyle class contains style properties used for drawing regions. Regions are drawn using a
BaseLineStyle and BaseInterior.
BitmapPointStyle
The MapInfo BitmapPointStyle class contains style properties for drawing points using custom
bitmaps. Use this class for marking point locations. BitmapPointStyle is one of three types of
supported point styles, the others being FontPointStyle and SimpleVectorPointStyle.
BitmapPointStyle has a ShowWhiteBackground property; if set to false, any white pixel in the bitmap
is transparent. By default, ShowWhiteBackground is set to false. For example, you may wish to use
your corporate logo to represent office locations worldwide, but do not want to cover up other map
features in the immediate area. There are other settings that control how BitmapPointStyles are
displayed. See the BitmapStyles enumeration in the online help for more details.
MapXtreme v7.1
296
Developer Guide
CompositeStyle
The CompositeStyle class encompasses the collection of all the style types used for default styles,
modifier styles, and layer override styles. The CompositeStyle can also be used to describe styles
for the Collection object type. The style types contained are AreaStyle, a BaseLineStyle derived
class, TextStyle, a BasePointStyle derived class, RasterStyle and GridStyle. The CompositeStyle
can be constructed with any or all of these types, but must contain at least one of the above.
For example, you can create a style override (a FeatureOverrideStyleModifier) to alter the
appearance of all features in a layer. Since a single layer can contain points and lines and regions,
you might need to specify point, line and area styles when you build your style override. You can
specify all necessary style types in one CompositeStyle object, which you then pass to the
FeatureOverrideStyleModifier constructor.
SimpleInterior
The MapInfo SimpleInterior class contains style properties used for filling the interior of regions.
SimpleInterior attributes include pattern, foreground and background color, and background
transparency. The default for a SimpleInterior is a solid white interior.
Font
The MapInfo Font class contains style properties used for drawing text. Attributes for fonts, include
bold, italic, underline, strikeout, shadow, halo, all caps, double space, size, foreground and
background color. You can also change the font type (e.g., Arial, Times New Roman) and the font
size. Note that the outline font property has been removed. To create an outline, use halo with a
black background.
FontPointStyle
The FontPointStyle class contains style properties used for drawing points using mainly the
MapInfo.Styles.Font class. You can customize the point size, font color, angle of rotation and other
font properties. The maximum point size allowed is 240 points.
GridStyle
This is a helper class containing display style information about a grid such as color inflections, null
cell color and transparency. A grid is a map of continuous color gradation that represents
interpolated data values. For more information on grids see Chapter 17: Working with Rasters
and Grids.
MapXtreme v7.1
297
Developer Guide
RasterStyle
This is a helper class containing display style information for a raster image including brightness,
contrast, grayscale (color on/off), transparency, and translucency. For more information on raster
images see Chapter 17: Working with Rasters and Grids.
Hillshade
This is a helper class used to store the parameters for hill shading on a grid. Hill shading, also called
relief shading, can be added to grid maps to show the effect of a light source on the map. This gives
a grid map greater definition, particularly useful for elevation maps. Hill shade properties include the
horizontal and vertical angles of the light source, and a vertical scale factor. For more information on
grids see Chapter 17: Working with Rasters and Grids.
Inflection
This is used to hold a single inflection point which associates a color with a value. A grid has an
array of inflections to represent its colors. A grid map is a map that shows a gradual color change
across an area. The blending of one color into the next is due to the inflection. For more information
on grids see Chapter 17: Working with Rasters and Grids.
SimpleLineStyle
The SimpleLineStyle class contains style properties used for drawing polylines based on the
MapBasic Pen clause. It is used for map features such as streets and cable lines, as well as borders
around regions. Attributes to describe SimpleLineStyles include pattern, width (in pixels or points)
and color. The default for a SimpleLineStyle is a solid black 1-pixel wide line. Units for
SimpleLineStyle are pixels (default) or points.
The LineWidth class in the MapInfo.Styles namespace is a helper class used to define the width and
units of a line style.
BasePointStyle
This is an abstract base class for all MapInfo point styles. It cannot be instantiated.
SimpleVectorPointStyle, BitmapPointStyle and FontPointStyle derive from this class.
BaseLineStyle
This is an abstract base class for all MapInfo line styles. It cannot be instantiated. SimpleLineStyle
derives from this class.
BaseInterior
This is an abstract base class for all MapInfo interior styles. It cannot be instantiated. SimpleInterior
derives from this class.
MapXtreme v7.1
298
Developer Guide
StockStyles
This class contains static methods to create various default style objects, including black, blue, red
and white interiors, black, blue, and red lines, hollow interiors and lines, and default fonts and point
styles.
SimpleLineStyle redLine = StockStyles.RedLineStyle( );
TextStyle
This class contains style properties used for drawing text. It contains a MapInfo.Styles.Font class
and a BaseLineStyle derived class for callout lines. The BaseLineStyle is optional (the TextStyle may
or may not contain one).
SimpleVectorPointStyle
This class contains style properties for drawing points using MapInfo's 3.0 Compatible proprietary
font (MapInfow.fnt ships with MapXtreme). SimpleVectorPointStyle properties include color, point
size and the shape code of the actual symbol you wish drawn for the point. The standard set
includes symbols 31 through 67.
Another symbol font set, called MapInfo Symbol, is a TrueType font set that displays using
the FontPointStyle class.
StyleRepository Class
The StyleRepository class contains style collection classes (VectorSymbolRepository,
BitmapSymbolRepository, LineStyleRepository, InteriorStyleRepository), which allows you to iterate
through all current styles, as well as reload the collections with new styles from a specific file(s) or
directory. The StyleRepository class also contains a repository (TrueTypeFontInfoRepository) that
represents information about the TrueType fonts installed on the system.
The VectorSymbolRepository represents the set of symbols from the MapInfo 3.0 Compatible
symbol set. The BitmapSymbolRepository represents the set of images currently found in the
CustSymb directory. The LineStyleRepository represents the current set of patterns available for line
styles. And the InteriorStyleRepository represents the set of interior patterns available.
MapXtreme v7.1
299
Developer Guide
Using Styles
Styles and Layer Control
Use LayerControl at design or runtime to modify and override styles. See the sample application
LayerControl for an introduction to the MapInfo.Windows.Controls.LayerControl object model. This
code sample uses a LayerControl object directly on a form; it does not demonstrate using the
LayerControlDlg dialog box, which is a related, but separate class. Every operation demonstrated in
this code sample could be applied to a LayerControlDlg object, as well, since the LayerControlDlg
class exposes a LayerControl property.
LayerControl is discussed in Chapter 7: Desktop Applications, Controls, Dialogs, and Tools and
in Chapter 23: Workspace Manager.
MapXtreme v7.1
300
Developer Guide
Overriding Styles
Styles can be permanently changed for features by saving the new style to the table. Styles for
features can also be changed for the current display (not permanent) by overriding the current style
For example, a ranged theme overrides the style of a region object to shade it. See Chapter 14:
Using Themes and Legends for more information.
Label styles can also be overridden. This section introduces you to the main style override class for
features. See more about features and labels in the chapter on the Mapping namespace Layers and
Labels.
FeatureOverrideStyleModifiers
This class implements FeatureStyleModifier to override a features style. Its Style property is a
composite style object that is used to specify what parts of a feature's style to override.
The contents of the style object passed to the Modify() method change dynamically for each feature
that is drawn. This increases the drawing speed of layers that contain style modifiers. It is therefore
important to make a copy of the style object if you need to use it elsewhere in your application. You
should also note that for the CompositeStyles in the Style Stack passed to the
FeatureStyleModifier.Modify() method, the Changed event does not fire.
301
Developer Guide
In this chapter:
16
Geometries
The Geometry class allows for the creation, editing, and other manipulation of geometry objects.
Classes which inherit from the Geometry class and represent types of Geometry objects include
Point, MultiPoint, Polygon, MultiPolygon, Curve, CurveSegment, LineString, and Ring. The following
legacy classes are also inherited from the Geometry class: Rectangle, RoundedRectangle, Ellipse,
LegacyArc, and LegacyText.
The Geometry class represents the topmost level of the MapInfo Geometry object model. This class
is abstract, and cannot be instantiated. All classes that derive from this class contain knowledge
concerning their coordinate system. All classes are able to make copies of themselves, and
compare themselves to other Geometry objects for equality.
The diagram below shows a representation of the Geometry model.
MapXtreme v7.1
303
Developer Guide
Geometry Objects
All geometry objects in MapXtreme are created with a specific coordinate system that cannot be
changed. If you need to alter the coordinate system of an object you can make a copy of that object
in the new coordinate system.
MapXtreme v7.1
304
Developer Guide
FeatureGeometry Objects
The FeatureGeometry class is specifically designed to contain classes that can be placed in tables
and that can be parts of Features and FeatureCollections. In order for something to be displayed in
a map, it needs to be in a table. FeatureGeometry objects are by definition included in tables. Any
object that is a subclass of Geometry and not a subclass of FeatureGeometry cannot be saved to a
table or included as part of a Feature or FeatureCollection. An exception is thrown, or the program
will not compile, if such an operation is attempted. The FeatureGeometry class, like the Geometry
class is abstract and cannot be instantiated.
Point
Points are derived from the FeatureGeometry class and represent a single point on a map. Points
can be contained within a MultiPoint collection and then operated upon collectively.
Use the following example code to model the creation of a Point:
using MapInfo.Geometry;
using Mapinfo.Design.Windows;
CoordSys longLatNad83;
CoordSysFactory coordSysFactory = new CoordSysFactory();
longLatNad83 = coordSysFactory.CreateLongLat
(MapInfo.Geometry.DatumID.NAD83);
DPoint point = new DPoint(0.0, 0.0);
Point pointGeometry = new Point(LongLatNad83, point);
MultiPoint
A MultiPoint contains an unordered, disconnected set of Points and is useful for performing multiple
operations on multiple points.
Use the following example code to model the creation of a MultiPoint object:
using MapInfo.Geometry;
MapXtreme v7.1
305
Developer Guide
MultiCurve
The MultiCurve class is derived from the FeatureGeometry class, and contains a possibly
disconnected set of Curves. These Curves may interact in many ways; they can be connected or
disconnected, and can intersect or overlap each other.
Although the Geometry object model supports multiple CurveSegments for each Curve, the current
version of the MapInfo engine is limited to having one CurveSegment per Curve that is part of a
FeatureGeometry (i.e., MultiCurve). This limitation derives from the current TAB file format, which
remains largely unchanged for this version of MapInfo. Hence, the limitation concerns
FeatureGeometry objects only.
Upon construction of a MultiCurve where the constructor takes a Curve or Curves which may
contain multiple CurveSegments per Curve, the actual Curves contained in the constructed
MultiCurve are altered to always contain only one CurveSegment per Curve. Currently, the only
types of CurveSegments that exist are LineStrings. Curves containing multiple LineString
CurveSegments have the LineStrings combined to form one large LineString.
Upon completion of editing (signified by calling EditingComplete(), any Curve which was added to
the MultiCurve and contained multiple CurveSegments is altered in a similar manner as noted above
to produce Curves containing single CurveSegments.This limitation, of Curves contained in
MultiCurves always containing only a single CurveSegment, should be removed in future versions of
MapInfo as new types of CurveSegments are introduced (e.g., EllipticalArcs, CircularArcs, and
Splines), and the TAB file format is altered. Also, during construction and on completion of editing,
any empty Curves are automatically removed from the MultiCurve.
Line objects made up of two points that exist in MapInfo TAB files become MultiCurve
FeatureGeometry objects. They can be detected as two-point Lines by using the IsLegacyLine
property of the MultiCurve:
See the Developer Reference for a code example of creating and editing a MultiCurve object.
Measure Values on MultiCurves
The Geometry object model supports M and Z values on FeatureGeometry objects. M, or measure
values, hold data at the nodes of MultiCurve objects that describes anything you wish to map and
analyze, including physical assets, conditions or events. The M values play an important role in
linear referencing and dynamic segmentation. For more information, see Chapter 21: Linear
Referencing.
MapXtreme v7.1
306
Developer Guide
LineStrings
A LineString is a directed collection of sequential points that are connected in a linear manner. Any
two consecutive points in the LineString are connected by a straight line. LineStrings can be part of
Curves or Rings, or they can exist as a stand-alone Geometry. LineStrings that are part of Curves or
Rings inherit the coordinate system of their container. Stand-alone LineStrings can be empty. A
LineString that is contained in a Curve or Ring that is not in Edit Mode cannot be empty, and must
contain at least two points.
See the Developer Reference for a code example.
Rectangle
A Rectangle Geometry contains two points representing the lower left hand and upper right hand
corners of the Rectangle. The other two points are implied. Rectangles are always axis aligned, and
always appear to be rectangular in shape, regardless of the coordinate system, and are not
projected. They do not contain any warping that may be represented by the coordinate system.
See the Developer Reference for a code example.
RoundedRectangle
A Rounded Rectangle behaves exactly like a Rectangle but is displayed with the corners appearing
rounded as a display-time only feature. The corners display as quarter circles and the radius of the
circle is controlled by the CornerRadius parameter.
Because RoundedRectangle objects, like rectangle objects, are defined by two points and always
display axis-aligned and unprojected, they are designed to be used primarily for cosmetic display
purposes. While many operations are available using Rectangle objects (e.g., Combine), internally,
a MultiPolygon copy of the Rectangle is used for these operations. The resulting MultiPolygon
MapXtreme v7.1
307
Developer Guide
Ellipse
The Ellipse is inscribed in an axis-aligned rectangle defined by a DRect. The DRect is defined by two
points, the opposite corners of a rectangle, with the other two corners of the rectangle implied. The
Ellipse displays as if it were unprojected, regardless of the coordinate system, and any skew that
may be represented by the coordinate system.
Because Ellipse objects are defined by two points and always display axis-aligned and unprojected,
they are designed to be used primarily for cosmetic display purposes. While many operations are
available using Ellipse objects, internally, a MultiPolygon copy of the Ellipse is used for these
operations. The resulting MultiPolygon is effected by the coordinate system and in some cases may
no longer appear as a perfect ellipse.
See the Developer Reference for a code example.
LegacyArc
The LegacyArc object is a portion of an Ellipse and is defined by a DRect, a start angle, and an end
angle. The Ellipse is constructed to be inscribed in the rectangle defined by the DRect. The
rectangle, in which the Ellipse is inscribed, is axis-aligned and is always rectangular regardless of
the coordinate system used. The angles are measured in degrees with zero being along the positive
X-axis and positive angles being in the counterclockwise direction. The angles are only stored to a
tenth of a degree resolution with values between 0.0 and 360.0.
Because LegacyArc objects are defined by two points (for the DRect) and angles, and are always
displayed axis aligned, they are designed to be used primarily for cosmetic display purposes. While
many operations are available using LegacyArc objects, internally, a MultiCurve copy of the
LegacyArc is used for these operations. This can sometimes lead to unexpected results.
See the Developer Reference for a code example.
LegacyText
The LegacyText object is the MapInfo Professional equivalent of a text object. If a given database
does not support Text the LegacyText object can be lost when using that format. LegacyText objects
are placed within a geographically-sized rectangle with a lower-left anchor point specified. The pointsize of the text is based upon what fits best within the rectangle.
LegacyText objects do not fit nicely into the Geometry model. Several methods available on the
Geometry FeatureGeometry classes, such as Combine, make no sense for LegacyText and will
throw a NotSupportedException. Text objects do exist in MapInfo native TAB files in the Geometry
column. The LegacyText class provides a way to access these objects. Refer to online reference for
specific behaviors of LegacyText objects.
MapXtreme v7.1
308
Developer Guide
Geometry Objects
Geometry objects that are not also FeatureGeometry objects need to be converted to a suitable
FeatureGeometry object to be displayed on a map. Most FeatureGeometry classes contain
constructors that take appropriate Geometry objects and create new FeatureGeometry objects:
using MapInfo.Geometry;
Curve curve = new Curve(csys, lineString);
MultiCurve multiCurve = new MultiCurve(curve.CoordSys, curve);
The code above creates the Curve using parameters defined elsewhere in the code of a CoordSys
(csys) and a LineString (lineString). A new MultiCurve is then created using the CoordSys
property of the Curve and the Curve itself.
In the example above, as in all FeatureGeometries created from objects, a copy of the original object
is created because the reference cannot be shared.
Curve
The Curve class inherits from the CurveSegmentList class, and represents a contiguous linear
Geometry. Curves contain a collection of CurveSegments that must remain contiguous. This class is
included in the model to allow for future expansion and is part of the OGC standards.
Use the following example code to model the creation of a Curve:
using MapInfo.Geometry;
DPoint[] points = new DPoint[4];
points[0]=
points[1]=
points[2]=
points[3]=
new
new
new
new
DPoint(-88.135215,43.998892);
DPoint(-104.875119,43.998892);
DPoint(-120.242895,47.048364);
DPoint(-89.135215 46.998892);
CurveSegments
At present a CurveSegment can only be a LineString. The class is designed to expand in future
iterations of the product to include Spline, CircularArc, and EllipticalArc CurveSegments. Curves and
Rings are comprised of CurveSegments.
Rings
A Ring is a collection of CurveSegments which must remain contiguous and closed.
Use the following example code to model the creation of a Ring:
using MapInfo.Geometry;
dPoints = new DPoint[102];
dPoints[0] = new DPoint(-109.171279,49.214879);
MapXtreme v7.1
309
Developer Guide
Polygon
A Polygon is an object made up of Rings. A polygon must have at least a single Ring which defines
the exterior boundary of the Polygon. Other Rings can be included inside which then define holes in
the Polygon. Once a Ring is placed inside of another Ring the object becomes a MultiPolygon.
Use the following example code to model the creation of a Polygon.
using MapInfo.Geometry;
DPoint[][] points = new DPoint[1][];
points[0] = polyPointArrays[0];
Polygon polygon = new Polygon
(longLatNad83, CurveSegmentType.Linear, polyPointArrays[0]);
310
Developer Guide
MapXtreme v7.1
311
Developer Guide
Coordinate Systems
Coordinate systems describe the domain in which a particular object or set of objects reside. The
coordinate system allows for the delineation, in specific terms, of the object or objects being
described. The CoordSys classes contain methods, properties and interfaces that allow for the
creation, manipulation, and editing of coordinate systems.
When Geometries are created, they are created in a particular coordinate system specified in the
creation of the object. Objects cannot change the coordinate system in which they were created.
They can only be copied into another coordinate system.
The CoordSys class facilitates the creation and manipulation of coordinate systems. The Coordsys
class uses an XML version of the projection file (C:\Program Files\Common
Files\MapInfo\MapXtreme\7.x.x\MapInfoCoordinateSystemSet.xml).
MapXtreme v7.1
312
Developer Guide
MapXtreme v7.1
313
Developer Guide
314
Developer Guide
315
Developer Guide
If the EPSG or SRID code already exists, an exception will be thrown indicating this fact.
To determine if a coordinate system for the MapInfo, EPSG or SRID codespace is already
supported, call this method:
MapInfo.Geometry.CoordSys.Code(codespace).
This method returns the first (or only) occurrence of the codespace that matches or null, if it does not
exist.
Similarly, to return the first SRSName in the list that matches the input codespace, call this method:
MapInfo.Geometry.CoordSys.SRSName(codespace).
An SRSName (Spatial Reference System) represents the name of a coordinate reference system
written in GML (Geography Markup Language). This is typically, a friendly name for the coordinate
system, not a list of parameter values.
To get a list of all the codes and coordinate systems that are mapped to a particular coordinate
system, MapXtreme provides the following methods:
MapInfo.Geometry.CoordSys.Codes(codeSpace)
MapInfo.Geometry.CoordSys.SrsNames(codeSpace)
Keep in mind that the coordinate system information you added programmatically, will only be
maintained during the lifetime of the MapXtreme Session.
If your desktop application does not have an app.config file, you can create one by adding it to your project
from the Visual Studio Application Configuration File template.
MapXtreme v7.1
316
Developer Guide
1.
To determine the correct version number for the MapInfo.CoreEngine assembly, from the Start menu,
choose Run and type Assembly in the Run dialog. Every registered MapXtreme assembly is listed in the
global assembly cache list.
MapXtreme v7.1
317
Developer Guide
The MapInfo.Raster namespace contains all of the classes that control the use
and display of raster and grid images in MapXtreme. Rasters are computer
graphics that are composed of pixels that render a whole image. Many satellite
images are rendered as raster images. Grid images are thematic maps that
show a continuous gradation of color to represent interpolated information.
In this chapter:
17
Raster Images
Raster images make excellent backgrounds for maps. 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 images used with vector data 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 in MapXtreme must be registered to some location on earth, even though they
are not true geo-referenced data. Many raster images available today come with a registration file.
Examples include GeoTIFF, ADRG, ASRP, CADRG, and CIB. To register a raster image, you can
bring it into MapInfo Professional and register it there. The registration information is stored in a
.TAB file.
MapXtreme v7.1
319
Developer Guide
Additional raster formats may be supported on a system if a custom raster handler is installed.
Raster Classes
The main classes for raster images are MapInfo.Raster.RasterInfo and RasterRead. Style
information is handled by MapInfo.Style.RasterStyle.
RasterInfo provides information about the height and width of the image in pixels, raster format,
color depth, and registration information. See the RasterInfo sample application provided in
.\MapInfo\MapXtreme\7.x.x\Samples\Desktop\Features\RasterInfo
RasterRead is the class that reads the raster image and style information in order for the image to
be rendered.
RasterStyle is concerned with how the raster looks. You can control brightness and contrast, display
a color image as grayscale, set the transparency and translucency. MapXtreme supports
transparency for one color per image. That means that everywhere that color exists in the image it
will be invisible, which allows the layer below the image to show through. Translucency is the degree
of transparency for the entire image. If you need a layer below a raster image to show through, set a
high translucency (100 percent is transparent).
Raster columns are read only so you cannot permanently change their style. However you can
programmatically set and get the images attributes such as brightness, grayscale, and translucency.
See the RasterStyle class in the online Developer Reference.
MapXtreme v7.1
320
Developer Guide
Raster Reprojection
Raster reprojection enables you to change the cartographic projection of a raster layer in a map.
Many types of raster images can be reprojected. Some examples include satellite and aerial photo
images, scanned maps, as well as grids and seamless raster tables.
You can control the reprojection of both raster and vector layers. When you add either a raster or
vector layer to a map, the new layer is reprojected into the current map window projection.
When you change the projection of a map window that contains a combination of vector and raster
layers, all the layers, both raster and vector, can be reprojected to the new map window projection.
You can access raster reprojection settings in the MapXtreme API, as well as in the user interface of
the Workspace Managers Layer Control. For information using raster reprojection in the API, see
the MapInfo.Mapping.RasterReprojectionMethod in the MapXtreme Developer Reference. For
information on the raster reprojection user interface, see Raster Reprojection.
MapXtreme v7.1
321
Developer Guide
Raster Handlers
MapXtreme can use one of many different libraries to load a raster image. When a raster image is
loaded by MapXtreme, it searches through these DLLs and checks if the given file can be read by
that DLL. Once a DLL/Raster format match is made, MapXtreme knows which DLL does the format
handling for the file. The format handlers are DLLs named xxxxxxxx.RHx. The base part of the
name is based on the format. The extension always begins with RH, but can end in any letter (A-Z).
When searching for a format handler, MapXtreme searches the format alphabetically, starting with
RHA and continuing until RHZ. This process allows MapXtreme to prioritize which handlers are
used. For example, SPOT files are checked for before any other formats since they are just raw data
that can be confused with other formats. The SPOT handler's extension is RHD. The Halo format
handlers are named RHV. The LEADTOOLS format handlers are named RHX.
Raster handlers are located by default in the \Program Files\ Common\ MapInfo\ MapXtreme\ 7.x.x\
RasterGridHandlers folder.
LEADTOOLS Win32 Pro provided by LEAD Technologies, Inc. and HALO Imaging libraries provided
by Media Cybernetics are included with MapXtreme. The LEADTOOLS raster handler loads the
entire raster image into memory at the time the image is referenced in MapXtreme. This means that
the image takes longer to load and may fail if the image is very large due to extreme memory
requirements, but panning and zooming are faster.
The HALO raster handler only loads into memory what it needs to display, so it loads the image
faster, but panning and zooming is slower. Because of the HALO.RHV comes before
LEADTOOL.RHX alphabetically, the HALO handler will attempt to read in the image first. To change
this order, see Configuring Custom Raster Handlers.
The following table shows the provided raster handlers and the formats they support..
Raster Handler
Raster Format
SPOT.RHD
Spot (.bil)
ECW4.RHD
MRSID.RHE
MrSID (.sid)
ADRGASRP.RHL
CADRGCIB.RHL
MapXtreme v7.1
322
Developer Guide
Raster Format
TIFF.RHL
TIF (.tif) *
VMGRID.RHL
HALO.RHV
LEADTOOL.RHX
Only handler that supports georeferencing for TIF. If another handler that supports TIFF
files is tried before this TIFF handler, you can lose support for Georeferenced TIFF files.
So, to support georeferenced TIFF files, this TIFF handler should be tried before any other
handler that supports TIFF.
Can be displayed as either grid or raster. The .TAB file determines whether the image
should be drawn using the grid handler or the raster handler.
There are a few raster formats that we do not support in multi-threaded applications (e.g., in an
ASP.NET application). These formats are as follows:
Read
Vertical Mapper GRD, GRC
JPEG from Halo (The LeadTools JPEG handler is
threadsafe)
TIFF w/jpeg compression from Halo (The LeadTools
TIFF handler is threadsafe)
Export
JPEG 2000 (Win2K only) from LeadTools
TIFF CMYK from LeadTools
MapXtreme v7.1
323
Developer Guide
MapXtreme v7.1
324
Developer Guide
Grid Images
Grid images show an interpolation of data values across an area. A grid image is created from a
data file in which data is measured at evenly-spaced points. The entire map area is converted to a
grid in which each grid cell represents a value. Grid values don't have to be interpolated to produce
a grid, although the data collection points need to be regularly spaced. MapXtreme and MapInfo
Professional create grids by interpolating values using a grid handler.
In addition to the color gradations, grid images can also show hill, or relief, shading. Relief shading
allows the grid surface to be shaded according to a virtual light source. The brightness of each grid
cell corresponds to the light striking the surface and is adjusted based on its orientation to the light
source. This is well suited for elevation grid maps where you can take surface slope and direction
into account relative to the direction of the light. Maximum brightness is assigned at points where the
suns rays are perpendicular to the surface. As the slope faces turn away from the light source, the
brightness values are lower.
Supported grid formats include:
MapXtreme v7.1
325
Developer Guide
Grid Classes
The main classes for grid images are MapInfo.Raster.GridInfo, GridRead,
GridCreatorFromFeatures, GridInflectionCalculator and HillShadeWrite. GridInfo and GridRead are
like RasterInfo and RasterRead, in this case, provide the ability to get information about a grid file.
Grids are created for a layer of data points using GridCreatorFromFeatures. GridInflectionCalculator
is used to set inflection values and colors. HillShadeWrite allows you to add or alter relief shading to
the grid. Many of the properties of a grid are inherited from RasterInfo, including the image class,
coordinate system, raster control points and minimum bounding rectangle (MBR).
1.
Can be displayed as either grid or raster. The .TAB file determines whether the image should be drawn
using the grid handler or the raster handler.
2.
MapXtreme v7.1
326
Developer Guide
Grid Creation
MapXtreme provides the ability to create continuous grids using a writable grid handler and
interpolators. These grids are created programmatically using the
MapInfo.Raster.GridCreatorFromFeatures class, the Mig.ghl grid handler and one of two supplied
interpolators. Grids can be created from tables of data points or from selections.
Grids produced in MapXtreme are compatible with MapInfo Professional v 10.0.
A continuous grid is a map that is divided into a rectangular grid of cells, where each cell contains a
data value representing either a measured data point, or an interpolated value based on the
surrounding data points. The continuous grid displays the changing data values using a continuous
gradation of color across the map.
Previously MapXtreme was limited to reading a grid and getting back a list of its grid cell values. It
also could read information about a grid, such as hillshading and styles. The ContinuousGridWrite
class was available, but lacked the ability to use an interpolator which would have created grids that
better reflect its data points.
The MapInfo.Raster.GridCreatorFromFeatures is the main class to be called when creating a
continuous grid. It uses the MapInfo writable grid handler and an interpolator to produce the
continuous grid map.
MapXtreme v7.1
327
Developer Guide
Grid Interpolators
MapXtreme provides two grid interpolators for creating a continuous grid: IDW and TIN. The IDW
and TIN interpolators are included in a separate namespace called MapInfo.Raster.Interpolators.
In addition, MapXtreme provides an interface for creating your own interpolator.
MapXtreme v7.1
328
Developer Guide
IInterpolator Interface
We also provide support for building your own interpolator through the IInterpolator interface. Derive
your own interpolator from this interface to create grid cell values based on your algorithm. See the
MapInfo.Raster.IInterpolator interface in the Developer Reference.
Grid Style
MapXtreme provides the ability to modify the inflection values and color of a continuous grid image.
Previously MapXtreme could only read the information from the grid.
Grid style support is provided programmatically through the MapInfo.Styles.GridStyle class, via a
GridStyleControl, and incorporated into Workspace Manager. A sample application called GridForm
also provides this capability. Changes to inflection values and colors can be persisted to a
workspace and loaded at a later time.
MapXtreme v7.1
329
Developer Guide
Inflection Methods
MapXtreme supports the following calculation methods:
Equal Cell CountCalculates inflection values so that an equal number of cell values are within
the calculated percentage ranges.
Equal Value RangesCalculates inflection values in a manner where each inflection value range
is the same size.
Custom Cell CountSame as Equal Cell Count, except uses custom percentage ranges.
Custom Value RangesSame as Equal Value Ranges, except uses custom inflection values.
MapXtreme v7.1
330
Developer Guide
If you change either the values or percentages while the inflection methods are set to Equal
Value Ranges or Equal Cell Count, the methods become Custom Value Range and Custom
Cell Count, respectively.
Changes to inflection values and colors can be persisted to a workspace and loaded at a later time.
GridInflectionCalculator Class
The following code example shows how to create an initial set of values and colors and then modify
them. This code example is provided in the Developer Reference API documentation under the
MapInfo.Raster.GridInflectionCalculator class.
public static void MapInfo_Raster_GridInflectionCalculator(TableInfoGrid
tableInfoGrid)
{
// Create 10 grid inflection values, by using the EqualRangeValues
method, using colors from orange to red.
GridInflectionCalculator gridInflectionCalculator = new
GridInflectionCalculator(tableInfoGrid,
InflectionMethod.EqualRangeValues, 10, Color.Orange, Color.Red);
// Modify the colors to go from green to brown.
gridInflectionCalculator.CalculateStyles(Color.Green, Color.Brown);
// Calculate 5 grid inflection values, by using the EqualRangeValues
method.
gridInflectionCalculator.CalculateValues(InflectionMethod.EqualRangeValue
s, 5);
}
Relief Shading
In addition to the color gradations, grid images can also show hill, or relief, shading. Relief shading
allows the grid surface to be shaded according to a virtual light source. The brightness of each grid
cell corresponds to the light striking the surface and is adjusted based on its orientation to the light
source. This is well suited for elevation grid maps where you can take surface slope and direction
into account relative to the direction of the light. Maximum brightness is assigned at points where the
suns rays are perpendicular to the surface. As the slope faces turn away from the light source, the
brightness values are lower.
MapXtreme v7.1
331
Developer Guide
Color/Value/% (Percentage)
The Color/Value/% (Percent) grid box shows the current settings for inflection colors, values and
percentage.
To change the color, double-click on the color swatch and choose a new color from the Color dialog
palette.
The value and % settings come from the data in the grid. These values can change when you modify
settings in the Inflection Point Settings group of this dialog. That will cause a re-calculation of the
inflections and display new values. For example, you can edit the values directly when you choose
Custom Value Ranges and the percentage when you choose Custom Cell Count.
MapXtreme v7.1
If you edit either the values or percentages while the inflection methods are set to Equal
Value Ranges or Equal Cell Count, the methods become Custom Value Range and Custom
Cell Count, respectively.
332
Developer Guide
MapXtreme v7.1
333
Developer Guide
MapXtreme v7.1
334
Developer Guide
Geocoding
This chapter covers the MapXtreme namespaces for geocoding and provides
descriptions and examples for writing applications that will access geocoding
servers or services.
In this chapter:
18
MapXtreme v7.1
336
Developer Guide
GeocodeRequest
The GeocodeRequest class sends a request to the geocoding server or service. Its properties
include AddressList, a list of addresses to be geocoded, and Length, the number of items in the
address list. Input addresses can include a variety of information, including street address or
intersection, primary and secondary postal code, and country code.
GeocodeResponse
The GeocodeResponse class contains a response for each address in the GeocodeRequest. The
response contains address candidates, which are those addresses considered to be possible
matches for the input address. Note that a GeocodeRequest that contains multiple addresses will
yield a GeocodeResponse object that includes a list of candidate addresses for each input address.
GeocodeClientFactory
This class returns an IGeocodeClient which you use to send a GeocodeRequest and receive a
GeocodeResponse. The method GetMmjHttpClient uses the geocoding client that speaks to an
instance of the MapInfo MapMarker Java servlet. Use the method GetEnvinsaGeocodeClient to
send requests to the Location Utility Service in MapInfo Envinsa 4.0.
MapXtreme v7.1
337
Developer Guide
GeocodingConstraints
This class contains the preferences that can be set when geocoding. All are set/get properties that
return true or false (default).
AddressCandidates
This class is a list of possible address matches that is returned in a GeocodeResponse.
CandidateAddress
This class defines an address that was geocoded. Its properties include Address, the address for the
geocoded address, GeocodeMatchCode, which explains how well the address was geocoded, and
Point, the geometry that represents the candidate address.
Geocoding Trade-offs
With a relative matching system such as the geocoding client, there are trade-offs that must be
considered in light of how you use the geocoded data. Consider questions like the following:
What level of matching accuracy are you looking for (unique address match, close match)?
What level of geographic accuracy do you need for your geocoded points (street level, ZIP Code
centroid)?
MapXtreme v7.1
338
Developer Guide
The answers to these questions are driven by how you intend to use the geocoded records. For
example, perhaps you are determining the location of a new retail store and need to know the
distribution of current and potential customers. In this case, you want to geocode as many of these
customers as possible and do not need an exact street address match for each one. Geocoding to
postal code centroid is fine for your analysis.
On the other hand, if you, as a utility service coordinator, need to know where your customers are in
relation to neighborhood gas lines, the positional accuracy of each customer is of critical importance
to you. Geocoding to street level with strict matching preferences is your best strategy.
Input Addresses
Input addresses are those addresses you wish to geocode. These are addresses that do not contain
geographic coordinates and thus cannot be located on a map.
Input addresses are made up of several components that the geocode server examines to
determine a match. Address number, street name and street prefixes and suffixes can be contained
in an input address. Prefixes are commonly directional in nature, such as North or South and exist
only for some addresses. Suffixes are typically the type of street, Street, Road, Avenue Other
information you might find in an input address is an apartment or route number.
Input addresses can contain a full or partial address and can contain spelling variations. For
example, LaSalle Street as input will match to LaSalle St. However LaSalle without a street suffix
may not because the address could really be LaSalle Ave.
The MapXtreme geocoding client can use so-called dirty data and incomplete addresses. This
client accommodates both U.S. and non-U.S. addresses, provided the server contains the
appropriate reference addresses.
Reference Addresses
Reference addresses are those that the server matches against the input addresses. These records
contain the geographic coordinates required to locate the address on a map. Reference addresses
are maintained on the server and are updated regularly through maintenance programs to
accommodate new addresses. They have been standardized based on conventions of the locale.
For example, in North America, street numbers precede the street name. In other parts of the world,
the street number may follow the street name.
MapXtreme v7.1
339
Developer Guide
Geocoding a Location
Geocoding a location helps visualize your data relationships. For example, once address records
are geocoded, they can be used by the routing client to display them as driving directions between
two addresses (locations). Once data has geographic references, spatial searches can be
performed to answer questions such as "Find all customers within 10 miles of this location." All
geocode requests can:
Geocode an incomplete address and return a complete set of address information (a normalized
address).
Indicate the number of exact or close matches in the response for a particular address supplied
in the geocoding request.
Process one or more addresses in a single geocoding request.
Provide information on the quality of the result by using a match code.
Using the GeocodeRequest class you can send a request to the geocoding server or service. Its
properties include AddressList (a list of addresses to be geocoded), Length (the number of items in
the address list), and GeocodeContraints (see Using Constraints for Accurate Geocoding for
more information). As part of the input address, you can include a variety of information, including
MapXtreme v7.1
340
Developer Guide
341
Developer Guide
MapXtreme v7.1
342
Developer Guide
Search, based on country, country subdivision, city, city subdivision, landmark, or airport to
return the position.
The pattern search capability supports a wildcard character (*) as a search value in one or more
fields to return all available values for that particular field.
Batch Geocoding
Batch geocoding is supported using the IGeocodeClient.BatchRequests property. This property sets
the number of addresses that will be sent to the server for a single operation. The defaults number of
addresses is 25. The BatchRequest property must be greater than 0 and less than 500. When
submitting addresses to the IGeocodeClient.Geocode() method, you may exceed the number
specified in the BatchRequest property. If this occurs, the geocode operation containing these
addresses will be broken down into multiple operations, where each operation contains no more
than the number specified in the BatchRequest property.
A small number for BatchRequst (e.g., 2) will slow performance. A high number for
BatchRequest (e.g., 500) may result in memory issues. The performance of batch geocoding
is dependant on system configuration.
The strictest matching conditions require an exact match on house number, street name, postal
code and no fallback to postal code centroids. The server or service, in essence, looks for an exact
street address match within the postal code named in your input address.
MapXtreme v7.1
343
Developer Guide
CloseMatchesOnly Returns only those geocoded results that are close match candidates.
The address candidates are ranked according to how closely the input address matches the
MustMatchXXX preferences. Only those candidates flagged as close matches (true) are
returned. The default is false.
MustMatchAddressNumber Only candidates matching the address number are considered
close. The default is true.
MustMatchMainAddress Only candidates matching the street name are considered close.
This does not prevent Soundex matches from being considered. (For example, "Muller Strasse"
for "Mueller Strasse" may still be considered close). It does prevent expanded street name
manipulation (misspelling), such as considering juxtaposed letters (For example, "Muleler
Strasse" for Mueller Strasse"), if the input street does not generate a close match. The default is
true.
MustMatchCountry Only candidates matching Country are considered close. The default is
true. It is recommended that this preference is not changed.
MustMatchCountrySubdivision Only candidates matching Country Subdivision are
considered close. The default is true. CountrySubdivision may be different in each country. For
example, in USA, it is state, in CAN, it is province.
MustMatchCountrySecondarySubdivision Only candidates matching Country Secondary
Subdivision are considered close. The default is false. CountrySecondarySubdivision are
different for each country. For example, in the USA it is county, in Canada, it is Census Division.
MustMatchMunicipality Only candidates matching Municipality are considered close. The
default is true. An example of a Municipality is a town or city.
MustMatchMunicipalitySubdivision Only candidates matching Municipality Subdivision are
considered close. The default is false. An example of a MunicipalitySubdivision is an MSA
(Metropolitan Statistical Area), or a borough of a city (such as Bronx or Brooklyn in New York
City).
MustMatchPostalCode Only candidates matching postal code are considered close. The
default is false.
MustMatchInput Only candidates matching all input preferences are considered close,
regardless of what is set for that particular preference. The default is false.
FallbackToGeographic Determines if a street geocode request which produces no
candidates, the geocode is performed at the centroid of a geographic region. The resulting point
is located at the geographic centroid of the area where it is possible to obtain the highest level of
accuracy. The default value is set to false.
MapXtreme v7.1
344
Developer Guide
MapXtreme v7.1
345
Developer Guide
MapXtreme v7.1
346
Developer Guide
For either S or M category result codes, each character of the code tells how precisely the geocode
operation matched each address component.
Category
Description
Example
House number
115
North
Street name
Main
Street type
Place
SE
City name
New York
Postal code
80302
Address Dictionary
MapXtreme v7.1
347
Developer Guide
Point ZIPs are ZIP Codes without an area. These include P.O. Box ZIPs and Unique ZIPs
(single site, building, or organization). When using a non US address dictionary, the results in
this category will still be a Z.
MapXtreme v7.1
348
Developer Guide
Non-Match Codes
The following result codes indicate no match was made:
N No close match. These records can be re-geocoded interactively using MapInfo geocoding
products or during subsequent automatic passes under different matching conditions.
NX No close match for street intersections.
ND The server or service could not find the Address Dictionary for the given postal code or
municipality/country subdivision. These records can also be re-geocoded once the Address
Dictionary is available.
NG The user marked these records during geocoding as non-geocodable. The server or
service does not attempt to match these records again until the code is removed.
MapXtreme v7.1
349
Developer Guide
19
MapXtreme provides the ability to deploy and access Web Map Services (WMS)
so that you can get WMS maps from a variety of sources or provide maps to
others.
In this chapter:
351
351
354
354
355
356
365
For more information on WMS 1.3.0 support, see the MapXtreme v7.1.0 Release Notes.
A basic WMS classifies its geo-referenced information holdings into layers and offers predefined
styles in which to display those layers. A WMS that conforms to the OGC specification may support
the transparent pixel definition for some image formats as well. Transparent pixels allow you to use
retrieved WMS images as raster overlays and not solely as the background layer for a map. The
quantity and quality of data available is determined by the individual WMS Server.
There is a growing amount of geo-spatial data available, provided by governments, corporations,
and other organizations, that users can retrieve to enhance the accuracy and completeness of their
maps. Companies with land use and water use data can add elevation and population information
from the U.S. Census Bureau, or from a local data provider. Combining traffic pattern data with store
location information can provide insight into establishing additional store locations or can optimize
marketing and product placement efforts. As a developer, you can customize routing requests to
include particular hotel, attraction, or vacation destinations by extending the WMS code. The
possibilities are limited only by your need and your imagination.
GetCapabilities
GetMap
GetFeatureInfo
GetCapabilities
Before requesting a WMS map, it is necessary to find out the names of available layers, styles in
use, spatial information in use, and other information that the WMS server provides. GetCapabilities
is an HTTP request that retrieves service-level metadata over the Internet or intranet, including the
server name, the layer names, abstracts about the data and the acceptable request parameters.
In MapXtreme, GetCapabilities is the first step in collecting information from a WMS server. The
capabilities are then used to request a map image.
MapXtreme v7.1
351
Developer Guide
GetMap
Once you know the capabilities of the WMS server, a GetMap request is issued to request a map
image of one or more of the WMS servers map layers. Based on the WMS Server capabilities, a
GetMap request includes the following.
VersionRequest version
Layersone or more layers of map data
Stylesdisplay styles for rendering the layers. If this is not specified, default styles will be used.
A bounding boxthe area to be included in the map image in
CRSfor WMS 1.3.0, or SRS (WMS 1.1.1) the coordinate reference system for the map in the
form of namespace:identifier.
Output formata MIME type such as GIF and PNG, for the output map image
Output sizeheight and width in pixels of the map image
Background colora hexadecimal red-blue-green color value such as 0xFFFFFF (required when
transparency is true)
Transparencya true/false setting that indicates if the layer can be used as a transparent overlay
to other layers.
GetFeatureInfo
Once a GetMap request has been successfully completed the user may want further information
about the features included in the map. The GetFeatureInfo operation returns information regarding
the layers in the map and the queryable attributes of each layer. This operation is controlled by the
WMS Server, however, the server may not offer this capability.
GetCapabilities
In MapXtreme, you do not call GetCapabilities directly. Your request for a map is contained in a call
using an WMSClient that takes a capabilities instance as input.
// build the capabilities
ICapabilities capabilities = WmsClientUtilities.GetCapabilities
(url, "1.3.0");
// create the WMS client
WmsClient wmsClient = new WmsClient(capabilities);
wmsClient.AddLayer("WORLD");
wmsClient.Srs = "EPSG:4326";
wmsClient.BGColor = Color.Blue;
wmsClient.MimeType = "image/gif";
MapXtreme v7.1
352
Developer Guide
GetMap
MapXtreme takes care of calling GetMap for you when you place a table object representing the
request as a layer in your MapXtreme map. The code example below builds on the example in the
GetCapabilities section.
// create the table info
TableInfoWms wmsTableInfo= new TableInfoWms
("MyWmsTable", wmsClient);
// create the table
Table wmsTable = Session.Current.Catalog.OpenTable(wmsTableInfo);
// creates a FeatureLayer from the table entry
FeatureLayer featLyr = new FeatureLayer(wmsTable);
For more information on TableInfoWms see WMS in the Supported Table Types on page 166. See
also the TableInfoWms class in the Developer Reference.
GetFeatureInfo
The input for a GetFeatureInfo request are the bounds of a map and the pixel coordinates where the
user clicked on the map with an Info tool.
// Get the feature info
Byte[] info = WmsClientUtilities.GetFeatureInfo(new DRect(45.0, 45.0, 90,
90), 640, 480, new String[] {"WORLD"}, new Point(300,200), "text/xml"));
MemoryStream memoryStream = new MemoryStream(byteArray);
memoryStream.Seek(0, SeekOrigin.Begin);
XmlDocument doc = new XmlDocument();
doc.Load(memoryStream);
//parse the xml doc as desired.
MapXtreme v7.1
353
Developer Guide
MapXtremes implementation of WMS limits the size of the returned image to 4000 pixels
each for width and height.
In addition, the MapXtreme API provides a public method RegisterCRSCode() for you to register
other longitude/latitude projections in the CRS codespace.
354
Developer Guide
BoundingBox
Each layer delivered by a WMS 1.3 server must have at least one bounding box. The coordinates
are presented in the order required by the coordinate system authority. In the example of an EPSG
and CRS code, the bounding box coordinates are in reverse order to each other.
<BoundingBox CRS="EPSG:4326" minx="-59.100605" miny="-86.389389"
maxx="16.755765" maxy="-32.336389"/>
<BoundingBox CRS="CRS:84" minx="-86.389389" miny="-59.100605" maxx="32.336389" maxy="16.755765"/>
This means for EPSG:4326, the minx is the southern most latitude and miny is the western most
longitude. For the CRS:84, minx is the western most longitude and miny is the southern most
latitude.
MapXtreme also supports optional BoundingBox attributes for resx resy to describe the spatial
resolution.
Image Stretching
WMS requires that the image returned from a GetMap request correspond to both the BBOX and
image size (WIDTH, HEIGHT) parameters. This is so that the returned image not unreasonably
stretched to fit the bounding box.
MapXtreme v7.1
355
Developer Guide
356
Developer Guide
MapXtreme v7.1
357
Developer Guide
MapXtreme v7.1
358
Developer Guide
359
Developer Guide
360
Developer Guide
Step 3a: Configure and Test the WMS Server using IIS7
1. Right-click on your WMS folder (for example, c:\wms) and choose Properties. Select the Sharing
tab and click the Share button. Add the IUSR account to the user list. Click Share, then Done to
return to the Properties dialog. Click the Security tab. Add IUSR account to the security list.
For information on setting up permissions for the IUSR account, see Understanding Built-In
User and Group Accounts in IIS 7.
2. Open the IIS7 manager. Right-click on Sites and then choose Add Website from the menu. In the
dialog that displays, name your site (e.g., "WMS") and navigate to the physical path of the WMS
folder. Click the Connect As button and ensure that application use is checked. Assign a free
port number to the website, or use the default 80. Click OK.
3. Click Application Pools in the left pane. Right-click on the new application pool that IIS7 has
created for your WMS website ("WMS") and choose Advanced Settings. Change the .Net
Framework Version to 'v4.0' Click OK.
MapXtreme v7.1
361
Developer Guide
Step 3b: Configure and Test the WMS Server with IIS6
1. Right-click on your WMS folder (for example, c:\wms) and choose Sharing and Security. From
the Web Sharing tab, choose the Share this folder radio button. If you wish to set an alias for
your web server, click the Add button and supply a name in the dialog.
MapXtreme v7.1
362
Developer Guide
4. In the same Properties dialog, under the Directory Security tab, click the Edit button at the top
right. In the Authentication Method dialog box, select the Anonymous Access check box. This
allows users of your WMS service to skip the username/password authentication process. Click
OK twice and close the IIS window.
MapXtreme v7.1
363
Developer Guide
6. If you make any changes to the WMSSample.xml after you access the WMS Server, you will
need to reset IIS in order for your changes to take affect. To reset IIS, from a command prompt
type:
c:\>IISreset
7. To request a test map image, send a GetMap request, following the example below:
http://My_Wms/GetMap.ashx?service=WMS&VERSION=1.3.0&SRS=epsg:4267&REQU
EST=GetMap&LAYERS=States&STYLES=&BBOX=180,0,0,90&WIDTH=800&HEIGHT=600&FORMAT=image/gif
The WMS server returns a map image of the States layers.
MapXtreme v7.1
364
Developer Guide
Namea name of the layer that is used to reference the layer in requests.
Titlea name of the layer that is readable by the user.
Abstracta longer narrative description of the layer.
KeywordLIst and Vocabulary attributeList of keywords or keyword phrases to help catalog
searching. Vocabulary indicates the authority of the keywords.
SRSNameSetthe spatial reference system(s) that applies to this layer. If more than one SRS
can be used on the layer, each one can be listed. This list is unordered and applies to parent and
child layers.
Attributionidentifies the source of the geographic information.
MetadataURLa link to detailed, standardized metadata about the data corresponding to a
particular layer.
FeatureListURLpoints to a list of the features represented in a Layer.
MinScaleDenominator and MaxScaleDenominatordefine the appropriate range of scales for
a WMS map
WmsStyleSetAn unordered set of pre-defined styles supported by this layer and any child
layers. The WmsStyleSet is a collection of WmsStyles, each bearing a name, title, abstract and
reference to a style definition. Each style can have a LegendURL that points to an image of a
legend for that style.
WMS layers can be made up of a single layer of data or a hierarchical collection of layers. A basic
implementation of WMS allows the client to specify which layers it needs, as well as the coordinate
system and styles for those layers that will be rendered as a map image.
MapXtreme v7.1
365
Developer Guide
MapXtreme v7.1
366
Developer Guide
367
Developer Guide
MapXtreme v7.1
368
Developer Guide
Routing
This chapter covers the MapXtreme namespace for Routing and provides
descriptions and examples for writing applications that will access routing
servers or services.
In this chapter:
20
Calculating Routes
Advanced Route Options
Iso Routing (Drive-Time and Drive-Distance)
Updating a Request using Routing Data
MapXtreme v7.1
370
Developer Guide
Calculating Routes
There are three types of route calculations (determining shortest or fastest route) that can be
performed: simple routes (point-to-point), multi-point routes, and matrix route requests.
Point-to-Point Routing
One of the most common routing requirements is for simple driving directions where a customer
inputs two addresses, two points, or any combination, and gets back a route. The route will be
calculated from a specified start point to a specified end point.
At the simplest level of point-to-point routing, the response includes a route summary. This summary
includes the distance and time of the route. There are numerous additions you can make to a pointto-point route request to return additional information in the response. These additions are:
Routing Preferences
Driving Directions
Route Geometry
Avoiding Points, Features, and Segments
Time-Based Routing
MapXtreme v7.1
371
Developer Guide
A point-to-point route is created using the RouteRequest class. Refer to the Developer Reference
for API-level syntax and descriptions.
The following code sample is an example of a simple point-to-point route:
Public Shared Sub New_RouteRequest()
Create the start point and end point
Dim coordSys As MapInfo.Geometry.CoordSys = _
Session.Current.CoordSysFactory.CreateFromPrjString("1, 104")
Dim dpt1 As MapInfo.Geometry.DPoint = _
New MapInfo.Geometry.DPoint(-74, 42)
Dim dpt2 As MapInfo.Geometry.DPoint = _
New MapInfo.Geometry.DPoint(-74, 41)
Dim startPoint As MapInfo.Geometry.Point = _
New MapInfo.Geometry.Point(coordSys, dpt1)
Dim endPoint As MapInfo.Geometry.Point = _
New MapInfo.Geometry.Point(coordSys, dpt2)
Create the point list
Dim pointList As WayPointList = _
New WayPointList(startPoint, endPoint)
Create the route plan object
Dim plan As RoutePlan = _
New RoutePlan(pointList)
Create the request object
Dim request As RouteRequest = _
New RouteRequest(plan, DistanceUnit.Mile)
End Sub
Multi-Point Routing
Multi-point routing is the ability to route via points. The routing server will find the shortest time or
distance through all the points. This can be used for complex directions. These directions are a
requirement for customers who wish to plan daily drop-offs, or customer visits such as distribution
and repair companies, or general field sales. Typically, a start and end point are defined plus a series
of stops are added into the calculation. There is no difference between multi-point route and point-topoint route except for the via points between the start and end locations.
Similar to point-to-point routes, there are numerous additions you can make to a multi-point route
request to return additional information in the response. These additions are:
Routing Preferences
Driving Directions
Route Geometry
Avoiding Points, Features, and Segments
Time-Based Routing
A multi-point route is created using the RouteRequest class. To add intermediate points to a route,
WayPointList must consist of at least one ViaPoint. Refer to the Developer Reference for API-level
syntax and descriptions.
MapXtreme v7.1
372
Developer Guide
Matrix Routing
Matrix routing allows you to find the shortest or fastest paths between a number of start points and a
number of end points, and return the route costs. The costs are the total time and distance of the
individual routes. The matrix route feature is extremely useful for situations where you have 3 start
points and 50 destination points, where you want to find the shortest paths between all the start
points and all the destinations, and return the routes costs.
The order of the points and number of sequences in the response are determined by the number of
start and end points in the request. For example, if two start points and two end points are specified
in the request, the response will contain the following order of sequences (where S is start and E is
end): S1 to E1, S1 to E2, S2 to E1, S2 to E2.
Typically, this calculation can be used to determine service response time and coverages for specific
services such as a fire house or police station. You may require these calculations to ensure they
can provide adequate coverage for service level agreements such as having one or more people
who can respond to an incident within 20 minutes of first notification. At the simplest level of matrix
MapXtreme v7.1
373
Developer Guide
Routing Preferences
Avoiding Points, Features, and Segments
Updating a Request Using Routing Data
A matrix route is created using the MatrixRouteRequest class. The matrix route request must consist
of a MatrixRouteCost and may include a MatrixRoutingPreferences. Refer to the Developer
Reference for API-level syntax and descriptions.
Routing Preferences
You can specify various preferences for each type of route you are calculating. All of these
preferences are optional, but can be very important in determining the accuracy of the route and
helping you create a more meaningful route. You can return the route with fastest time from the start
point to the end point or the shortest distance from the start point to the end point. If specified, these
preferences will override the route optimization settings defined in the server or service
configuration. The preferences may be overridden by server preferences if the server preferences
are more restrictive.
The type of route calculation (point-to-point, multi-point, or matrix) determines which route
preferences are available to use. The following list outlines the available route preferences:
DistanceUnit - You can specify the distance unit for all of the route calculations. The most
common units are Kilometer, Meter, Mile, Yard, and Foot. If a value is not specified, the default
setting will be used (Mile).
RouteMethod - Determines the general type of route preference to perform. The route client can
either perform Fastest or Shortest route calculations. If a value is not specified, the default
setting will be used (Fastest).
OptimizeIntermediatPoints (only used in multi-point routes) - Determines if the via points are to
be traversed in the order specified in the request or have the route client find the optimal route
using these via points. By default (false) the route client will traverse the specified points in the
order in the request. When set to true, the optimal route using the via points is calculated.
StopThreshold (only used in multi-point routes) - Sets the route calculation algorithm stop
threshold. The route algorithm will stop calculating and return the current best route when the
difference in time or distance between the route candidates remaining in the algorithm reaches
the stop threshold. Valid values are any positive numbers. For best performance, a positive
number less than one is recommended. Setting the stop threshold is a balancing factor between
accuracy and speed. The lower the threshold value on average, the more accurate the result and
the longer the route will take to calculate. The stop threshold has a minimal effect on routes with
few via points (under 10). The default is 0.01 (1 percent).
MapXtreme v7.1
374
Developer Guide
TimeOut - Sets the route calculation algorithm time out value. The time out value is in seconds.
The default time out is 600 seconds. The route algorithm will stop calculating once the time out
value is reached.
TimeUnit - Sets the unit of measure for all routes durations. The default time unit is Minute.
TavelPreferences - Allows you to specify unique routing abilities for modifying road type priority
of travel. To add travel preferences you can specify a road type and a road type preference.
Routing can be performed on priority basis by setting the RoadTypePreference to High, Medium,
Low, or Avoid. The road types with the higher priority will be chosen over those with the lower
priorities when the route is calculated. You can also use the Avoid RoadTypePreference to avoid
a particular road type. One of the more often used travel preference is to set the FERRY
RoadType to Low, which will only use ferry routes if that is the only mean of travel to the
destination.
TravelTime (point-to-point and multi-point) - Sets the start or end travel time for the route
request. Refer to Time-Based Routing for more information on how to define the travel time and
other time-based routing options.
Updates - Allows you to include transient updates in your route request that temporarily modify
road or segment speed and road types. Refer to Transient Updates for more information on
including updates.
The RoutingPreferences and MatrixRoutingPreferences classes are the starting point when defining
route preferences. Refer to the Developer Reference for syntax and descriptions.
Driving Directions
Driving directions can be returned for a point-to-point or multi-point route. These instructions list the
step-by-step procedure for the route. Each segment of the route will return the step that needs to be
performed (for example, Begin, Turn Right), the name of the street, the direction, the distance, and
the time. There are numerous options for driving directions including focusing the directions to a
particular section of the route, changing the wording and format of the directions, and changing the
language for the directions.
There are two places where this can be configured/requested. The first place is in the server or
service settings. The second place is using the RouteInstructionsRequest class setting the
ReturnDirections property to true.
DirectionBreakTurnAngle - Sets the turn angle value that determines when a street is broken
into a new directions string. Sometimes, when following a route a street will make a significant
turn while keeping the same name. By using this value, the user can specify the turn angle at
which a new direction should be started. Valid values are 0 to 180 degrees. The default is 45
degrees.
DirectionsGeneratorName - Specifies a custom, server-side directions generator to be used to
create the route directions. If the server or service is configured with one or more directions
generators, this preference may be used to force directions generation to be handled by a
specific generator. For instance, setting myGenerator will force the server or service to use the
generator that has been configured with the name "myGenerator. Use this preference only if
your server or service has been configured with a custom direction generator. Refer to your
server or service documentation for instructions on how to create and use direction generators.
MapXtreme v7.1
375
Developer Guide
Focus - Specifies the focus of the route. A focused route is a subset of the whole route that
concentrates on either the beginning or end of the route. A route focused at the start will route
the user from their origin to (and including) the first major highway. A route focused at the end will
route the user from the last major highway in the route (including that highway) to the
destination. If there are no major highways in the route, the focused route will be the same as an
unfocused route. NONE signifies directions for the whole route will be returned, START signifies
that the start of the route will be returned, or END signifies that the end of the route will be
returned. The default is NONE.
ShowDistance - Indicates whether or not to return the distance of a direction in the driving
directions. The default is true.
ShowPrimaryNameOnly - Specifies whether or not to show only the primary street names. It is
often the case that a street contains multiple names. This is used to indicate whether all names
for the street should be shown in the directions or only the primary name. If set to true, only the
primary name of the street will be used in the directions. If set to false, the primary name and all
alternate names will be used. The default is false.
ShowTime - Indicates whether or not to return the time it takes to follow a direction in the driving
directions. The default is true.
Style - Specifies the type of directions to return. The client can return two types of directions,
normal and terse. Normal is the standard driving direction instructions. For example Turn left on
Yonge Blvd and travel Southeast (1 s). Terse directions are shorter directions that are more
suitable for wireless devices. For example L on Yonge Blvd. This can be set to NORMAL or
TERSE. The default setting is NORMAL.
Route Geometry
The ability to create a route geometry is a vital capability in creating maps and analysis of a route.
The route geometry is the visual representation of the route. By default the route geometry is not
returned. However, you can return the route geometry in the response by setting the
ReturnGeometry property to true.
MapXtreme v7.1
376
Developer Guide
Avoiding Points
Currently there are two methods to avoid points along the route. You can use the Points property of
the AvoidList class or you can exclude any number of points from a route request using the
PointExclude class.
Avoiding Features
Currently there are two methods to avoid features (road types) along the route. The
TravelPreferences property of the RoutingPreferences class can be used to avoid any road type.
See Routing Preferences for more information on using the TravelPreference property.
The route client also provides another method to avoid highways when calculating routes. This
feature is useful when you want to limit routes to local roads. You can use the Features property of
the AvoidList class and define Highway as the avoid feature.
Avoiding Segments
You can exclude any number of route segments (ID) from a route request using the
SegmentExclude class. The segment ID is a unique identifier assigned to each line, road, or section
of the route data. You can determine the segment ID for a particular section of the route by returning
them in a previous route response. See Returning Segment Information for more information on
how segment IDs are returned in a route response.
If the route cannot be calculated or there is no way to get a destination using the avoid or
exclude, then the route directions will not be returned.
Time-Based Routing
Time-based routing is a key component for delivery systems, mobile work forces, and calculating
accurate drive times and routes. You can specify a start or end time for your route or a stop duration
for each intermediate point in a multi-point route. For example, you can specify that the route should
start at location A and pass through locations B, C, and D where you spend five minutes at each
talking to customers or loading your trucks. The route will then end at location E.
DateTime - Specifies the date and time to either start or end a route calculation.
MapXtreme v7.1
377
Developer Guide
TimeZone - Specifies the time zone used in the travel time. The time zone is defined using an
hour offset value from Greenwich Mean Time (GMT).
TravelTimePreference - Specifies if the travel time defined is a start or end time. The two
members are defined using StartTravel or EndTravel.
The following code example shows how to set the travel time for the route. This example includes
the StartTravel preference, defining the start time (year, month, day, hour (24 hour clock), minute,
second) and time zone:
Public Shared Sub New_TravelTime()
Dim startTime As DateTime = New DateTime(2005, 5, 1, 14, 0, 0)
Dim timeZone As MapInfo.Routing.TimeZone = _
New MapInfo.Routing.TimeZone(-4)
Dim travelTime As MapInfo.Routing.TravelTime = _
New MapInfo.Routing.TravelTime(startTime, _
TravelTimePreference.StartTravel, timeZone)
End Sub
Stop Times
At any intermediate point during a route you can specify a stop time. This time is added to the overall
time along the route. The stop time is particularly useful for defining time that the user is going to
spend at a particular location along the route (for example, loading and unloading time of a delivery
truck) for a multi-point route. A stop can be added to the ViaPoint class by specifying a Stop and a
StopTime property:
Stop - You can specify whether to stop at a viapoint. By default no stops are calculated at
viapoints (false). You can specify if you want to stop at the viapoint by defining the Stop equal to
true.
StopTime - Adds a stop time to any viapoint along the route. The stop time is defined by the
TimeSpan, and will be added to the total time for the route. The default stop time is 0 (zero). A
TimeSpan can be represented as a string in the format "[-]d.hh:mm:ss.ff" where "-" is an optional
sign for negative TimeSpan values, the "d" component is days, "hh" is hours, "mm" is minutes,
"ss" is seconds, and "ff" is fractions of a second. For example, a TimeSpan defined as
"11.13:46:40" is equivalent to 11 days, 13 hours, 46 minutes, and 40 seconds.
MapXtreme v7.1
378
Developer Guide
IsoChronePreferences
The following preferences are available in the IsoChronePreferences class:
DefaultAmbientSpeed - Determines the off-road network speeds where they are not specified.
Roads not identified in the network can be driveways or access roads, among others. For
instance, if you are at a point with five minutes left on an isoChrone on the off-road network,
boundary points would be put at a distance based on the ambient speed and the time left. So, if
the ambient speed in this case was 15 miles per hour, boundary points would be put at a
distance of 1.25 miles.
AmbientSpeedOverride - Overrides an ambient speed for a specific road type. The ambient
speed can be overridden for all road types. For example, it may be set to 30 Mph for major urban
roads on the weekends due to busy traffic:
IsogramPreferences
The following preferences are available in the IsogramPreferences class:
BandingStyle - Specifies the style of banding to be used in the result. Banding styles are the
types of multiple time or distance bands that can be displayed based on multiple costs. The
styles include Donut (each boundary is determined by subtracting out the next smallest
boundary) or Encompassing (each boundary is determined independent of all others). Multiple
isoChrone bands may be requested by specifying multiple cost factors, such as asking for the
isoChrone 5 minutes away and 15 minutes away from the same starting point. These end up as
approximate concentric bands. The user may choose to show both complete sets of data
(Encompassing style, which shows everything) or just the band between the two (Donut style),
for everything between 5 and 15 minutes away.
Donut banding can result in routing server problems when two boundaries (times) are almost
identical. There are three request settings you can use to avoid this situation:
a. Do not use the maximum off road distance setting if possible with Donut banding. If you must
use this setting, set it as large as possible.
b. Do not use a low ambient speed setting with Donut banding.
c. Do not make requests with cost increments that are small relative to the cost. For example,
requesting 4, 5, and 6 minute costs (1 minute increments starting at 4 minutes) is not likely to
MapXtreme v7.1
379
Developer Guide
The above example shows the geometries returned for an Encompassing style
banding of cost 5, 10, and 15 minutes from the starting point. Notice how each
geometry includes the area of the prior isoChrone.
The above example shows the geometries returned for a Donut style banding of cost
5, 10, and 15 minutes from the starting point. Notice how each geometry begins at the
end of the prior geometry, excluding the area of the prior isoChrone.
MajorRoadsOnly - Determines what road network is used in the calculation. The network can
include major roads only or all roads. A major road is a main road or highway. If you choose to
use major roads, performance will improve, but accuracy may decrease. The images below
illustrate the behavior of the major roads option. The image on the left shows MajorRoadsOnly
set to true while the image on the right shows MajorRoadsOnly set to false. Notice that the
service uses side streets and other types of secondary roads when calculating the iso response
if MajorRoadsOnly is set to false.
MapXtreme v7.1
380
Developer Guide
MaxOffRoadDistance - Specifies the maximum amount of distance to come off the road
network when using the ambient speed. The default setting for this property is no limit, allowing
off-road travel to occur to the maximum of the isoChrone. The server may not be able to
generate a response for a maximum off-road distance set to a very small value.
ReturnAccesibleNodes - Specifies the type of isogram or feature to be returned from an
isoChrone request be a set of nodes (MultiPoint). By default, ReturnAccesibleNodes is False.
When this property is true, all of the points along the road network that can be reached for the
isoChrone calculation will be returned.
ReturnGeometry - Specifies the type of isogram or feature to be returned from an isoChrone
request be a geometry (MultiPolygon). By default, ReturnGeometry is true. False will return all of
the points along the road network that can be reached for the isoChrone calculation.
ReturnHoles - Specifies whether or not to return holes in the response. Holes are areas within
the larger boundary that cannot be reached within the desired time or distance, based on the
road network. These pockets of territory are often neighborhoods of local roads that are
cumbersome to traverse. Holes can be returned as is, or removed entirely. This setting will only
apply if ReturnGeometry is set to true (default). If this property is not specified, the default
setting, false, will be used.
ReturnIslands - Specifies whether or not to return islands in the response. Islands are small
areas outside the main boundary that can be reached within the desired time or distance. These
areas are frequently located off exit ramps of major highways. Islands can be returned as is, or
removed entirely. This setting will only apply if ReturnGeometry is set to true (default). If this
property is not specified, the default setting, false, will be used.
SimplificationFactor - Specifies the reduction factor for polygon complexity. The simplification
factor indicates what percentage of the original points should be returned or that the resulting
polygon should be based on. The polygon or set of points may contain many points. The
simplification factor is a decimal number between 0 and 1.0 (1 being 100 percent and 0.01 being
1 percent). Lower numbers mean lower storage and lower transmission times. This setting will
only apply if geometry is the result type. If this property is not specified, the default setting 0.05 (5
percent) will be used. The images below illustrate the behavior of the simplification factor option.
The image on the left shows the simplification factor set to 0.01 while the image on the right
shows the simplification factor set to 1.
TimeOut - Specifies the amount of time allowed for the server to create the isogram. The default
value for this property is 600 seconds (10 minutes).
MapXtreme v7.1
381
Developer Guide
IsoDistancePreferences
The following preferences are available in the IsoDistancePreferences Class:
MapXtreme v7.1
382
Developer Guide
MapXtreme v7.1
383
Developer Guide
Transient Updates
In order to create more accurate and meaningful route calculations, you can make temporary
changes to the route data. The changes are submitted within each route request and are only valid
when the server or service is handling that particular request. You can use this feature to avoid a
particular highway during rush hour or lower the speed of the road segment in the request,
representing real life traffic patterns, producing more accurate time based routing. A transient
update can be included in any type of route request (point-to-point, multi-point, or matrix route). By
making these types of modifications, you have the ability to:
When defining speeds in transient updates, there are essentially three types, each speed value
defined differently:
SegmentRoadTypeUpdate - Updates the road type for the segment. The following code sample
shows how to specify a new road type for the defined segment ID S1256,
RoadType.MAJOR_ROAD_URBAN
SegmentSpeedUpdate - Updates the speed of the segment with a new speed.
The following sample shows how to define a new speed of 50 miles per hour (Velocity(50,
VelocityUnit.Mph)) for the specified route segment (S1256):
Public Shared Sub New_SegmentSpeedUpdate()
Create the velocity object
Dim velocity As Velocity = New Velocity(50, VelocityUnit.Mph)
Create the update object
Dim update As SegmentSpeedUpdate = New SegmentSpeedUpdate("S1256",
velocity)
End Sub
MapXtreme v7.1
384
Developer Guide
The following sample shows how to increase the speed by 5 miles per hour (Velocity(5,
VelocityUnit.Mph)) for the specified route segment (T1256):
Public Shared Sub New_SegmentRelativeSpeedUpdate()
Create the velocity object
Dim velocity As Velocity = New Velocity(5, VelocityUnit.Mph)
Increase the speed by 5 mph.
Dim update As SegmentRelativeSpeedUpdate = New
SegmentRelativeSpeedUpdate("T1256", velocity)
End Sub
The following sample shows how to increase the speed for the specified route segment by 20
percent (S1256, 20):
Public Shared Sub New_SegmentPercentageSpeedUpdate()
Increase the speed by 20 percent.
Dim update As SegmentPercentageSpeedUpdate = New
SegmentPercentageSpeedUpdate("S1256", 20)
End Sub
PointSpeedUpdate - Updates the speed of the closest segment to the point with a new speed.
The following sample shows how to define a new speed of 50 miles per hour (Velocity(50,
VelocityUnit.Mph)) for the road closest to the defined point (pt):
Public Shared Sub New_PointSpeedUpdate()
Create a point
Dim coordSys As MapInfo.Geometry.CoordSys =
Session.Current.CoordSysFactory.CreateFromPrjString("1, 104")
Dim dpt As MapInfo.Geometry.DPoint = New MapInfo.Geometry.DPoint(-74,
42)
Dim pt As MapInfo.Geometry.Point = New
MapInfo.Geometry.Point(coordSys, dpt)
Create the velocity object
Dim velocity As Velocity = New Velocity(50, VelocityUnit.Mph)
Create the update object
Dim update As PointSpeedUpdate = New PointSpeedUpdate(pt, velocity)
End Sub
MapXtreme v7.1
385
Developer Guide
PointRelativeSpeedUpdate - Updates the speed of the closest segment to the point with a
change in speed.
The following sample shows how to increase the speed by 5 miles per hour (Velocity(5,
VelocityUnit.Mph)) for the road closest to the defined point (pt):
Public Shared Sub New_PointRelativeSpeedUpdate()
Create a point
Dim coordSys As MapInfo.Geometry.CoordSys =
Session.Current.CoordSysFactory.CreateFromPrjString("1, 104")
Dim dpt As MapInfo.Geometry.DPoint = New MapInfo.Geometry.DPoint(-74,
42)
Dim pt As MapInfo.Geometry.Point = New
MapInfo.Geometry.Point(coordSys, dpt)
Create the velocity object
Dim velocity As Velocity = New Velocity(5, VelocityUnit.Mph)
Increase the speed by 5 mph.
Dim update As PointRelativeSpeedUpdate = New
PointRelativeSpeedUpdate(pt, velocity)
End Sub
The following sample shows how to increase the speed for the road closest to the define point by 20
percent (pt, 20):
Public Shared Sub New_PointPercentageSpeedUpdate()
Create a point
Dim coordSys As MapInfo.Geometry.CoordSys =
Session.Current.CoordSysFactory.CreateFromPrjString("1, 104")
Dim dpt As MapInfo.Geometry.DPoint = New MapInfo.Geometry.DPoint(-74,
42)
Dim pt As MapInfo.Geometry.Point = New
MapInfo.Geometry.Point(coordSys, dpt)
Increase the speed by 20 percent.
Dim update As PointPercentageSpeedUpdate = New
PointPercentageSpeedUpdate(pt, 20)
End Sub
MapXtreme v7.1
386
Developer Guide
RoadTypeSpeedUpdate - Updates the speed of a particular road type with a new speed.
The following sample shows how to define a new speed of 50 miles per hour (Velocity(50,
VelocityUnit.Mph)) for all urban major roads (RoadType.MAJOR_ROAD_URBAN):
Public Shared Sub New_RoadTypeSpeedUpdate()
Create the velocity object
Dim velocity As Velocity = New Velocity(50, VelocityUnit.Mph)
Create the update object
Dim update As RoadTypeSpeedUpdate = New
RoadTypeSpeedUpdate(RoadType.MAJOR_ROAD_URBAN, velocity)
End Sub
RoadTypeRelativeSpeedUpdate - Updates the speed of the road type with a change in speed.
The following sample shows how to increase the speed by 5 miles per hour (Velocity(5,
VelocityUnit.Mph)) for all urban major roads (RoadType.MAJOR_ROAD_URBAN):
Public Shared Sub New_RoadTypeRelativeSpeedUpdate()
Create the velocity object
Dim velocity As Velocity = New Velocity(5, VelocityUnit.Mph)
Increase the speed by 5 mph.
Dim update As RoadTypeRelativeSpeedUpdate = New
RoadTypeRelativeSpeedUpdate(RoadType.MAJOR_ROAD_URBAN, velocity)
End Sub
The following sample shows how to increase the speed for all urban major roads by 20 percent
(RoadType.MAJOR_ROAD_URBAN, 20):
Public Shared Sub New_RoadTypePercentageSpeedUpdate()
Increase the speed by 20 percent.
Dim update As RoadTypePercentageSpeedUpdate = New
RoadTypePercentageSpeedUpdate(RoadType.MAJOR_ROAD_URBAN, 20)
End Sub
MapXtreme v7.1
387
Developer Guide
Linear Referencing
This chapter covers a MapXtreme capability for mapping and analyzing linear
networks using M (measure) values associated with MultiCurve feature
geometries.
In this chapter:
21
MapXtreme v7.1
389
Developer Guide
The following sections provide a brief introduction to these operations. See also
MapInfo.LinearReferencing namespace for compete details.
MapXtreme v7.1
390
Developer Guide
CalculateMissingMeasures(MultiCurve)
SetMeasures (MultiCurve, double startMeasure, double endMeasure)
SetMeasuresAsDistance(MultiCurve, double startDistance)
DropMeasures (MultiCurve)
ScaleMeasures(MultiCurve, double scale)
TranslateMeasures(MultiCurve, double offset)
TranslateMeasures(MultiCurve)
Reverse(MultiCurve)
FeatureGeometry.Distance Method
The MapInfo.Geometry.FeatureGeometry class includes an overload to the Distance method that
MapXtreme uses to locate measure values along a MultiCurve when the input point is not located on
the curve. This method returns a MultiCurve that represents the shortest or longest distance
between the input point off the curve and the projected point on the curve. To specify shortest or
longest, the minimumDistance must be passed in as a boolean. Shortest distance is true. The
returned MultiCurve is the input for the LocateMeasure methods which returns a point on the
MultiCurve closest (or farthest) from the input point.
If the MultiCurve and the Point that is passed in are in different coordinate systems, then the
Distance operation is performed in the coordinate system of MultiCurve instance. The resulting
FeatureGeometry is always in the same coordinate system as MultiCurve instance.
MapXtreme v7.1
391
Developer Guide
A distance value that is positive will be interpreted as a perpendicular direction to the right of the line
when traversing in the order of the nodes (e.g., node i to node i+1). A negative distance would be to
the left. A distance of zero is not allowed.
The resolution is used to interpolate points along the arcs created for rounding corners. Values of 0
or larger are supported, up to an including 36. The default value is 1.
This operation preserves the measure values, if present, of the original MultiCurve. Elevation (Z)
values from the original MultiCurve are not preserved.
Curve Order
The MapInfo.LinearReferencing namespace includes the ICurveSorter interface to handle the sort
order of individual curves that make up a MultiCurve. Sort order is important when you are calling
any of the following linear referencing operations:
CalculateMissingMeasures
SetMeasures
SetMeasuresAsDistance
LocateAlong
LocateMeasure
LocateBetween
Without specifying a sort order, MapXtreme returns the longest curve first, while the remaining
curves are returned in an unknown order. When using CalculateMissingMeasures on an unordered
MultiCurve, for example, MapXtreme could calculate the wrong M values for a node based on its
position in the MultiCurve. Providing the correct sort order would eliminate that problem.
MapXtreme v7.1
392
Developer Guide
Ordering of curves does not change the x,y position of the nodes.
The interface also provides a DefaultCurveSorter class that, when implemented, only returns the
component curves as advertised by the MultiCurve itself. No ordering is done through its SortCurve
method.
MapXtreme v7.1
393
Developer Guide
MapXtreme provides the ability to host and/or access map feature data from
internet or private intranet Web Feature Services (WFS).
In this chapter:
22
GetCapabilities
A GetCapabilities request is a query of a WFS server to learn more about what the server offers in
terms of geographic data and operations that can be performed on that data. The response to a
GetCapabilities request is an XML document describing the operations that the WFS supports and a
list of all feature types that it can service. You would request the services capabilities the first time
you access a WFS server.
GetCapabilities is supported via HTTP GET and HTTP POST.
MapXtreme v7.1
395
Developer Guide
396
Developer Guide
DescribeFeatureType
After finding the available feature type with GetCapabilities request, the DescribeFeatureType
request asks for detailed information about one or more of the available feature types. In MapXtreme
a WFS feature type is represented by a table, and a WFS feature is equivalent to a row of
information from a table. The response to a DescribeFeatureType request includes the name of the
feature type (the name of the table) and the names and types of the properties (names and types of
the columns) in the table. The results are returned in an XML schema document in GML format.
DescribeFeatureType is supported via HTTP GET and HTTP POST. The Schema returned will have
the form whereby each property in the feature type becomes an element.
MapXtreme does not return the following column types as properties:
MIDbType.Binary
MIDbType.CoordSys
MIDbType.Grid
MapXtreme v7.1
397
Developer Guide
MIDbType.Key
MIDbType.Raster
MIDbType.Style
The following shows a portion of a DescribeFeatureType response document. In this case, the
request is for a feature type called USA. The USA feature type has several properties represented
by the geometry column OBJ, and data columns for State and State_Name.
<?xml version="1.0" encoding="utf-8" ?>
- <schema targetNamespace="http://www.mapinfo.com/wfs"
xmlns:miwfs="http://www.mapinfo.com/wfs"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:gml="http://www.opengis.net/gml" elementFormDefault="qualified"
xmlns="http://www.w3.org/2001/XMLSchema">
<xs:import namespace="http://www.opengis.net/gml"
schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd" />
<xs:import namespace="http://www.opengis.net/wfs"
schemaLocation="http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd" />
<xs:element name="USA" type="miwfs:USA_Type"
substitutionGroup="gml:_Feature" />
- <xs:complexType name="USA_Type">
- <xs:complexContent>
- <xs:extension base="gml:AbstractFeatureType">
- <xs:sequence>
- <xs:element name="Obj" minOccurs="0" maxOccurs="1">
- <xs:complexType>
- <xs:sequence>
<xs:element ref="gml:_Geometry" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="State" nillable="false" type="xs:string" minOccurs="0"
maxOccurs="1" />
<xs:element name="State_Name" nillable="false" type="xs:string"
minOccurs="0" maxOccurs="1" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</schema>
GetFeature
Once you know the available feature types and their properties, the final step to retrieving WFS
feature information is sending a GetFeature request. This request specifies which feature and
properties to fetch. In order to retrieve a subset of features, use filtering operations to constrain the
query both spatially and/or non-spatially. See Code Example: Requesting Features Using Filters.
GetFeature is supported via HTTP POST.
Among the OGC-supported parameters, Request and TypeName are required. PropertyName,
Filter, FeatureID and others are optional. TypeName is optional when FeatureID is specified. For
further details, see the OGC Web Feature Service Implementation Specification.
MapXtreme v7.1
398
Developer Guide
MapXtreme v7.1
399
Developer Guide
400
Developer Guide
MapXtreme v7.1
401
Developer Guide
402
Developer Guide
2. Open IIS (From the Start menu > Control Panel > Administrative Tools > Internet Information
Services). Expand the Default Web Site and locate your WFS server (by folder name or by alias,
if you set one).
3. Right-click on the Web site and choose Properties. Under the ASP.NET tab, choose 2.0.50727
from the drop-down list for the ASP.NET version (The MapXtreme assemblies are compiled
under the 2.0 Framework).
MapXtreme v7.1
403
Developer Guide
4. In the same Properties dialog, under the Directory Security tab, click the Edit button at the top
right. In the Authentication Method dialog box, select the Anonymous Access check box. This
allows users of your WFS service to skip the username/password authentication process. Click
OK twice and close the IIS window.
5. Test your setup by sending a GetCapabilities request from a web browser. In the address box
type:
http://localhost/wfs/GetFeature.ashx?REQUEST=GetCapabilities&SERVICE=WFS&V
ERSION=1.0.0
substituting your web server for localhost. If you have set an Alias to your web server, be sure
to include that in your URL. For example:
http://localhost/My_WFS/GetFeature.ashx?REQUEST=GetCapabilities&SERVI
CE=WFS&VERSION=1.0.0
A successful test will return a web page similar to the illustration below. If the capabilities are not
returned, review your configuration files to ensure everything has been entered correctly. Since
you are creating the configuration files by hand, It is very easy to include typos or have missing
tags.
MapXtreme v7.1
404
Developer Guide
6. To learn about the properties for the returned feature types, send a DescribeFeatureType
request:
http://localhost/My_wfs/GetFeature.ashx?REQUEST=DescribeFeatureType&SERVI
CE=WFS&VERSION=1.0.0&Typename=miwfs:USA
This request returns a description of the properties for the feature type USA, including two
column names: State and State_Name.
7. To request features from the USA table, send a GetFeature request.
http://localhost/My_wfs/GetFeature.ashx?REQUEST=GetFeature&SERVICE=WFS&
VERSION=1.0.0&Typename=miwfs:USA&propertyname=miwfs:State_Name
This request returns features from the USA table as a FeatureCollection. Notice in the URL that
we requested only one of the two column properties, State_Name, for the USA table. If we had
not specified any property name, all properties in the table would be returned.
MapXtreme v7.1
405
Developer Guide
406
Developer Guide
The HTTP protocol mandates a URL length for a GetFeature request of no more than 2048
characters. Keep in mind that a filter could easily create a URL much larger than that, which
will cause an exception.
407
Developer Guide
miwfs:Ocean
miwfs:WldCty25
miwfs:World
miwfs:WorldCap
The first GetFeature call returns all the features (rows) in WorldCap, a portion of which is shown
below. The first line shows the columns for the WorldCap data, the remaining lines show the
individual rows of data.
Obj, Capital, Country, Cap_Pop, MI_Style,
Point,Abidjan,IVORY COAST,2700000,MapInfo.Styles.SimpleVectorPointStyle:
12 point,
Point,Abu Dhabi,UNITED ARAB
EMIRATES,722000,MapInfo.Styles.SimpleVectorPointStyle: 12 point,
Point,Accra,GHANA,949000,MapInfo.Styles.SimpleVectorPointStyle: 12 point,
Point,Addis Ababa,ETHIOPIA,1423111,MapInfo.Styles.SimpleVectorPointStyle:
12 point,
Point,Agana,GUAM,132726,MapInfo.Styles.SimpleVectorPointStyle: 12 point,
Point,Algiers,ALGERIA,1483000,MapInfo.Styles.SimpleVectorPointStyle: 12
point,
Point,Alma-ata,KAZAKHSTAN,1108000,MapInfo.Styles.SimpleVectorPointStyle:
12 point,
Point,Alofi,NIUE,3300,MapInfo.Styles.SimpleVectorPointStyle: 12 point,
Point,Amman,JORDAN,936000,MapInfo.Styles.SimpleVectorPointStyle: 12
point,
Point,Amsterdam,NETHERLANDS,694656,MapInfo.Styles.SimpleVectorPointStyle:
12 point,
...
MapXtreme v7.1
408
Developer Guide
MapXtreme v7.1
409
Developer Guide
System;
System.Drawing;
System.Windows.Forms;
System.Xml.Schema;
using
using
using
using
MapInfo.Data;
MapInfo.Engine;
MapInfo.Mapping;
MapInfo.Wfs.Client;
namespace MapInfo.Wfs.Client.Samples {
/// <summary>
/// Simple sample to demonstrate how to register a WfsReader to handle
/// requests from a specific Wfs server, get the capabilities of the
server,
/// get the schema for a feature type located on the server and getting
all
/// of the features from the server.
/// </summary>
class SimpleSample {
private const string URL = "http://www.mapinfo.com/miwfs";
private const string defaultExportFileName = "WfsClient.gif";
[STAThread]
static void Main(string[] args) {
string exportFileName = defaultExportFileName;
if (args.Length > 0 && args[0] != null && args[0].Trim().Length
!= 0) exportFileName = args[0];
MapXtreme v7.1
410
Developer Guide
411
Developer Guide
MapXtreme v7.1
412
Developer Guide
Workspace Manager
The Workspace Manager utility that comes with MapXtreme enables you to
create and manage XML-based workspace files (.MWS format). The
Workspace Managers convenient user interface allows you to easily assemble
the tables that make up your map, apply many additional settings, and save the
map as a workspace. Your completed workspace is then ready for use in your
own applications, or for use in print or file output.
In this chapter:
23
Load XML workspaces, tables, geosets, and MapInfo workspaces (.mws not .wor files).
Save workspaces as .MWS.
Control which tables are opened as part of a workspace.
Create and load named connections using the Named Connection Manager.
Add, remove, and view one or more maps.
Toggle among maps using the tabs across the top of the Map window.
Set properties for map and layer visibility, layer and label styles, and themes with the built in
layer control.
Add, remove, or alter custom labels.
Create group layers, which allow you to organize your layers into logical groupings, so that you
can show or hide the entire group with a single click.
View multiple next and previous map views.
Use map tools for navigation and manual label placement, and use selection tools to verify that
layer selectability settings are correct.
Preview and print maps.
Quickly open recent workspaces from the recent file list
Create translucent effects for maps, labels, and theme layers
Create curved labels for polyline features.
Add a graticule layer to your map.
Reproject raster layers to current map window projection.
Reproject a map window made up of raster and vector layers to a different projection.
MapXtreme v7.1
414
Developer Guide
Add extensions to add custom functionality to Workspace Manager and Layer Control.
MapXtreme v7.1
415
Developer Guide
New Workspace
Creates a new empty map to which you can then add tables using either the Add tool in layer control
or the Open Tables command from the File menu. If changes have been made to the current
workspace, you will be asked if you want to save the changes before the new workspace is created.
Open
Opens an existing workspace or table. If changes have been made to the current workspace, you
will be asked if you want to save the changes before the existing workspace is opened. The Open
Tables command enables you to open one or more tables and add them to your map.
Insert Workspace
Adds the maps and tables from one or more workspaces into the current workspace.
Close Workspace
Prompts you to save any changes and closed the workspace.
Save Workspace
Saves your map as a workspace.
Save As
Save a copy of the workspace to a new filename.
MapXtreme v7.1
416
Developer Guide
Manage Tables
The Manage Tables command displays a dialog box that lists the tables that make up the map and
enables you to open additional tables for possible inclusion in the map. Click Open to display the
Open dialog box and open a table. The table you opened is added to the list of open tables in the
Manage Tables dialog box. Then you can add the table to the map using the Add tool, which is
located over the Workspace Manager layer control window.
To close a table, click a table from the list to highlight it. The Close button is activated. Click Close to
close the table. Layers referencing the table you closed are removed from the map.
A workspace can open tables that are not already in a map.
MapXtreme v7.1
417
Developer Guide
Page Setup
The Page Setup command enables you to specify the paper size, orientation, and margins of the
printed map. You can also use this option to access printer-specific settings.
Print
The Print command enables you to print your map to paper or file output. In the Print dialog box,
specify the printer to use, the page range you want to print if your job is multiple pages, and the
number of copies to print. Printer properties enable you to set layout and other options that are
specific to the printer you are using. The Print to file check box enables you to print your output to a
file.
Print Preview
Use the Print Preview command to see how your output is going to look before you print it.
Recent Workspaces
Recent Workspaces shows a list of recently opened workspaces.
Use the commands in the Map menu to add and remove maps, manipulate the view of the map, and
create thematic maps. The view commands are also available in a popup menu. Right-click in the
Workspace Manager map window to display the menu.
MapXtreme v7.1
418
Developer Guide
Manage Maps
From this menu the Manage Maps dialog appears where you can add or remove maps, set a map as
default, rename the map and/or alias and show/hide the legend tab (if map has a legend). The New
command enables you to create a new map window using the tables that are currently open. The
Manage Workspace Maps also provide the number of layers and legends in the map.
Layer Control
This menu command allows you to bring up the Layer Control dialog. It is active when the View >
Layer Control is unchecked and Layer Control is not visible. For a description of Layer Controls
features, see Layer Control Tools.
Change View
The Change View command enables you to change the current view of the mapthat is, what area
of the map is currently displayed in the window. You can change the zoom and scale of the map to
your own settings. You can also set the center of the map window, or change the rotation angle.
The Change View dialog box allows you to choose the units (miles, kilometers, etc.) for the zoom
width and for the center X/Y coordinates (meters, degrees, etc.). Whatever units you choose in the
Change View dialog box are also used in the layer control. For example, if you want all distances in
the layer control to be displayed in kilometers instead of miles, display the Change View dialog box
and choose kilometers from the units list that appears next to the Zoom field.
Previous View
Use the Previous View command to return to the previous view of your map.
Next View
The Next View command is available after you have used Previous View. Use it to redisplay the view
of the map that was on the screen before you used the Previous View command.
MapXtreme v7.1
419
Developer Guide
Preserve Scale/Zoom
Use the Preserve Scale and Preserve Zoom commands to keep the zoom and/or the scale the same
as you change the size and shape of the map.
Redraw
Use the Redraw command to redraw the map.
View Selection
Use the View Selection command to zoom in or out on a selected object or objects.
Theme Wizard
You can create feature themes and label themes via the Map > Theme Wizard menu command.
Feature themes include ranged, individual value, dot density, graduated symbol, and pie and bar
charts. Label themes include ranged and individual value.
If your map includes at least one set of labels, which are displayed in a label layer, you can create a
label theme. A label theme assigns different label styles (colors, font size etc.) to each label, based
on the data in your table. For example, use a label theme to show the prominence of locations over
others. A ranged label theme groups labels based on a similar data value, such as population. Cities
that fall within a certain population range are labeled using one style, while cities in other ranges are
labeled in another style, typically a less prominent style to indicate city size without having to label
using the population value.
The Theme Wizard walks you through 3 dialogs to create your theme.
To create a theme:
1. Choose Map > Theme Wizard.
The Create Theme: Step 1 of 3 dialog box appears.
2. Select either a Feature theme or a label theme, and choose the type of theme you want to
create.
3. Click Next.
The Create Theme: Step 2 of 3 dialog box appears.
4. Select the table you want to shade.
5. Choose the data you want to use. Select either a column from the table that contains the data, or
select Expression to use an expression to derive the data you want from the table.
6. Click Next.
The Create Theme: Step 3 of 3 dialog box appears. Here you can customize theme type
settings, styles, and the legend. (See How to Apply Translucent Effects to Themes for
instructions on applying translucency effects to a thematic map.)
7. Click Apply to apply the customized settings.
MapXtreme v7.1
420
Developer Guide
Arrow
This is a basic pointing tool. It does not select map features.
Zoom In
Use the Zoom In tool to get a closer area view of your map. To zoom in on a map:
1. Choose Tools>Zoom In to activate the tool.
Your cursor changes to a magnifying glass with a plus sign in it.
2. Click on your map.
The map redraws at a closer area view, centering itself at the point you clicked.
MapXtreme v7.1
421
Developer Guide
Zoom Out
Use the Zoom Out tool to get a wider area view of your map. To zoom out on a map:
1. Choose Tools>Zoom Out to activate the tool.
Your cursor changes to a magnifying glass with a minus sign in it.
2. Click on your map.
The map redraws at a wider area view, centering itself at the point you clicked.
One tool Zoom In and Zoom Out
To zoom in and out using the same zoom tool, hold down the Control key. When using the Zoom In
tool with Control you will zoom out stepwise with each click. When using the Zoom Out tool while
holding down the Control key, you will zoom in stepwise with each click.
Pan
Use the Pan tool to reposition your map without changing the zoom level. For example, you might
want to redirect the view of your map so that a certain country or city is in the center. To pan your
map:
1. Choose Tools>Pan to activate the tool.
Your cursor changes to a hand icon.
2. Click on the map, and while holding down the mouse button, drag the map to the desired
position.
The map redraws reflecting the new position.
Select
Use the Select tool to select objects one at a time or to select all objects that are generally in the
same area.
To select an object using the Select tool:
1. Choose Tools>Select to activate the tool.
The cursor changes to an arrow.
2. Click the object on the map you want to select.
The selected object is highlighted.
Radius Select
Use the Radius Select tool to select all objects that fall within a given radius. For example, you have
a table of blood donors and a table of blood donation sites. Using the Radius Select tool, you could
create a temporary list of blood donors that live within a one-half-mile radius of each blood donation
site.
Note that the Radius Select tool selects all objects whose centroid falls within the circle. The object
does not have to be completely bounded by the circle. To select objects within a radius:
MapXtreme v7.1
422
Developer Guide
Rectangle Select
Use the Rectangle Select tool to select objects within a rectangle. By clicking and dragging using the
Rectangle Select tool, you create a dotted rectangle, or marquee box around objects you want to
select.
Note that the Rectangle Select tool selects all objects whose centroid falls within the rectangle. The
object does not have to be completely bounded by the rectangle .To select objects within a
rectangle:
1. Choose Tools>Rectangle Select to activate the tool. The cursor changes to a selection arrow
with a small rectangle underneath it when you move the cursor over the map.
2. Click a place on the map outside of the area you want to include in the marquee box.
3. Hold down the mouse button and drag the mouse to form a dotted rectangle around the points
you want to select.
4. When you have reached the desired rectangle size release the mouse button.
Workspace Manager highlights all map objects that fall within that rectangle.
Polygon Select
The Polygon Select tool selects map objects within a polygon that you draw on a map.
To select objects with the Polygon Select tool:
1. Choose Tools>Polygon Select to activate the tool.
The cursor changes to a selection arrow with a small polygon underneath it when you move
the cursor over the map.
2. Click the map location at which you want to place the first end point of the polygon. Move the
cursor over your map in any direction.
Workspace Manager draws a line from the point where you clicked to the cursor.
3. Click to create another endpoint. Continue to move the cursor and click until you have the
desired number of sides to your polygon.
MapXtreme v7.1
423
Developer Guide
Label
The Label tool is used to manually add labels to a map at the location where the user clicks. Both
horizontal and curves labels can be drawn with the label tool. In its simplest use the Label tool draws
a label with the default settings. But MapXtremes extensive labeling capabilities provides a
tremendous number of style, position and visibility options that you can use to bring your labels to
life. See also Label Layer Settings and Curved Labels.
Load Extension
This command displays an Open dialog where you can navigate to the location of your custom
extensions. Extensions are created and saved as .DLLs using the file naming convention
<your_extension>.WorkspaceManager.Extensions.dll.
Manage Extensions
This command displays the Extension Manager dialog where you can load or unload extensions,
and modify properties of an extension. The loaded extensions display in the list box showing name,
version and assembly location.
MapXtreme v7.1
424
Developer Guide
Layer Control
The Workspace Manager application window is divided into two main sections. The layer control
window and commands are located on the left, and the map window is on the right. The layer control
window consists of the layer tree, which displays the opened map(s) and all of its accompanying
layers, and the dialog box tabs that contain map and layer settings.
The layer control features of the Workspace Manager enable you to assemble the layers of your
map and apply settings to individual layers or the entire map that govern how the layer(s) or map
display.
The Add tools allows you to open tables, and insert group layers and label layers into your map.
The Remove Selected Item tool removes the selected layer from the map.
The Up and Down toolbar buttons enable you to move layers up and down the layer list,
changing the order in which they are displayed.
Layer Tree
The layer control displays a tree showing the map and all layers in the map, including theme, label,
and graticule layers. The layer tree allows you to perform these operations:
MapXtreme v7.1
425
Developer Guide
Map Alias
When you hover the mouse over the Map node (the node at the top of the layer tree), the tooltip
shows the map alias. The tooltip aids developers who need to know the map alias (for example, you
need to specify a map alias when setting properties on web controls).
You can change a map alias by right-clicking on a map name and choosing Set Map Alias.
Displaying Layers
The check box next to each layer on the layer tree allows you to toggle the visibility of a layer with a
single click.
To move a layer into a group layer, drag the layer onto the group.
To add a new label source to a label layer, drag a layer onto the label layer.
If you do not want to move a layer into a groupif, instead, you want to reposition the layer so that it
is located above the group layerhold down the Shift key before completing the drag-and-drop
action. Similarly, if you do not want to add a new label source to a label layer, hold down the Shift
key.
To add a style override to a layer, display the context menu and choose Add Style Override. Note
that each layer can have multiple style overrides, each with a different zoom range; this allows
you set up the map so that points appear to grow larger, and roads appear to grow wider, as you
zoom in.
You can also add style overrides to seamless raster layers. When the style override is
highlighted, you can access the Raster Image Style dialog from the Visibility tab.
MapXtreme v7.1
426
Developer Guide
To rename any item in the layer tree, right-click the item and choose Rename. Alternately, you
can press F2 to rename the selected item. Note that renaming a layer in this manner does not
rename the original table; the rename operation simply changes the text that is displayed in the
layer tree. The information is stored in the workspace file when the workspace is saved.
To remove a layer in the layer tree, right-click the item and choose Remove. Alternately, you can
press the Del key to delete the layer.
By default, a layer is selectable when it is added to a map. This is controlled by the Selectable
check box of the Options tab in Layer Control (see Options). However, you can designate it as
the only selectable layer, and all other layers will be set to unselectable. This is very convenient if
you have a map with many layers but only want one layer to have selectable features. To specify
only one layer as selectable:
a. Right-click the layer name in the Layer Control or access the context menu.
b. Select Make This the Only Selectable Layer. This single map layer now has selectable
features. That is, you can use any of the selection tools to select objects on the map. All other
map layers will be unselectable.
Map Settings
When you select a map in the layer tree, the following tabs are available: View, Editing, Tools, Style,
Coordinate System, and Extents.
View
The View tab enables you to control the overall appearance of the map. You can set the zoom level,
scale, a center point (in degrees), and a rotation angle. Click the Apply button to apply your settings.
For raster reprojection, set the rotation angle in this tab and turn the reprojection on/off from
the Raster Reprojection tab. See Raster Reprojection.
Editing
The options in the Editing tab enable you to control certain map editing tasks such as the styles used
for drawing objects (if your application uses drawing tools), resizing objects, and moving and
deleting object nodes.
MapXtreme v7.1
427
Developer Guide
The style boxes enable you to specify the default styles of any drawing tools that your application
uses. Click on a box to open the corresponding style dialog box. The settings you select are saved in
the workspace. When a user opens the workspace in an application that uses drawing tools, the
application uses these style settings when the user draws objects on the map.
You can also specify whether you want to delete or move duplicate nodes. Check the appropriate
checkbox.
You can specify an Edit mode for the map:
The Edit mode you select applies to all editable layers in the map. You control a layers editability by
checking the box Editable on the layers Options tab.
When in Edit mode, it is a good idea to turn on the nodes for your map features. Highlight the layer
node (not the map node) and check the box on the Visibility tab.
To control whether labels are editable, check or clear the checkbox Labels are editable.
For an example that utilizes Edit mode, see Editing a FeatureGeometry with the Select Tool.
Tools
The Tools tab enables you to control the display of InfoTips, activate Snap to Nodes and set a snap
tolerance, and activate Dynamic Selection tools.
The Show InfoTips checkbox controls whether information about the feature displays in a pop-up
when you hover over the feature with a select tool. See Options.
If the Snap To Node check box is selected, map tools such as the Select tool will automatically
search for nodes that are nearby. If a node is nearby, a crosshair will appear to indicate the position
of the nearest node. For example, you might want to select the Snap To Node check box if you are
using the Radius Search tool, and you want to make sure that the search is centered at the exact
location of a point feature on your map. The Snap To Node feature is particularly important in
applications that provide drawing tools, because users often need to draw features at the exact
location of existing features.
MapXtreme v7.1
428
Developer Guide
Style
The options in the Style tab enable you to control translucency and anti-aliasing properties.
Use Anti-AliasingUse this option to smooth jagged edges of lines, curves, and region borders
when representing a high-definition rendition at a lower resolution. When you select Use
Anti-Aliasing, Enable Translucency is also selected automatically. Whenever Enable
Translucency is deselected, Use Anti-Aliasing is automatically deselected.
Enable TranslucencyUse this option to allow translucent values in style colors and layers
when drawing the map onto the screen, printer, or file export. When translucency is enabled, you
can use the translucency trackbar in style dialogs.
This property has no effect on raster translucency; however, Enable Translucency must be
selected to print translucent raster images.
For more information on anti-aliasing and translucency, see Enhanced Rendering with GDI+
Translucency and Anti-Aliasing.
MapXtreme v7.1
429
Developer Guide
Coordinate System
The Coordinate System tab indicates the coordinate system of the map, and enables you to change
the coordinate system.
To do this:
1. Click the Coordinate System button to display the Choose Coordinate System dialog box.
2. Select a coordinate system from the list, and click OK.
Extents
In the map, the Extents tab shows the extents of the current map view. Click the View Entire Map
button to see all of the map.
Raster Reprojection
The Raster Reprojection tab enables you to specify reprojection settings for raster and vector layers
in your map.
You can control the reprojection of both raster and vector layers. When you add either a raster or
vector layer to a map, the new layer can be reprojected into the current map window projection.
When you change the projection of a map window that contains a combination of vector and raster
layers, all the layers, both raster and vector, can be reprojected to the new map window projection.
These settings also exposed in the MapXtreme API. See the RasterReprojection and
RasterReprojectionResampling properties in the MapInfo.Mapping.FeatureViewer class in the
Developer Reference for more information.
Use the Raster Reprojection check box to turn Raster Reprojection on or off. Select the check box to
turn it on; clear it to turn it off. Raster reprojection is off by default, which means that reprojection is
not performed when a raster layer is added to a map.
Use the Reprojection Method settings to specify how raster reprojection is performed. Choose one
of the following:
MapXtreme v7.1
430
Developer Guide
Use the Reprojection Resampling settings to specify a resampling method for the reprojected raster
image.
Resampling is a method of restoring the pixel value (usually proportional to the brightness of a spot
on the ground object covered by the instant field of view of the image sensor) of the destination
raster image based on the source image being a discrete representation of the initial continuous
brightness field.
The pixel values of the destination image can be calculated using one of two resampling methods:
Cubic Convolution and Nearest Neighbor. Choose one of the following:
The Cubic Convolution method provides the best "restoration" of pixel values because of their
discreteness. In Cubic Convolution, a pixel in the destination image is calculated based on the
pixel values in a 4x4 pixel window centered at the basic pixel in the source image. The
coordinates of the basic pixel are calculated for every pixel of the destination image based on a
special optimized procedure. Pixels are then weighted based on the basic pixel coordinates. In
general, we recommend that you use the Cubic Convolution resampling method for aerial
images and satellite raster images to get a better image quality. 1
The Nearest Neighbor method replaces the pixel value in the reprojected image with the base
pixel value from the source image. This resampling method takes less time to render than the
Cubic Convolution method, but it may be less precise. In general, we recommend that you use
the Nearest Neighbor resampling method for raster maps, grids, and scanned maps to get faster
results.
To change the rotation angle of the raster reprojection, go to the View tab, provide an angle and click
Apply. See View.
Layer Settings
When you click on a map layer node in the Layer tree, the following tabs are available in Layer
Control.
Visibility
Select the Visible check box to make the map layer visible. Selecting the check box next to the layer
in the layer tree has the same effect.
Select the Display Within Range check box to specify either a zoom range or scale range in which
the layer appears. If you select a zoom range, specify the minimum and maximum zoom in miles.
The layer appears within this range. If you select a scale range, specify the closest and farthest
scale. The layer appears within this scale range.
1.
The Cubic Convolution algorithm used in MapXtreme is based on the work of S.K. Park and R.A.
Schowengerdt, Computervision, Graphics and Image Processing (1983, Volume 23, pp. 258-272).
MapXtreme v7.1
431
Developer Guide
Options
The Options tab check boxes facilitate editing and customizing a feature layer:
SelectableWhen the Selectable check box is selected, objects in the layer can be selected
using either the Tool menu commands or the Selecting tools in the toolbar. Clear the Selectable
check box for any layer you do not want to select from.
EditableSelect the check box to make the layer editable.
Drawing Tools can add features Select this check box if you are preparing this workspace for
use in an application that provides drawing tools, and you want the drawing tools to create new
features in this layer.
Show InfoTipsSelect the Show InfoTips check box to display InfoTips when you hover over
map objects in the selected layer. The InfoTip text consists of the result of the expression in the
InfoTip Expression field. For example, if the expression is a column in your table, the InfoTips
comprise the values from that column. If the expression is a calculation that uses column
information in your table, the InfoTips comprise the results of that calculation.
Snap to Nodes Select to turn the Snap To Node feature on or off for a specific layer, select the
layer in the layer tree, then select or clear the Snap To Node check box.
InfoTip Expression Control the InfoTip you want displayed in the InfoTip for the layer. You can
display more than the first column in your table. See Chapter 10: Creating Expressions.
Settings in the Options tab are unaffected by the layers visibility. You will be able to see the Options
tab settings regardless of whether the layer is currently visible.
Extents
For a layer, the Extents tab shows the extents of the selected layer. Click the View Entire Layer
button to see all of the layer, or click View Default Area to see the default view of the layer.
Information
The Information tab provides information about the selected layer. It gives the name of the table and
its path, the type of table, e.g., MapInfo table, and its coordinate system.
Visibility
When a theme layer is selected, the Visibility tab options control the display of the selected theme.
Select the Visible check box to display the theme layer; clear the check box to turn off the theme
display.
MapXtreme v7.1
432
Developer Guide
Theme
The Theme tab indicates the type of thematic map and the expression used to obtain the values.
The Theme tab also enables you to modify your thematic map. Click Modify Theme to change the
styles or legend.
Visibility
When a label layer is selected, the options in the Visibility tab control the display of labels. Select the
Visible check box to display labels; clear the check box to turn off label display.
Select the Display Within Range check box to specify either a zoom range or scale range in which
the labels display. If you select a zoom range, specify the minimum and maximum zoom distance.
Your labels display within this range. When you use a zoom range, the maximum value is
exclusivethe layer is only visible if the maps zoom is less than the maximum value. So, if you set
the maximum zoom value to 5000 miles, and then you zoom the map to exactly 5000 miles, the
layer disappears.
If you select a scale range, specify the closest and farthest scale. Your labels display within this
scale range.
Click Clear Label Modifications to return the labels to their default state. This button removes
individual labels that were manually added with the Label tool and restores labels to their original
position.
AutoLabel
The AutoLabel tab enables you to create and manage the display of autolabels. Select the Create
labels automatically check box to generate autolabels for your map. Select the Display Within
Range check box to specify either a zoom range or scale range in which the autolabels display. If
you select a zoom range, specify the minimum and maximum zoom distance. If you select a scale
range, specify the closest and farthest scale. Your autolabels display within this scale range.
MapXtreme v7.1
433
Developer Guide
Style
The Styles tab controls the style of label text and label lines. For label text, use the Text style box to
access the Text Style dialog box. You can specify the font, color, background, and other text effects
for the labels. For label lines, use the Line style box to access the Line Style dialog box, where you
set the style of the label lines. In the Label Lines group, choose whether you want no label lines,
simple lines, or lines with an arrow.
Label lines are not supported for curved labels. MapXtreme can load label lines created in
MapInfo Professional or if label lines are created using a customized label tool. See Curved
Labels.
Text
The Text tab enables you to specify an expression that produces the label text from a column or
derived information in the table.
Position
Use the settings in the Position tab to set the orientation, offset, and rotation of the labels.
The labels orientation is the labels position relative to its anchor point. Click one of the buttons to
select an orientation.
Label offset is how far away a label is from its anchor point in pixels.
The label rotation is the angle at which the label is drawn. There are three Rotation settings:
Rotate labels with segmentsSelect this option if you are labeling line features such as
highways, and you want each label to be drawn at an angle that will make the label run parallel to
the nearest segment of the highway.
Curve labels along segmentsSelect this option if you are labeling line features such as
highways, and you want the label text to follow the shape of the highways (that is, you want
curved labels). Turning anti-aliasing on via the Style tab in Layer Control will improve the look of
the resulting curved labels. For more information, see Curved Labels.
Specific angleSpecify an angle in degrees, such as zero degrees to make all labels horizontal.
MapXtreme v7.1
434
Developer Guide
Rules
The Rules tab enables you to set certain conditions for displaying labels on your map:
Allow Duplicate Text Select the Allow Duplicate Text check box to allow duplicate labels for
different objects to display, e.g., Portland, OR and Portland, ME. This option is also used with street
maps to label street segments individually.
Allow Overlapping Text Select the Allow Overlapping Text check box to allow labels to be drawn
on top of each other. Some labels do not display because they overlap labels that have been given
higher priority on the map.
Label Partial Objects Select the Label Partial Objects check box to label polylines and objects
whose centroids are not visible in the Map window.
Maximum Labels Specify the maximum number of labels you want displayed. For example, sort
your data so that the most prominent (largest population, highest revenue, highest growth rate,etc)
is at the top of your table. To display only the top 100 of these records, put 100 in the Maximum
labels box. Records that are below the 100-record cutoff will not display labels, thus the 100 labels
that do display will make a bigger impact on your map.
Per-Label Priority Expression This expression field is optional. If you leave this expression field
blank, features within a single label source are labeled in an unpredictable manner. For example,
you might find that some small cities are labeled, while some major cities are not labeled because
there is not enough room. If you specify an expression (which must be numeric), then the expression
will be calculated for each feature on the visible portion of the map, and features that have a larger
value will be given a higher labeling priority. To specify an expression, click the Set button.
MapXtreme v7.1
435
Developer Guide
MapXtreme v7.1
436
Developer Guide
Visibility
Line/Label Properties
Line Spacing
MapXtreme v7.1
437
Developer Guide
Extents
After making any changes in this tab, click Set Extents to activate the changes.
For more information on Graticules, see Graticule Layers.
MapXtreme v7.1
438
Developer Guide
Anti-aliasing can only be used when translucency is enabled. This is enforced both by the
user interface via the Workspace Manager and programmatically. When you select Use AntiAliasing, Enable Translucency is also selected automatically. Whenever Enable
Translucency is deselected, Use Anti-Aliasing is automatically deselected.
The following maps demonstrate label translucency and anti-aliasing effects on roads and highways.
Notice the smoothness of the region borders and polylines when anti-aliasing is enabled.
Before GDI+ Enhanced Rendering:After GDI+ Enhanced Rendering:
A translucency trackbar (TrackBarValuePicker control) in all style dialogs (Line Style, Area Style,
Symbol Style, Text Style, etc.) enables you to pick a percent value between 0-100 using the sliding
trackbar or the numeric selection box. However, this trackbar only works when translucency is
enabled.
MapXtreme v7.1
439
Developer Guide
MapXtreme v7.1
440
Developer Guide
To add translucent effects to a layer, use a style override to change the original style of the layer.
1. In Workspace Managers Layer Control, select the "root" node in the layer control (this
corresponds to the map). In the Style tab select Enable Translucency.
2. Select the layer you want to add translucency to, move it to the top of the list, then add a style
override.
3. On the Visibility tab for the style override, click the style button that is specific to the objects in
that layer. For this example click the Area style button.
MapXtreme v7.1
441
Developer Guide
4. Use the translucency trackbar to select the level of translucency you want to apply. Each color
has its own translucency level.
How to Apply Translucent Effects to Labels
The previous example also showed a translucent label similar to a watermark. If you turn off visibility
on the translucent city boundary region, the label looks as follows:
MapXtreme v7.1
442
Developer Guide
If translucency is enabled, you can select a translucent value for the start and end theme ranges
(bins), and automatically spread the color. This will also automatically spread the translucent value
between the start and end theme bins. For example, the theme in the above map has a translucency
value of 75% for the start bin (gray) and 50% for the end bin (red). Since this theme has 3 bins, the
middle bin is automatically given a translucency value of 63% (50 through 75 spread equally).
Curved Labels
Curved labels are labels that follow the curve of a line. They enhance the appearance of map
features that are made up of lines, such as streets and rivers.
Curved labels are generated in the Workspace Manager by selecting the label layer, then selecting
Curve labels along segments in the Position tab. For information on rendering curved labels via
the API, see the ILayout Interface section of the MapXtreme Developer Reference.
MapXtreme v7.1
443
Developer Guide
MapXtreme can only draw curved labels using TrueType fonts. If you select a non-TrueType font,
a comparable TrueType font is substituted and the label you chose may display differently than
expected. Also, if you change a horizontal label using a non-TrueType to a curved label, the new
label may display differently due to the font substitution.
Part of the label string must fit along the arc or polyline that it is labeling. If it cannot fit,
MapXtreme determines that the label is too long and discards it.
MapXtreme cannot draw curved labels for polylines that are very jagged, however, it depends on
the curvature of the line.
Although a street segment appears to be straight, the label may be curved. This happens
because the polyline data for the street segment contains a curve that is not visible at the current
zoom level. The label is following the curve of the street even though the curve isnt visible. If you
zoom in on the map to a close enough distance, you will be able to see the curve in the street.
Labels that curve onto themselves are discarded and do not display.
Curved labels follow the same rules for overlap detection, duplicate text, and partial segment
labeling as non-curved labels. Each of these rules affect how and when the labels are displayed.
You can create curved labels with the Label tool at any point along an arc or polyline.
You cannot drag curved labels as you can other labels; however, you can reposition them with
the Label tool.
The Label Lines controls are disabled for curved labels.
Curved and non-curved labels persist for layers in the workspace.
You cannot underline curved labels.
Curved labels are always drawn smoothly whether or not translucency and anti-aliasing are
enabled.
MapXtreme v7.1
444
Developer Guide
Although MapXtreme does not support creating label lines for curved labels in Workspace
Manager, it can load label lines created in MapInfo Professional or if label lines are created using
a customized label tool.
MapXtreme can load callout lines for labels that contain a custom (user-defined) location for the
line endpoint. For example, if you move the endpoint of a label in MapInfo Professional and save
it to a workspace (.MWS), the endpoint is positioned as expected when the workspace is opened
in MapXtreme. MapXtreme loads and saves custom line ends but does not support creating
them.
Curved labels created in MapInfo Professional and saved to an MWS display in the same
location in MapXtreme.
Labels that have been dragged to a new location in MapInfo Professional can be displayed as
curved labels in MapXtreme. When the label changes are saved to an .MWS workspace and the
workspace is opened in MapXtreme, the labels will display as curved labels when the curved
label option is turned on. Note, however, if the label in MapInfo Professional was dragged and
then rotated prior to being saved to the workspace, MapXtreme will not curve the label. This is
because MapInfo Professional has modified the angle of the label, which MapXtreme honors
over the curved label setting.
MapXtreme v7.1
445
Developer Guide
The length of the polyline(s) affect how the label is positioned. The longer the polyline(s),
the more predictably the labels display.
If the segment you select does not have a label name associated with it in the data, no
label is displayed.
Graticule Layers
Graticules are grids (lines of latitude and longitude) that overlay the map, spaced at a regular
distance (for example, every five degrees, every fifteen degrees). They are used to establish a frame
of reference.
MapXtreme v7.1
446
Developer Guide
In many ways, graticules behave just like other layers. However, a graticule layer differs from other
layer types in the following ways:
Graticule layers are not editable like other types of layers. That is, you cannot add new features
to them.
Although you can configure graticule label style and position, you cannot create a label layer on
a graticule layer.
You cannot create a thematic layer on a graticule layer.
By default, the graticule spacing and extents are determined based on the zoom and size of the map
window. So when you add a graticule layer to a map, graticule lines appear regardless of the zoom
level.
MapXtreme v7.1
447
Developer Guide
MapXtreme v7.1
448
Developer Guide
In this chapter:
24
Start -> All Programs -> MapInfo -> MapXtreme -> GeoDictionaryManager.
The GeoDictionary Manager is displayed. The file last opened is reloaded upon start-up.
MapXtreme v7.1
450
Developer Guide
Part
Description
GeoDictionary
The GeoDictionary edit box contains the full path to the GeoDictionary that is
currently being managed. The button (to the right of the GeoDictionary edit
box) allows the user to browse for another GeoDictionary to manage. Both
binary and XML GeoDictionary files can be opened, but only the XML format
is saved.
Registered tables
The Registered Tables list box contains a list of the friendly names for all
tables registered in the GeoDictionary. Highlight a particular table to either
unregister it or modify its properties. Double-clicking a table brings up the
Properties dialog box to edit those properties.
Register
The Register button brings up the common File Open dialog box, with the
Files of Type combo box set to MapInfo Tables (*.tab). After the table has
been chosen from the file picker, the Table Properties dialog for that table is
displayed. If you choose multiple files in the File Open dialog box, a
Properties dialog box is opened for each table added.
Unregister
Pressing this button removes the selected table from the GeoDictionary. You
can also select multiple tables (by shift-clicking) for unregistering. The
Unregister button does not remove the files from the disk.
Properties
The Properties button brings up the Table Properties dialog box for the
selected table. See the Table Properties dialog box below.
New
The New button clears the fields on the screen allowing the creation of a new
GeoDictionary file. When you choose to close this GeoDictionary file you are
prompted to save your changes.
Save
The Save button saves the current file as XML, regardless of the format of
the file when it was opened.
Save As
The Save As button allows you to save the current file to a new name or
location.
Exit
The Exit button closes the application. If you have modified the
GeoDictionary file you are prompted to save your changes.
Set the matching table properties for a given table using the Properties dialog box. To access the
Properties Dialog box, click the Properties button, or double-click on any table name in the
Registered Tables list.
MapXtreme v7.1
451
Developer Guide
Part
Description
MapInfo Table
Read-only edit box containing the file name of the MapInfo table if it
is located in the same directory of the GeoDictionary, or the relative
pathname to the file if it is not. If the file is located on a different
drive or volume, the full path is displayed.
Description
This field provides a mechanism for changing the friendly name for
the table. This control is defaulted to the Description tag in the .TAB
file, or the filename if the Description tag is not found, but can be
changed by the user. Note that changes to the description in the
GeoDictionary Manager are only be stored in the GeoDictionary
and is not reflected in the table itself. This allows the GeoDictionary
Manager to easily work with read-only data, e.g., data on CDROMs.
Match Percentage
This field is initially populated with the default value for the
GeoDictionary and can be altered for specific tables by changing
this value. Values must be between 1 and 100.
Field Information
This list box contains a list of all the indexed columns in the table. If
the box for a given column is checked, that field is searched during
the matching process.
MapXtreme v7.1
452
Developer Guide
Description
This field allows the user to set a refining table to determine exact
match for data that is not unique in a particular index.
Some tables, e.g., US Counties, contain indexed columns that are
not unique. In that situation, a refining table is necessary to
determine an exact match for data. If the table has non-unique
indexed columns, use this field to specify a table to use to match
against to find unique entries.
Add
Remove
453
Developer Guide
XML Element
Description
GeoDictionary
none
DefaultMatchThreshold
none
MatchTables
none
MatchTable
MapInfo Table.
TablePath
MapInfo Table.
TableDescription
RefineTableName
MatchThreshold
Match Percentage
AssociatedMaps,
AssociatedMap
MapXtreme v7.1
454
Developer Guide
XML Element
Description
MatchFields
none
MatchField, FieldName
MapXtreme v7.1
455
Developer Guide
In this appendix:
These tutorials guide you through customizing MapXtreme desktop applications and Web
Applications and preparing them for deployment.
MapXtreme v7.1
457
Developer Guide
data source
number of ranges (bins)
range type
range colors
legend location
toolbar
1. In Visual Studio, move your cursor to the Solution Explorer and right click on MapForm1.vb.
Choose View Code to display the code page.
If you have MapForm1.vb displayed in Design mode, you can right-click anywhere on the form,
and choose View Code.
All sample applications discussed in this tutorial were taken from the MapXtreme
distribution CD. The line numbers referenced may not correspond exactly with the code
in your installation.
2. A new tab displays to show the application code. Scroll down the code page to familiarize
yourself with the code. Notice that the majority of the action in the application takes place in the
Form1() class. This is where we will make our changes.
3. Lets change the data source on which the theme is based. To do this, well need to change the
name of mexicothe table that the application uses and specify a different FeatureLayer. Make the
following changes:
4. The image below highlights the code changes with red boxes.
MapXtreme v7.1
458
Developer Guide
5. Choose Debug > Start Debugging (or press F5) to run the application and see your changes.
Close the Form1 window when you are finished.
.
The application creates the same type of theme using Mexico data. You can pass in any data
source that fits this theme by changing the name of the table and the FeatureLayer.
Next, lets make changes to the theme itself. By manipulating the parameters passed to the
RangedTheme constructor we can change the way the theme is calculated and displayed.
6. Highlight the word RangedTheme in the code and press F1 (line 212). The help topic for
RangedTheme displays on the screen. You can read this topic to see what each parameter does
when it is passed to the constructor.
MapXtreme v7.1
459
Developer Guide
10. Choose Debug > Start Debugging (or press F5) to build and run the modified application.
Notice that the number of theme bins has increased and the distribution method has changed.
Close the Form1 window when you are finished.
MapXtreme v7.1
460
Developer Guide
Next well change the color of the ranges. You have two options for how you would like to modify
the colors. You can set a particular color for each bin, or you can set colors for the first and last
bin. The shading of the bins in between will graduate from the first to the second color. Currently,
the code specifies that the color ranges from white to blue. Lets change the colors to range from
blue to red.
11. To change the color of the ranges, well need to edit the fill style colors. Make sure the code view
is displayed and make the following changes:
To change the color of the first bin, on line 231, change WhiteFillStyle to
BlueFillStyle
To change the color of the second bin, on line 241, change BlueFillStyle to
RedFillStyle
Every bin in between will have a shade between blue and red.
12. Choose Debug > Start Debugging (or press F5) to build and run the modified application. The
colors of the map have changed to reflect our new settings. Close the Form1 window when you
are finished.
MapXtreme v7.1
461
Developer Guide
Because we have made a number of changes, the legend is now partially blocking the view of
the map. Well move the legend so that we can see all of the map. We could use the pan tool to
move the map, but panning would not be a permanent change to the application. The new map
position would be in effect only for as long as the application is running. Instead, well change the
position of the legend programmatically.
13. Make sure the code page is displayed and make the following change to the legend location:
14. The image below highlights the code changes with a red box.
MapXtreme v7.1
462
Developer Guide
The last modification well make is to add a Label tool to the toolbar.
16. In Visual Studio, open MapForm1.vb in Design mode.
17. From the Menu and Toolbars group in the Toolbox, choose ToolStrip and click on the MapControl
where you wish to add a Label tool. A split button appears.
18. Click the down arrow on the split button and choose the LabelToolStripButton from the list of
buttons.
Notice that a Label tool displays on the form in the upper left corner and is automatically
assigned to mapControl1 in the Properties windows.
MapXtreme v7.1
463
Developer Guide
As you can see, you can use the samples as a base for your own customization. You can substitute
your own data, modify themes, and add tools easily. Other modifications we could make to this
thematic map include:
Using a different column from the data source (table) so that the theme is based on a different
value, for example population. Dont forget to refresh the legend to match.
Adding additional themes and legends.
Adding additional tools.
MapXtreme v7.1
464
Developer Guide
4. Next, we need to add the data files. In the Solution Explorer, right-click on your setup project and
choose Add > File from the menu.
MapXtreme v7.1
465
Developer Guide
If you are deploying this application to another machine, the absolute paths for the data
on the development computer and the deployment computer must be identical.
To view or change the path that the setup file is written to:
1. Right-click on the setup project and choose Properties from the menu.
2. In the Setup Property Pages, the Output File Name can be changed. This is also where you
choose the configuration (debug or release) to build into the setup file.
If you wish to place your built application in the Start menu, on the File System Tab, right click on the
Users Programs Menu and click Create shortcut to Users Programs Menu and set the name and
properties as needed. Alternatively, a script can be written to place the program on the start menu
exactly where you would like it placed (for example, in a sub-menu).
Similarly, to place a shortcut on the users desktop, right click on the Users Desktop and click
Create shortcut to Users Programs Menu and set the name and properties as needed. Alternatively,
a script can be written to create the shortcut and place it on the user's desktop.
1.
MapXtremeTrial.lic must come from an SDK or runtime installation of MapXtreme in order to create a
package for deployment. You cannot create a setup project using the Evaluation version of MapXtreme.
MapXtreme v7.1
466
Developer Guide
MapXtreme v7.1
467
Developer Guide
The Thematics sample Web Application project contains a background map of the world, a pulldown menu listing different themes to be applied and attribute columns from a MS Access table as
well as an Apply button that applies the themes. The Web page contains the standard tool buttons
that are included in MapXtreme web templates: ZoomIn, ZoomOut, Center and Pan. The application
also includes a Layer Control so that you can set which layers are visible and view the current map
zoom level.
MapXtreme v7.1
468
Developer Guide
This Thematics sample Web application is designed very differently than its desktop sample
application counterpart. The most important difference is that the Web sample is tightly
coupled to the data table and data column names. These items cannot simply be changed as
was the case in the desktop sample.
In the code behind page, we will make some simple theme property value and range color changes.
These modifications will change the themes display when the user runs The method where we will
make our changes is in the CreateThemeOrModifier method, on line 244. The first change is to the
Dot Density theme and how it will be displayed.
1. In Visual Studio, move your cursor to the Solution Explorer and right click on WebForm1.aspx.
Choose View Code to display the code behind page, WebForm1.aspx.vb.
If you have WebForm1.aspx displayed in Design mode, you can right-click anywhere on the
form, and choose View Code.
All sample applications discussed in this tutorial were taken from the MapXtreme
distribution CD. The line numbers referenced may not correspond exactly with the code
in your installation.
Scroll down the code page to familiarize yourself with the code.
2. Make the following changes:
MapXtreme v7.1
469
Developer Guide
3. Choose Debug>Start Debugging (or press F5) to build and run the Web application. Once the
page is displayed in the browser, select DotDensityTheme theme, and then check Pop_1994.
The color of the dots on the map is now dark green.
Now lets make one more simple change to the Web sample. This change is to the Range
Theme.
4. Make the following changes:
5. Choose Debug>Start Debugging (or press F5) to build and run the Web application with these
new changes. Once the page is displayed, select RangedTheme, and then check Pop_1994.
MapXtreme v7.1
470
Developer Guide
As you can see, making simple display modifications to this sample Web Application is relatively
easy. Other possible modifications to this sample include:
Changing the web page layout, such as moving the controls around.
Changing the web page styles such as colors and fonts.
MapXtreme v7.1
471
Developer Guide
MapXtreme v7.1
472
Developer Guide
6. If you create your own deployment for a Web Application, you will need to add the MSMs
manually. For more information, see Deploying a Web Application
7. Next, you must include your data on the production server. You have the option of copying the
data to the production server manually, or installing it in a separate installer.
8. In the File System window in Visual Studio for the Web Setup project, right-click the Web
application folder and open the Properties window. Change the Virtual Directory name to
ThematicsWeb_7_0, which defines the virtual directory on the target machine.
MapXtreme v7.1
473
Developer Guide
1.
MapXtremeTrial.lic must come from an SDK or runtime installation of MapXtreme in order to create a
package for deployment. You cannot create a setup project using the Evaluation version of MapXtreme.
MapXtreme v7.1
474
Developer Guide
4. Right-click the 7.x.x folder and choose Add>File. Navigate to the MapXtreme trial license file
(MapXtremeTrial.lic), and add it to the 7.x.x folder. The MapXtreme trial license file is located
here: C:\Program Files\Common Files\MapInfo\MapXtreme\7.x.x.
MapXtreme v7.1
475
Developer Guide
MapXtreme v7.1
476
Developer Guide
Customizing MapXtreme
In this appendix:
Customizable Classes
The following classes have been designed to facilitate sub-classing to create custom subclasses
that more closely fit your development needs.
MapInfo.Data.Provider Namespace
ADO.NET
Engine.CustomProperties
Search
FeatureStyleModifier or FeatureOverrideStyleModifier
UserDrawLayer
Windows.Controls
Tools
Styles
GmlFeatureCollection
WorkSpacePersistence and WorkSpaceLoader
MapInfo.Data.Provider Namespace
MapXtreme provides an extensible data provider model for accessing data in forms that MapXtreme
cannot natively understand. This model requires an extensive amount of development and should
be undertaken only when the other methods of data access provided by MapXtreme is insufficient.
The model is explained in Appendix D: Extensible Data Providers.
ADO.NET
Before attempting to implement your own data provider using the Extensible Data Provider model
discussed above, consider the MapInfo.Data.TableInfoAdoNet class. This class provides access to
non-mappable data for which we have not provided a dedicated data source. See the Developer
Reference for more information.
Engine.CustomProperties
Use the CustomProperties class to add custom information to an object. The different kinds of
objects that CustomProperties can add to are: FeatureCollection, FeatureStyleModifer,
GmlFeatureCollection, GroupLayer, IFeatureCollection, IMapLayer, ISession, LabelModifier,
LabelSource, Legend, LegendFrame, Map, MapLayer, MapTool, MultiFeatureCollection,
Session.PooledSession, and Table. Add information using the Add method. Retrieve information
using the Item method. CustomProperties can be of any type.
Do not add MapXtreme objects directly into a CustomProperties collection. Doing so causes
errors during serialization. Instead add an Alias. For example, do not add a Map to a
CustomProperties collection. Instead add Map.Alias.
MapXtreme v7.1
478
Developer Guide
Search
To customize your search functions, there are a few classes that you can work with to accomplish
almost any kind of search that you desire. The QueryFilter class allows you to create custom
where clause to be used in SQL queries; the QueryDefinition class allows you to define a custom
SQL query to be executed; and a SearchResultProcessor sets up the post processing of the results
of your query.
For an example of how these classes are used, refer to the Search sample application included in
the Samples directory of your MapXtreme installation (the default installation location is: C:\Program
Files\MapInfo\MapXtreme\7.x.x\Samples\Desktop\Features\Search).
QueryFilter
The IQueryFilter interface defines the interface that all query filters must support. A QueryFilter is
used to define all or part of the where clause of a QueryDefinition.
QueryDefinition
The QueryDefinition class defines a query to be executed by a search. The QueryDefinition is made
up of a filter (IQueryFilter), Columns, and OrderBy. If no Columns are specified, then * is used.
ISearchResultProcessor or SearchResultProcessor
The SearchResultProcessor implements the ISearchResultProcessor interface which is used to do
post processing on the results of a search to narrow down the rows selected.
FeatureStyleModifier or FeatureOverrideStyleModifier
Create your own FeatureStyleModifiers to change the appearance of a layer by deriving from
FeatureStyleModifier or FeatureOverrideStyleModifier. These classes are used to specify a specific
FeatureStyle modification for the objects in a specific layer.
The following example creates a modifier that sets regions in USA.TAB to red if the population has
decreased from 1990 to 2000.
using MapInfo.Mapping;
using MapInfo.Styles;
using System.Drawing;
internal class UsaPopulationDecreasedModifier :
MapInfo.Mapping.FeatureStyleModifier
MapXtreme v7.1
479
Developer Guide
UserDrawLayer
The UserDrawLayer class is used to draw a custom layer in your map. You can populate this layer
with anything you like, including a customized logo, a transparent overlay of points, etc. To use this
class derive a new class from it and overload the draw method. The sample code below illustrates
this:
C# example:
using
using
using
using
System.Runtime.Serialization;
System;
System.Drawing;
MapInfo.Mapping;
[Serializable]
class MyUserDrawLayer : UserDrawLayer {
// Call the base class constructor with name and alias.
MapXtreme v7.1
480
Developer Guide
Windows.Controls
Many of the classes in the Windows.Controls namespace can be sub-classed to implement custom
behavior. Below are two examples of customizing the LayerControl using this approach.
MapInfo.Windows.Controls.PropertiesUserControl
If you want to add your own custom tabs to the LayerControl, create a class that subclasses
PropertiesUserControl. Then add your class to the collection of other tab classes by calling the
LayerControl's GetLayerTypeControls() and SetLayerTypeControls() methods. For an example of
how this works, refer to the sample application included in your Samples\Features directory of your
MapXtreme installation. Look in the MapBackgroundControl.cs file in the LayerControl sample
application for the class MapBackgroundControl which subclasses PropertiesUserControl.
MapXtreme v7.1
481
Developer Guide
MapNodeHelper
MapLayerNodeHelper
GroupLayerNodeHelper
LabelLayerNodeHelper
LabelSourceNodeHelper
LabelModifierNodeHelper
FeatureStyleModifierNodeHelper
RangedThemeNodeHelper
DotDensityThemeNodeHelper
IndividualValueThemeNodeHelper
PieThemeNodeHelper
BarThemeNodeHelper
GradSymbolThemeNodeHelper
Tools
Tools can be customized in two ways: by sub classing an existing tool or by adding code to a
Custom base tool. See Chapter 7: Desktop Applications, Controls, Dialogs, and Tools for more
information desktop tools. See Chapter 5: Web Applications, Controls, and Tools for information
on web tools.
MapXtreme v7.1
482
Developer Guide
Styles
The following classes can be used to add customization to your collections of styles to apply to
objects.
BitmapPointStyleRepository
The BitmapPointStyleRepository class is used to iterate through all current bitmap point styles and
allows you to add new bitmap images from a specified directory. Using the Refresh() method places
any new bitmap images into the repository that holds all images. The following code sample
demonstrates the reloading of the collection of images used for BitmapPointStyles from a directory
named C:\MyData\MyBitmapImages.
using MapInfo.Styles;
StyleRepository styleRepository = Session.Current.StyleRepository;
BitmapPointStyleRepository bmpPointStyleRepository =
styleRepository.BitmapPointStyleRepository;
bmpPointStyleRepository.Reload("C:\MyData\MyBitmapImages");
InteriorStyleRepository
The InteriorStyleRepository class is used to iterate through all current interior styles and allows you
to add new bitmap images for new interior styles from a specified directory. To add onto the current
set of interior patterns used to fill regions use the AppendBitmapPattern() method. The following
code sample demonstrates adding a new BMP image to the InteriorStyleRepository.
using MapInfo.Styles;
StyleRepository styleRepository = Session.Current.StyleRepository;
InteriorStyleRepository interiorStyleRepository =
styleRepository.InteriorStyleRepository;
// AppendBitmapPattern returns the zero-based index of the pattern in
// the repository. The index returned may be used to
// retrieve a SimpleInterior style using the repository indexer.
int index = interiorStyleRepository.AppendBitmapPattern(
"C:\MyImages\trees.bmp"
);
if (index >= 0)
{
SimpleInterior style =
(SimpleInterior)interiorStyleRepository[index];
}
LineStyleRepository
The LineStyleRepository class is used to iterate through all current line styles and allows you to add
new line styles. (You can use the Reload() method to put the new file into the repository. The
following sample code demonstrates reloading the collection of line style patterns used for
SimpleLineStyles from a PEN file in the C:\MyData directory.
using MapInfo.Styles;
MapXtreme v7.1
483
Developer Guide
VectorPointStyleRepository
The VectorPointStyleRepository class is used to iterate through all current vector symbols and
allows you to add new vector symbols from a specified file. In order to create your own version of the
symbol set, you need to use the Symbol Maker MapBasic application. Once your vector symbol set
is changed you use the Reload() method to read the symbol set into the repository. The following
sample code demonstrates reloading the collection of SimpleVectorPointStyles from an FNT file in
the C:\MyData directory.
using MapInfo.Styles;
StyleRepository styleRepository = Session.Current.StyleRepository;
VectorPointStyleRepository vecPointStyleRepository =
styleRepository.VectorPointStyleRepository;
vecPointStyleRepository.Reload("C:\MyData\MyVectorSymbols.FNT");
GmlFeatureCollection
The GmlFeatureCollection class is used to import features from an XML file. You can add Features
to a map by creating a FeatureCollection object and constructing FeatureObjects to add to it. Then
you can insert the FeatureCollection into a table.
MapXtreme v7.1
484
Developer Guide
485
Developer Guide
Load Method
The main method on IWorkspaceManagerExtension is:
IWorkspaceManagerNotifications Load(IWorkspaceManager callback);
This method is called after the extension class is constructed. It is passed an instance of an object
that implements IWorkspaceManager which allows the class to call back into Workspace Manager to
access elements of the user interface such as menus, toolstrips, tabcontrol and to execute
commands such as loading and saving workspaces.
public interface IWorkspaceManager
{
bool NewWorkspace();
bool LoadWorkspace(string filename);
void SaveWorkspace(string filename);
void MarkWorkspaceChanged();
bool HasWorkspaceChanged();
string LoadedWorkspaceFileName{get;}
int AddMapTab(MapInfo.Mapping.Map map);
int FindMapTab(MapInfo.Mapping.Map map);
int AddLegendTab(MapInfo.Mapping.Legends.Legend legend);
int FindLegendTab(MapInfo.Mapping.Legends.Legend legend);
void RemoveTab(int tab);
Microsoft.Win32.RegistryKey GetRegistryKey();
MapInfo.Windows.Controls.MapControl MapControl{get;}
MapInfo.Windows.Controls.MapControl GetMapControlFromTab(int tab);
MapInfo.Windows.Controls.LegendControl GetLegendControlFromTab(int tab);
MapInfo.Windows.Controls.LayerControl LayerControl{get;}
System.Windows.Forms.Form MainForm{get;}
System.Windows.Forms.MenuStrip Menu{get;}
System.Windows.Forms.ToolStrip FileToolStrip{get;}
System.Windows.Forms.ToolStrip MapToolStrip{get;}
System.Windows.Forms.ToolStrip ToolsToolStrip{get;}
System.Windows.Forms.StatusStrip StatusStrip{get;}
MapXtreme v7.1
486
Developer Guide
Event Handling
If your extension needs to receive event notifications from Workspace Manager, add a class that
implements the IWorkspaceManagerNotifications interface and returns it from the Load() method.
Workspace Manager calls this class when a workspace is created, loaded, or saved.
public interface IWorkspaceManagerNotifications
{
void OnNewWorkspace();
void OnWorkspaceLoaded(WorkSpaceLoader workspaceLoader, string
filename);
void OnWorkspaceSaving(WorkSpacePersistence workspacePersistence,
string filename);
void OnWorkspaceSaved(string filename);
void OnLayerControlDialog(MapInfo.Windows.Dialogs.LayerControlDlg
dlg);
}
MapXtreme v7.1
487
Developer Guide
Sample Extension
Here is an example extension for Workspace Manager that loads the previously-used workspace on
startup:
using MapInfo.WorkspaceManager.Extension;
using System.Windows.Forms;
using System;
public class LoadLastWorkspaceExtension : IWorkspaceManagerExtension
{
private string _name;
private IWorkspaceManager _callback;
private LoadLastWorkspaceExtension()
{
_name = "Load Last Workspace Extension";
}
public string Name
{
get { return _name; }
}
public string Version
{
get { return "0.57"; }
}
// this get called when extension is first loaded
// use it to hook up and UI like menu items, toolbars, etc
MapXtreme v7.1
488
Developer Guide
Filename
Abbreviation file
MAPINFOW.ABB
Pen file
MAPINFOW.PEN
MapXtreme v7.1
489
Developer Guide
Filename
Projection file
MapInfoCoordinateSystemSet.xml
MapInfow.fnt
CustSymb
Nadcon files
*.las, *.los
jgd2000 files
jgd2000.*
By default, MapXtreme applications look in the following directories for data files:
The list of directories corresponding to the above locations is obtained via the
ISessions.AppDataPaths property which returns the list as an array of strings. While you cannot add
to this list programmatically, you can add to it by defining a custom section in the applications
configuration file. This is illustrated in the sample code below. Note that the order in which additional
paths are defined determines the order in which they are searched, and all custom locations are
searched before the default locations listed above.
The following example shows the <SpecialPath> tag:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="MapInfo.CoreEngine"
type="MapInfo.Engine.ConfigSectionHandler,
MapInfo.CoreEngine, Version=6.8.0.536, Culture=neutral,
PublicKeyToken=93e298a0f6b95eb1" />
</configSections>
<MapInfo.CoreEngine>
<ApplicationDataPaths>
<SpecialPath>
<LocalApplicationData>YourCorporation\Your
Application<\LocalApplicationData>
<\SpecialPath>
</ApplicationDataPaths>
</MapInfo.CoreEngine>
</configuration>
MapXtreme v7.1
490
Developer Guide
MapXtreme v7.1
491
Developer Guide
Understanding the
MapInfo Workspace
In this appendix:
MapXtreme Java maps are saved as Map Definition Files (.MDF files)
MapX maps are saved as geosets (.GST files)
MapInfo Professional maps are saved as workspaces (.WOR and .MWS files)
These files have been the way for users of individual MapInfo products to share maps. MapInfo
Professional workspaces can also contain settings for browser and layout windows, graphs,
legends, and sometimes even printer settings.
The MapInfo Workspace format supports the creation of named resources for easier access and
portability to connections, map definitions, map layers, data source definitions and styles. The main
workspace schema is called MXP_Workspace_1_5.xsd. It is located on the product media. Other
supporting schemas include MXP_MapDefinition_1_5.xsd for map definitions and
MXP_NamedReources_1_5.xsd for named layers, connections, data source definitions and styles.
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. To review the MapInfo Codespace identifiers, see Appendix G: Defining
the MapInfo Codespace.
For more information about creating workspaces and about using the Workspace Manager, see
Chapter 23: Workspace Manager.
You cannot use .WOR workspaces created in MapInfo Professional with MapXtreme.
MapXtreme can read MapX geosets.
Structure of a Workspace
To give you a sense of the structure of a workspace, lets look at a workspace and the XML code
behind it. We will be looking at the World.MWS workspace, which is in the Sample directory of your
MapXtreme installation. Here, we describe four of the five types of data in the workspace.
1. The Header contains the basic file information including the version type and the creation date.
2. The Connection Section defines the database, file and WMS connections that are contained in
the workspace. This is where the named connection information is stored.
3. The DataSourceDefinition Section lists the definitions of the data and where it is located. If you
have named data source definitions, they would be included here.
MapXtreme v7.1
493
Developer Guide
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.
Connection Section
The ConnectionSet section defines the database connections and file connections that are
necessary to use the workspace. Currently supported database connections include MS Windows
ODBC connections, Oracle (OCI) connections, and JDBC driver connections. File connections
identify the path to the file. What follows are some examples of these connections.
<ConnectionSet>
<DBConnection dbType="sqlserver">
<ConnectionName>JCD_SS2005_MIGS_BOUNDARY2</ConnectionName>
<ODBCConnectionString>driver={SQL Native Client};server=JODEMPSEW3\MIGS;database=MIUS06_BOUNDARY2;uid=MIGS;</ODBCConnectionString>
</DBConnection>
</ConnectionSet>
<ConnectionSet>
<FileConnection dbType="file">
<ConnectionName>MapStorage1_US</ConnectionName>
<FilePath>c:\data\maps</FilePath>
</FileConnection>
</ConnectionSet>
MapXtreme v7.1
494
Developer Guide
MapXtreme v7.1
495
Developer Guide
496
Developer Guide
L
MapXtreme v7.1
Users need to have a map open with one or more layers to save it as a workspace.
497
Developer Guide
MapXtreme v7.1
498
Developer Guide
Extensible Data
Providers
In this appendix:
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .500
Extensible Data Provider Overview . . . . . . . . . . . . . . . . . . . . . . .500
Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .502
Required Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .504
Optional Building Blocks: Base Classes, Helpers and Utilities.506
Sample: COTW (Center of the World) Data Provider . . . . . . . . .507
Optional Interfaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .509
Building and Testing Your Data Provider. . . . . . . . . . . . . . . . . . .510
SpatiaLite Sample Data Provider . . . . . . . . . . . . . . . . . . . . . . . . .511
Advanced Topics / Important Considerations . . . . . . . . . . . . . . .512
Introduction
MapXtreme provides an Extensible Data Provider model that can be implemented to access data
formats that are not supported in MapXtreme. This model is consists of a collection of required and
optional interfaces, building blocks of abstract base classes and utilities.
Extending MapXtremes data provider model is a difficult undertaking that requires a major
commitment of development and testing resources. Most MapXtreme users find the existing
MapXtreme Data Providers for spatial data formats or Microsofts ADO.NET for non-spatial data
completely sufficient for their needs. See Chapter 8: Working with Data for a complete discussion
of MapXtremes data access options.
If you have data access requirements that cannot be satisfied through the MapXtreme data model,
consider extending it using the interfaces and guidance presented here.
MapXtremes Extensible Data Provider interface is organized under the MapInfo.Data.Provider
namespace in MapXtremes object model. Supporting these interfaces are classes in MapInfo.Data
and MapInfo.Data.Common namespaces.
The MapXtreme extensible data provider currently supports opening a table, reading the table
contents and associated metadata, searching the table contents using several methods, and
modifying table content through insert, update, and delete operations.
MapXtreme v7.1
500
Developer Guide
Data Provider
A data provider is a bridge between an application and a data source, which provides mechanisms
for accessing data for use in the application.
The MapXtreme Extensible Data Provider is a collection of interfaces that allows you to access data
from any data source in any data format. It extends the MapXtreme Data Provider which provides
the connection between data and the capabilities of MapXtreme, such as display, query, edit and
analyze.
The term Data Provider is used to refer to a specific implementation of the extensibility interfaces.
For example, MapXtreme includes a Data Provider implementation for accessing SpatiaLite (based
on SQLite) databases. There is an interface in the data provider collection of extensible interfaces
called IDataProvider which forms the basis for a data provider implementation.
Data Source
A data source is a database management system, web service, or other engine or software API that
exposes data and data access capabilities, such as describing, querying, manipulating and relating
data.
An example of a data source is a WFS server that returns map data as a collection of features. The
WFS server is the data source from which Feature types can be exposed as tables. The URL for the
service, and possibly other properties for authentication, define how the data provider will access the
data source. This information is called the data source definition.
MapXtreme v7.1
501
Developer Guide
Table
A table is a set of features that have the same schema (or set of columns). Tables do not have to
have a geometry property; however, it is likely that if you are building a data provider you probably
have a geometry property on some of your tables. Geometry data is treated by MapXtreme as a
column on a table just like other columns with simpler data types like strings or numbers.
The table exposes metadata to describe the data it contains and provides access to query and edit
that data. Every feature in a table must be uniquely identified by the data provider using a key. Keys
are used by MapXtreme for selections, result sets, and for editing operations.
Cursor
A cursor is an object that enumerates through a set of features. MapXtreme will request features
from the data provider by calling one of the search methods on the table. The table will return a
cursor that will allow MapXtreme to enumerate through the features that satisfy the criteria specified.
Features that are returned through cursors are expected to be transient. That means that the data
that is obtained from the current feature is assumed to be only valid while the cursor is open and
positioned on that current record. Once the position of the cursor is changed (by moving to the next
feature or by closing the cursor), then that feature is no longer assumed to be accessible. Robust
and scalable data provider implementations should be able to use the transient nature of the cursor
model to reuse memory, especially for returning FeatureGeometry objects.
A feature accessor is a special type of cursor that is used to access features by key. Any time
MapXtreme needs to access one or more features by key, it will request a feature accessor and then
request the features from it. The same transient expectations described for a cursor hold for a
feature accessor.
Getting Started
Now that you have decided to go ahead and extend MapXtremes data provider model, your first
question is likely "Where do I begin."
Where do I begin?
We recommend that you start by reviewing this entire appendix and the reference implementation to
familiarize yourself with the concepts and how they related to each other. When you are ready to
begin, start by building a very simple data provider in order to get a good understanding of the
requirements this undertaking involves. Even if your ultimate data provider needs are extensive,
building a basic data provider using only the required elements will provide you with a good
understanding of the data model.
The bare minimum elements are provided in the sections Required Components. Study the
Extensible Data Provider Overview to understand how the various interfaces relate to each other
and to MapXtremes data access model. Review the provided Sample: COTW (Center of the
MapXtreme v7.1
502
Developer Guide
MapXtreme v7.1
503
Developer Guide
Required Components
To build a basic data provider, the following components must be implemented. These classes
support basic data access operations including opening a table, reading the table contents and
associated metadata, and searching the table contents.
Refer to the SpatiaLite Sample Data Provider as a complete and robust provider implementation
for tips and guidance on how to implement these interfaces.
IDataProvider Interface
The IDataProvider interface provides the basis for a custom data provider implementation by
exposing the capabilities for opening the table formats serviced by this provider. This also exposes
capabilities related to data sources that manage those tables. Implementing the IDataSource
interface is an optional task as you can build a data provider without going through a data source.
This class is typically defined to be a singleton instance.
ITableDefinition Interface
The ITableDefinition interface provides the main link between your extensible data provider and the
MapXtreme public API Table model. It provides the properties necessary to instantiate an ITable for
a specific data provider. Classes that implement this interface identify the information required to be
supplied by the user of MapXtreme to open a table. The MapXtreme Catalog provides a few
overloads to the OpenTable method that allow you and other users of your data provider to
instantiate a table from an ITable. After the call to OpenTable, all other interfaces such as
ITableMetadata, ICursor, IFeature, etc are hidden to the user and used internally by MapXtreme.
MapXtreme v7.1
504
Developer Guide
ITable Interface
The ITable interface defines the interface for a Table, the basic container of information that
MapXtreme can read. query and display in a map. Methods on ITable include SearchAll,
SearchByEnvelope (area of interest) and SearchByKey. A table represents a single collection of
features and all features must contain the same structure (or schema).
ITableMetaData Interface
The ITableMetaData interface is used to convey important information about the properties and
supported capabilities of an open table, such as the columns and their data types, the types of
geometries contained in the table, and whether it supports editing operations.
The table metadata exposes the schema of the table as a collection of column definitions. Columns
are exposed through the IColumn and IGeometryColumn interfaces. Any column that returns
FeatureGeometry objects must be exposed as an IGeometryColumn. The IGeometryColumn also
enables the provider to indicate whether it supports Z and M dimensions in the geometry values it
returns and accepts during insert and update operations. Most data provider implementations will
have custom implementations for IColumn and IGeometryColumn to assist with the communication
of information between the MapXtreme search requests and the underlying provider implementation.
ICursor Interface
The ICursor interface is an IEnumerator that returns IFeature objects. When a search request is
issued against an ITable, the result is an ICursor which provides the access to the features. The
features returned from the cursor may be transient meaning that they are only expected to be valid
while the state of the cursor is unchanged. Advancing the cursor to the next record (feature) may
return the same feature object which may have been updated to the new values of the current
record. Robust data provider implementations should take advantage of this behavior to reuse
memory.
Search requests may request a subset of the attributes (columns) that the table exposes. The
features returned from the cursor must match the structure of the columns requested by the search.
IFeatureAccessor Interface
IFeatureAccessor is used to fetch features by key from a table. It has one primary method that it
exposes called FetchByKey which returns the feature identified by a given key. Each feature
returned by the data provider must contain a key. The definition and contents of a key are
determined by the data provider. When MapXtreme gives a key back to the data provider for
FetchByKey requests or editing operations, the data provider will use the key value(s) to identify the
correct record. The IFeatureAccessor interface provides a way for MapXtreme to bracket a set of
calls so that the data provider can, if desired, prepare a command and then bind in just the key
value(s) and execute the command for each FetchByKey call.
MapXtreme v7.1
505
Developer Guide
It is well worth understanding what pieces are provided here before starting to build even the
simplest implementation, as some pieces may already be built.
Utility Classes
SimpleFeature
The basic goal of a data provider is to access features. A feature is typically a row in a table. Spatial
features are described by their geometry, style, key, and attributes.
We provide a utility class called SimpleFeature, that implements the IFeature interface. It
implements a relationship of defining metadata (SimpleFeatureMetdata), and a list of Attributes
(AttributeValues) to a Feature, along with an identifying key (IKey)value. Most data providers will
want to use the SimpleFeature class.
SimpleFeature also implements FeatureChangedEventHandler event management.
SimpleFeature is documented under the MapInfo.Data.Common namespace.
OGC Conversion for Geometries and Coordinate Systems
The MapXtreme Extensible Data Provider includes utilities that help in the conversion process from
an OGC geometry (OpenGIS Simple Features Interface Standard) into a MapXtreme geometry
and vice versa. This includes OGC-regulated well-known text and well-known binaries that a number
of spatial data systems take advantage of, such as PostGIS, mySQL and SQL Server 2008. Wellknown text refers to a standard textual representation for spatial reference systems. Well-known
binaries are a standard binary representation for geometries.
MapXtreme v7.1
506
Developer Guide
Key implementations
A requirement of data that is to be accessed by a MapXtreme data provider is that every feature has
a key. We provide in this SDK two common key implementations: integer key and string key.
If your data is integer or string-based, you can skip the implementation of a key from the IKey
interface, and use one of these.
using System;
using MapInfo.Engine;
using MapInfo.Data.Provider;
namespace COTW
{
public sealed class COTWDataProvider :
{
private static string PROVIDER_NAME = "Center of the World
Sample Extensible Data Provider for MapXtreme";
private static COTWDataProvider m_singleton = null;
private COTWDataProvider(string name)
: base(name)
{
}
public static COTWDataProvider GetInstance()
{
if (m_singleton == null)
m_singleton = new COTWDataProvider(PROVIDER_NAME);
return m_singleton;
}
}
}
MapXtreme v7.1
507
Developer Guide
MapXtreme v7.1
508
Developer Guide
Optional Interfaces
The MapXtreme Extensible Data Provider model includes optional interfaces to provide more
capabilities when accessing data, including:
IDataSource
IDataSourceDefinition
ITableModifyProcessor
IDataSource
The IDataSource interface is used in Catalog.OpenTable to associate a new table with a specific
data source. This is optional as you can build a data provider without going through a data source.
A data source is instantiated when an ITableDefinition is being opened which contains an associated
IDataSourceDefinition or directly through Catalog.DataSources.OpenDataSource method. The
extracted IDataSourceDefinition is supplied to IDataProvider.OpenDataSource to connect to the
data source and return the associated IDataSource instance.
IDataSourceDefinition
A DataSourceDefinition is only necessary when you are using a data source to access data. It
includes the information you expect the user to supply in order to be able to instantiate a data
source. If you are not using a data source, you only need to provide a Tabledefinition in order to
open a table.
In the process of the table being opened, the IDataSourceDefinition is extracted from the
DataSourceDefinition property and passed into OpenDataSource(IDataSourceDefinition,
CustomProperties) to try and establish a connection to the data source.
When implementing a DataSourceDefinition, you should provide a meaningful override
implementation of the System.Object.Equals(object) method.
ITableModifyProcessor
The table metadata indicates whether Insert, Update, or Delete operations are supported. If any of
these are true, then you must supply an implementation for the ITableModifyProcessor.
Implementations for the specific insert, update, and delete methods must be provided according to
the corresponding individual metadata properties. Some data providers may only support insert
operations for example. The ASCII data provider supplied with MapXtreme is an example of a data
provider that only supports insert operations and not update or delete operations.
Note that the ITable interface also includes a property named ReadOnly. This property is an extra
level of control through which you can indicate if the table is read only. Even if your provider supplies
a fully implemented modify processor, a specific table may be read only for other reasons such as
insufficient access permissions or the data files are on read only media. Your data provider can
check for these up front and flag the whole table as ReadOnly or through the individual table
metadata properties.
MapXtreme v7.1
509
Developer Guide
510
Developer Guide
Unlike MapXtremes other sample applications that compile and provide a runnable
application, this sample implementation yields .NET assemblies. The focus on the
development for this sample was to showcase extensibility options in MapXtreme rather than
a working application.
MapXtreme v7.1
511
Developer Guide
MapXtreme v7.1
512
Developer Guide
Creating Geometries
Coordinate Systems
Styles
Exception Handling
Persistence Providers
Serialization
Authentication
Thread safety
Creating Geometries
Extensible data providers implementing support for 3rd party spatial formats must convert spatial
data between their format and the MapXtreme FeatureGeometry format. FeatureGeometry objects
are returned as values of the IFeature objects obtained from cursors and feature accessors. The
features and the geometry objects they contain are transient. MapXtreme will only assume that
these objects are valid while the cursor is open and positioned on the current feature. As a result,
the most robust and scalable data provider implementations will try to re-use the same feature and
feature geometry objects for the life of the cursor or feature accessor.
A geometry that is created once and continually updated for the current feature is referred to as a
transient geometry. MapXtremes geometry model contains constructor and method signatures
that facilitate geometries being used in this way. Following the initial construction of MultiPoint,
MultiCurve, and MultiPolygon objects, geometry editor interfaces can be used on these existing
instances to make the changes for the new feature. For MultiCurve and MultiPoygon objects, the
Clear method can be used to empty the geometry, and then AddCurve and AddPolygon can be used
respectively to redefine the geometries. For MultiPoint objects, the ReplaceAll method can be used
for redefinition. Furthermore, the constructor signatures and Add/Replace methods that use input
arrays support an optional size designation enabling single array instances to be efficiently re-used
as well.
The OGC conversion code works in this manner. The internal byte arrays used for parsing the well
known binary and well known text are reused and grown as needed. When data is supplied to the
appropriate geometry methods (like AddPolygon) the forms that accept an array size are used since
the input arrays may be longer than the data being supplied.
MultiPolygon objects composed of multiple polygons are generally checked by MapXtreme to
determine if any of the polygons have interior/exterior relationships to one another; for example, a
doughnut shaped MultiPolygon instance might be comprised of an exterior polygon with a second
interior polygon interpreted as a cutter such that the two together logically represent a single
geometry. The geometry code does not make any assumptions by default, and when editing is
complete it will analyze all of the constituent polygons searching for the existence of these
relationships. If the 3rd party spatial format being converted already knows these relationships and
can add the polygons in the correct sequence (exteriors followed immediately by any of its
associated interiors), theres no need for MapXtreme to incur the potentially expensive cost of reanalyzing all of the polygons. This operation can be suppressed using the overloaded
EditingComplete method on the MultiPolygon class and passing true to the withinSpecified
argument.
MapXtreme v7.1
513
Developer Guide
Coordinate Systems
Geometry columns in MapXtreme must return FeatureGeometry objects in the same coordinate
system. Different column and different tables may use different coordinate systems but all geometry
values returned from a single column in a table must be in the same coordinate system and must
match the coordinate system that is supplied by the table's metadata through the
IGeometryColumn.CoordSys property.
Most data providers will determine the coordinate system through some metadata that is stored and
managed with the data. However, if that information is not available, the data provider can request
that the suer supply the coordinate system as part of the table's definition.
Coordinate systems can be constructed through the CoordSysFactory instance which is available
fro the Session.CoordSysFactory property. There is no need to create new coordinate system
objects for every FeatureGeometry object returned by the data provider. The coordinate system
object returned by the IGeometryColumn interface can be referenced directly by each
FeatureGeometry object. FeatureGeometry objects supplied to the data provider for insert and
update operations will be transformed to the column's coordinate system by MapXtreme before
handing to the data provider.
Styles
MapXtreme's Extensible Data Provider model supports styles for feature geometries in two ways:
The MapInfo.Data.Table that is opened from an extensible data provider table will have a style
column, provided there is at least one geometry column (mappable table). The data for that column
comes from either a style column in the extensible data provider table, or if there is not one, from the
default style specified on the IGeometryColumn.DefaultStyle property of the geometry column in the
data provider table.
ITableMetadata.Columns
Style information is communicated via the column definitions provided in the
MapInfo.Data.Provider.ITableMetadata interface. A style attribute column is an IColumn instance
from ITableMetadata.Columns whose DataType property is assigned the value MIDbType.Style. A
style attribute column is only necessary when two or more features within the table may contain
distinct style values.
MapXtreme v7.1
514
Developer Guide
IGeometryColumn.DefaultStyle
A style attribute column is not required when you want to apply a single style uniformly when
rendering the objects within one of the tables feature geometry columns. For this, a style object
instance can be directly managed as the DefaultStyle property of the feature geometry column
(IGeometryColumn.DefaultStyle).
Providing a default style is always recommended, even when a style column exists. The default style
is used to fill in missing style attribute values if the style column contains null or missing values. In
the absence of an explicitly provided default style, MapXtreme does have an internal default style it
can apply as needed.
If using only a default style on the feature geometry column, a style column will still be shown in the
columns collection associated with the resulting Table instance opened within the Catalog. This
column will be nullable and read-only, and all values are defaulted to the specified default style
instance value.
While no explicit proscription is made against defining multiple geometry column and/or multiple
style column data configurations within your extensible data provider implementation, the metadata
model does not support the explicit association of a style column to a geometry column. When
rendering a map layer, theres an implicit assumption that the table servicing that layer contains a
single geometry column with at most one adjacent style column. Similarly, where the model also
permits extensible data providers to define tables containing style columns without an adjacent
geometry column, these tables cannot currently be cached, and may not be exportable to other
formats.
Exception Handling
Exception handling in the data provider is very important. The data provider will usually be handling
system resources such as file handles or database connections. If these resources are not carefully
cleaned up in normal and exception code paths, they may be leaked giving applications unusual
behaviors or memory leaks that build up over time. These problems are often accentuated in web
applications that utilize pooled sessions in which memory leaks may eventually cause the system to
shut down or multiple processes to hang waiting for leaked connections to be released.
Exceptions thrown should follow standard .NET practices as prescribed by Microsoft in Best
Practices for Handling Exceptions. When throwing a custom exception, use the
MapInfo.Data.Provider.DataProviderException class. This class may be subclassed to provide
additional behavior if necessary.
Exception handling is also a good time to think about externalizing the resources for your data
provider. By properly capturing resources such as strings, bitmaps, etc. in resource files, your data
provider can be localized for other cultures. The SpatiaLite Data Provider sample provides a
reference implementation for handling resource strings for exception handling (refer to the
Resources.cs file in the project).
MapXtreme v7.1
515
Developer Guide
Persistence Providers
MapXtreme offers support for saving data access information, namely ITableDefinitions and
IDataSourceDefinitions, to a MapXtreme XML-based workspace (.MWS). This is an optional
component of the Extensible Data Provider that you may wish to take advantage of if you need to
share your workspace with others or to simply re-use the information at a later time.
To add persistence support to your Extensible Data Provider, in its simplest form, you would write a
persistence provider class that implements the MapInfo.Data.Provider.IMxpPersistenceProvider
interface.
For a more sophisticated persistence provider, consider providing a schema to support XML
validation of the resulting workspace file. This would only be necessary if you have an explicit
requirement, as MapXtreme does not automatically validate workspace XML.
You may also consider writing your persistence provider as its own assembly. Providers may be preloaded independent of the remaining extensible data provider components. A provider assembly
would defer the loading of the remaining components by controlling just-in-time loading of the data
provider when and if it is explicitly needed.
MapXtreme v7.1
516
Developer Guide
MapXtreme v7.1
517
Developer Guide
Serialization
Serialization is the process of converting an object into a stream of data in order to preserve it in a
permanent form or in memory for the duration of its usefulness. This process is an essential part of
maintaining objects in MapXtreme web applications and multi-threaded desktop applications.
Without serialization, objects would need to be recreated, for example, every time there was a web
request for that object during a session.
When a serialized object is requested, it is deserialized (or recreated from the stream of data) and
then modified. MapXtremes serialization algorithm does not make a copy of the object (as other
serialization algorithms do) such that the object being deserialized is created only once.
For proper state management of web applications and multi-threaded desktop applications,
application developers often need to serialize MapXtreme Table instances directly, or via
serialization of the MapXtreme Catalog which contains the collection of all tables. When a table type
is not supported, it places a burden on the application developer to figure out how to explicitly
manage those tables and the overall state of their Catalog to operate around this limitation. For that
reason, Extensible Data Provider developers are encouraged to support serialization of their
provider to properly integrate into MapXtreme's Table serialization workflow.
MapXtreme v7.1
518
Developer Guide
519
Developer Guide
Implementing Serialization
Classes are serialized by being tagged with the [Serializable] attribute or by implementing the
System.Runtime.Serialization.ISerializable interface. We recommend you do both. The
ISerializable.GetObjectData method must be implemented and it must be public:
public void GetObjectData(SerializationInfo info, StreamingContext
context)
For classes derived from the abstract base classes, this signature should also contain the override
keyword, and the first line of the implementation should delegate to the base class for serialization of
the components it is managing. For example:
base.GetObjectData(info, context);
The remaining serializable members within the instance are serialized into the SerializationInfo
argument named info by providing a string key and the member value to its AddValue method. For
example:
info.AddValue("TableName", _tableName);
Implementing Deserialization
To support deserialization, provide a protected deserialization constructor whose arguments match
those on GetObjectData above. For example:
protected COTWTableDefinition(SerializationInfo info, StreamingContext
ctxt)
For classes derived from the abstract base classes, this constructor should delegate to the base
class for deserialization of the components it is managing. For example:
protected COTWTableDefinition(SerializationInfo info, StreamingContext
ctxt) : base(info, ctxt)
Within this constructor, the class instance assigns its member variables by retrieving values using
the get methods available on the SerializationInfo argument named info. For example, to
deserialize the TableName value serialized in the GetObjectData example above, the code might
resemble the following:
_tableName = info.GetString("TableName");
There are different recommendations regarding override support, method attributes, etc., for
methods pertaining to serialization depending, at least in part, upon whether or not the implementing
classes are sealed. Using a code analysis tool like FxCop can provide valuable assistance in
providing proper recommendations.
MapXtreme v7.1
520
Developer Guide
Authentication
Many Data Providers require authentication when opening a Data Source or Table where the details
of the authentication are kept secure and unavailable from a publicly accessible and shared
workspace file.
To support run-time authentication of the OpenDataSource and OpenTable processing, the
MapXtreme Extensible Data Provider model provides a new interface called the
IDataProviderCallback with support for user-defined callback methods that the Extensible Data
Provider can use to resolve data source and table definitions that are insufficient in some way that
prevents the opening of a data source or table.
For the simplest implementation, the client code for a custom Data Provider would contain a class
that implements the IDataProviderCallback interface and provides implementations of the
IDataSourceDefinition and/or ITableDefinition callback methods that are then used directly to open
the data source or table.
For most users, however, it will be necessary to load a separate assembly containing the
IDataProviderCallback initialization and load the assembly as part of the MapXtreme Session
initialization. See ISessionEventHandlers. This would be required when you are attempting to
resolve data source or table definitions at the time a default workspace is loading. Web-based
applications, for example, will require the session initialization support for callbacks.
MapXtreme v7.1
521
Developer Guide
522
Developer Guide
523
Developer Guide
Thread safety
MapXtreme is thread safe meaning that different threads may concurrently be accessing different
sessions, catalogs, tables, maps, etc. without any unintended side-effects. MapXtreme objects are
not multi-threaded meaning that the same instance of a map, table, catalog, etc. cannot be
accessed from multiple threads at the same time. Data provider implementations must at least follow
this model if there is ever an expectation that the data provider will be deployed in a web
environment.
Generally your code should be thread safe as long as you do not rely on any global variables,
singleton objects, etc. You should also not rely on use of Thread Local Storage since ASP.NET may
actually cause the executing thread of your request to change. If your data provider follows these
guidelines, you should not require much, if any, synchronization locks throughout your code which
may choke the scalability of the solution. The actual data that you are accessing, however, may
have implied synchronization that is either unavoidable or preferred. For example, if your data
provider exposes data from an Excel spreadsheet, the spreadsheet may be locked from editing
MapXtreme v7.1
524
Developer Guide
MapXtreme v7.1
525
Developer Guide
Printing From
MapXtreme Applications
This appendix will guide you in printing the best possible map images from your
MapXtreme development project. We begin by giving you an overview of
printing functionality and some helpful tips and tricks, then we help you
troubleshoot issues you may be experiencing printing with your MapXtreme
application.
In this appendix:
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .527
Understanding the Print Options in MapXtreme . . . . . . . . . . . . .527
Implementing Printing in Your Application . . . . . . . . . . . . . . . . .531
General Printing Tips and Tricks . . . . . . . . . . . . . . . . . . . . . . . . .533
Resolutions to Known Printing Issues. . . . . . . . . . . . . . . . . . . . .536
Overview
Printing from MapXtreme-developed applications can usually be straight forward. However as the
variety of printing devices continue to expand, device-specific problems do occur. We provide a
variety of features to you, the developer, to customize your users printing experience. These options
are designed to optimize printing depending on the map being printed and the device being used.
These different settings are designed to meet the needs and nuances of a variety of printers and
plotters.
MapXtreme supports:
The classes that handle printing in MapXtreme applications are derived from the Microsoft.NET 2.0
Framework System.Drawing.PrintDocument class and inherit that functionality. Device output
control is managed by the Microsoft.NET 2.0 Framework System.Printing.PrinterSettings and
System.Printing.PageSettings classes. The MapInfo.Printing.MapPrintDocument class is specifically
for printing maps, while the MapInfo.Printing.LegendPrintDocument is used specifically for printing
legends.
MapXtreme v7.1
527
Developer Guide
Printing Sizes
MapXtreme provides the options to print your map in different sizes. To alter the size in which maps
are printed set the MapPrintDocument.MapPrintSize property to one of the values in the
MapPrintSize enumeration. The values are as follows:
Fit to Page
This option is the default and the resulting map is printed with its aspect ratio maintained, but scaled
to fit on the page.
MapPrintDocument.MapPrintSize=MapPrintSize.FitPage
Fill Page
This option prints the map so that it fills the page. This method does not maintain the aspect ratio
and the resultant map may be skewed.
MapPrintDocument.MapPrintSize=MapPrintSize.FillPage
Current Map Size
This option prints the map in its original size. This may be fine, however if the map is larger than the
page on which it is printed, the overflow is lost.
MapPrintDocument.MapPrintSize=MapPrintSize.MapSize
MapXtreme v7.1
528
Developer Guide
MapXtreme v7.1
529
Developer Guide
MapStyleControl Class
The MapStyleControl (MapInfo.Windows.Controls namespace) can be displayed on a tab in the
desktop LayerControl to allow the user to set map style and rendering options, such as anti-aliasing
and translucency.
Dither Method
Dithering is a technique that blends pixels electronically to maintain the look of an image when
decreasing the color depth. Select a dither method when you are converting a 24-bit image to 256
colors.
Halftone dithering calculates a series of half tone differences in color between high-contrast
elements in your image to create a smooth transition of color. This option is selected by default
for display, print, and export options.
Error diffusion dithering calculates an interim color between contrasting colors and shades the
surrounding pixels to blend evenly toward that interim color.
Set this value by using the DrawingAttributes.RasterDitherMethod property. You can set
this to a value from the DitherMethod enumeration.
Example:
mapPrintDocument.DrawingAttributes.RasterDitherMethod =
MapInfo.Mapping.DitherMethod.HalfTone;
Scale Patterns
This setting either prints non-transparent bitmap fill patterns that look like what you see on your
screen or allows the printer driver to have exclusive control over rendering the fill patterns. Set this
value with DrawingAttributes.ScaleBitmapPatterns. If this value is true, the bitmap fill
patterns are scaled up to compensate for the difference in printer and screen resolutions. False
does not scale the pattern and relies on the printer driver for scaling the fill pattern. If the printer
driver can scale fill patterns, you should set this value to false. If the printer driver cannot scale fill
MapXtreme v7.1
530
Developer Guide
If a fill pattern has a background color it is considered non-transparent, while one without a
background color is considered a transparent fill and is always scaled, regardless of the
value of this property.
531
Developer Guide
532
Developer Guide
Using this method, you have access to the graphics object and can use any of the available graphics
routines to print extra graphics or text.
MapInfo cannot, and does not, recommend one printer/plotter over another, nor verify that a
particular printer works 100 percent of the time. There are too many variables that affect the
output to be able to make a recommendation.
The following tips and suggestions come from our knowledgebase of specific common problems and
solutions our users have found while printing.
Good first steps in troubleshooting a printing problem are to make sure you have downloaded and
installed the patch for your release of MapXtreme, if any, and are using the latest printer driver for
your printer/operating system. Exceptions are noted in this document.
How to Overload a Print Page Event
Our .NET printing API provides a mechanism for overloading the print page event. This allows you to
add customizations to each printed page. For example, you could add a title, page number, logo, etc.
To do this, you need to implement a PrintPageEventHandler. Here's an example:
this.mapPrinting = new MapPrinting();
this.mapPrinting.Map = this.mapControl1.Map;
this.mapPrinting.PrintDocument.PrintPage += new
System.Drawing.Printing.PrintPageEventHandler(this.mapPrintDocument1_Prin
tPage);
private void mapPrintDocument1_PrintPage(object sender,
System.Drawing.Printing.PrintPageEventArgs e)
{
// TODO - add your code here to alter the printed page
}
533
Developer Guide
MapXtreme v7.1
534
Developer Guide
1.
Spooling is the process of storing data constituting a document to be printed in memory or in a file until the
printer is ready to process it.
MapXtreme v7.1
535
Developer Guide
1 Click Spool Print Documents and Start printing after last page is spooled button.
1. To set up local print job spooling, choose Start > Settings > Control Panel > Printers.
2. Right-click the printer and choose Properties in the menu to display the printers properties.
3. Click the Advanced tab to display the advanced property options.
If you do not have administrative rights to your computer, you may not be able to use the
spooling option. Contact your IT department if you want to make this change to get their
support.
MapXtreme v7.1
536
Developer Guide
Platform-Specific Issues
These issues pertain to particular operating systems and/or hardware except where specifically
noted. These issues are grouped by operating system.
Print output repeats itself every 2 to 4 cm using the HP 500, 800, 5000 DesignJet
plotter when printing Rasters
We have two suggestions to working around this problem. First, try spooling the printer locally either
from the driver level or the printer level.
You must have read/write rights to your printer and printer driver to resolve this issue.
To work around this problem, there is an advanced hidden setting that you can change within the
properties of the driver.
To prevent the printer from repeating itself every 2-4 cm. when printing rasters with vector overlays:
1. Locate the printer drivers properties in the Control Panel. To get to this setting, right-click the
printer icon and choose Properties.
MapXtreme v7.1
537
Developer Guide
When you modify settings in this driver option box, make sure to note the original settings in
case you need to change them back. These were designed for HP Support Engineers and
not for general public use.
You can save these settings as a Quick Set to ensure that they run every time you print raster files.
1. Navigate to the HP printer driver and access the driver preferences. Use one of these methods
based on your operating system:
Using Windows NT 4.0 From the Windows desktop, select Start > Settings > Printers.
Then, right-click the appropriate plotter driver icon and choose Document Defaults.
Using Windows 2000/XP (Classic View) From the Windows desktop, select Start >
Settings > Printers. Then, right-click the appropriate plotter driver icon and choose Printing
Preferences.
2. Set the preferences the way you want them in the hidden menu.
3. In the Quick Sets box, type a name for the selected settings (for example, "Raster Print
Settings") and click Save. All current driver settings (paper type, hidden menu settings, etc.) are
MapXtreme v7.1
538
Developer Guide
If you do not need this special setting in Quick Sets, remember to change this setting back to
the default machine setting.
If you select the Maximum Performance option, you get memory error messages and the
printer prints only part of the image
If you select the Avoid out of memory option, the computer crashes and displays both an Out of
Hard Disk Space message and an Out of Virtual Memory message
The resolution of this issue is similar to the preceding issue. The Special Options dialog box is the
same.
1. Programmatically set the following printing options:
MapPrintDocument mapPrintDocument = this.mapPrinting.PrintDocument as
MapPrintDocument;
mapPrintDocument.PrintMethod = PrintMethod.Direct;
mapPrintDocument.DrawingAttributes.SpecialTransparentVectorHandling =
true;
mapPrintDocument.DrawingAttributes.SpecialTransparentRasterHandling =
false;
mapPrintDocument.DrawingAttributes.TrueColorRaster = true;.
2. From the Control Panel, select Printers or Printers and Faxes and find the printer you want to
print to.
3. Right-click on the printer and select the Properties option. The Properties dialog box displays.
4. Click the About button to display the About <Printer Driver> dialog box.
5. Holding down the F8 key on your keyboard, click the OK button. The Special Options dialog box
displays.
6. Clear the Enable SpoolSmart check box.
MapXtreme v7.1
539
Developer Guide
Style Lookups
This appendix contains lookup tables for supported styles, including fill patterns,
line styles, vector symbols and custom bitmap symbols. For more information
on style descriptions and how to use them, see Chapter 15: Stylizing Your
Maps.
In this appendix:
Fill Patterns
The following table summarizes the MapXtreme fill patterns (also referred to as interior styles within
the MapXtreme programming API). Each fill pattern has an associated Index Number, which is used
for programmatic access into an InteriorStyleRepository object, and a Pattern Number, which is an
internal descriptive name of the fill pattern.
More specifically:
Fill Pattern
The graphical fill pattern itself.
Index Number
The 0-based index used to retrieve the interior style that represents the fill pattern from the
InteriorStyleRepository.
Pattern Number
The numeric identifier for the fill pattern, which may be used to construct an interior style object. This
is an internal number only and can not be used to access the InteriorStyleRepository
programmatically. However, these pattern numbers are used to indicate fill patterns within
MapXtreme workspace files (.mws).
MapXtreme v7.1
541
Developer Guide
You will notice that the first eight fill patterns have the same Index Number and Pattern
Number. Subsequently, the Pattern Number is always three greater than the corresponding
Index Number (and hence the Pattern Numbering sequence goes up to 175 while the Index
Numbering stops at 172). This is not an error. There are still 172 unique fill patterns. Nothing
is missing from the table.
Index Number
Pattern Number
12
(None)
MapXtreme v7.1
542
Developer Guide
MapXtreme v7.1
Index Number
Pattern Number
10
13
11
14
12
15
13
16
14
17
15
19
16
18
17
20
18
21
19
22
20
23
21
24
22
25
543
Developer Guide
MapXtreme v7.1
Index Number
Pattern Number
23
26
24
27
25
28
26
29
27
30
28
31
29
32
30
33
31
34
32
35
33
36
34
37
35
38
36
39
544
Developer Guide
MapXtreme v7.1
Index Number
Pattern Number
37
40
38
41
39
42
40
43
41
44
42
45
43
46
44
47
45
48
46
49
47
50
48
51
49
52
50
53
545
Developer Guide
MapXtreme v7.1
Index Number
Pattern Number
51
54
52
55
53
56
54
57
55
58
56
59
57
60
58
61
59
62
60
63
61
64
62
65
63
66
546
Developer Guide
MapXtreme v7.1
Index Number
Pattern Number
64
67
65
68
66
69
67
70
68
71
69
72
70
73
71
74
72
75
73
76
74
77
75
78
76
79
77
80
547
Developer Guide
MapXtreme v7.1
Index Number
Pattern Number
78
81
79
82
80
83
81
84
82
85
83
86
84
87
85
88
86
89
87
90
88
91
89
92
90
93
91
94
548
Developer Guide
MapXtreme v7.1
Index Number
Pattern Number
92
95
93
96
94
97
95
98
96
99
97
100
98
101
99
102
100
103
101
104
102
105
103
106
104
107
549
Developer Guide
MapXtreme v7.1
Index Number
Pattern Number
105
108
106
109
107
110
108
111
109
112
110
113
111
114
112
115
113
116
114
117
115
118
116
119
117
120
550
Developer Guide
MapXtreme v7.1
Index Number
Pattern Number
118
121
119
122
120
123
121
124
122
125
123
126
124
127
125
128
126
129
127
130
128
131
129
132
130
133
551
Developer Guide
MapXtreme v7.1
Index Number
Pattern Number
131
134
132
135
133
136
134
137
135
138
136
139
137
140
138
141
139
142
140
143
141
144
142
145
143
146
552
Developer Guide
MapXtreme v7.1
Index Number
Pattern Number
144
147
145
148
146
149
147
150
148
151
149
152
150
153
151
154
152
155
153
156
154
157
155
158
156
159
553
Developer Guide
MapXtreme v7.1
Index Number
Pattern Number
157
160
158
161
159
162
160
163
161
164
162
165
163
166
164
167
165
168
166
169
167
170
168
171
169
172
554
Developer Guide
Index Number
Pattern Number
170
173
171
174
172
175
Line Styles
MapXtreme v7.1
555
Developer Guide
Vector Symbols
MapXtreme automatically installs 10 MapInfo-specific TrueType fonts during its installation process.
These fonts offer the user glyph symbol choices that range from Weather, Real Estate, and
Transportation, and others. The glyph numbers are Unicode character values, which, since they fall
within the first Unicode character code block range, are also assignment-wise compatible with the
ASCII character set.
MapInfo Arrows
MapInfo Cartographic
MapXtreme v7.1
556
Developer Guide
MapInfo Miscellaneous
MapInfo Shields
MapXtreme v7.1
557
Developer Guide
Map Symbols
MapInfo Symbols
MapInfo 3.0 Compatible symbols
MapXtreme v7.1
558
Developer Guide
MapInfo Transportation
MapInfo Weather
MapXtreme v7.1
559
Developer Guide
Custom Symbols
The following symbols are located in C:\Program Files\Common
Files\MapInfo\MapXtreme\7.x.x\CustSymb. The file extension for each image is .BMP.
These symbols can be accessed programmatically via the BitmapPointStyleRepository collection
class in the MapInfo.Styles namespace.
You can create your own bitmap images and add them to the CustSymb directory. There are virtually
no size limitations on an image that you create; however, the ability of MapXtremeto display it will
depend on available memory. The image does not have to be square and can also have up to 24-bit
color depth. To ensure that your image is displayed using its natural width and height, you must set
the Boolean "NativeSize" property to true within the image's respective BitmapPointStyle object.
AMBU1-32
AMBU-64
BADG1-32
BADG2-32
BANK1-32
BANK2-32
BANK-64
BOOK1-32
BUILDINGS
CAMP1-32
CAR1-32
CAUT1-32
CHUR1-32
COMP1-32
FARM1-32
FAST1-32
FIRE1-32
FIRE-64
FOOD-64
GLOB1-32
GOLF1-32
HOSP1-32
HOUS1-32
HOUS232
HOUS3-32
HOUS-64
HYDR1-32
INTE1-32
LITE1-32
LITE2-32
MapXtreme v7.1
560
Developer Guide
MBOX1-32
MBOX2-32
MOSQ1-32
ONEW1-32
ONEW232
PENC1-32
PIN1-32
PIN2-32
PIN3-32
PIN4-32
PIN5-32
(CYAN)
(RED)
(YELLOW)
(GREEN)
(BLUE)
PIN6-32
PINB-64
PING-64
PINGY-64
PINR-64
POLI1-32
(PURPLE)
(BLUE)
(GREEN)
(GRAY)
(RED)
RAIL1-32
RAIL2-32
RAIL3-32
RAIL-64
RED-CAR
REST1-32
STAT1-32
STOP1-32
SYNA1-32
TARG1-32
TAXI1-32
TEMP1-32
TOWE1-32
TOWE2-32
TRAF1-32
TRUC1-32
TRUC2-32
TRUC-64
YIEL1-32
YIEL2-32
MapXtreme v7.1
561
Developer Guide
MapXtreme Icons
This table of thumbnails represent a collection of toolbar icons available for your use in your
MapXtreme-based application. They are Installed into the \Samples\Icons folder under the
MapXtreme installation folder. There are two forms of each .PNG: small (16x16 pixels) and large
(24x24 pixels).
ADD_NODE
ADORNMENT
ARC
ARROW
ASSIGN_TARG CLIP_MODE
ET
CLIP_REGION
CLOSE_ALL
COPY
CREATE_DRIV
E_REG
CROSSHAIR
DRAG_HANDL
E
ELLIPSE
GRAPH_SELE
CT
HELP
HOT_LINK
INFO
INVERTSELEC
T
LABEL
LAYERS
LEGEND
LINE
LINE_STYLE
MB_12
MB_6
MB_7
MB_8
NEW_BROWS
ER
NEW_DOC
NEW_GRAPHE NEW_LAYOUT
R
MapXtreme v7.1
562
CUT
NEW_MAPPER
Developer Guide
ODBC_MAPPA
BLE
ODBC_OPEN
ODBC_REFRE
SH
ODBC_SYMBO
L
ODBC_UNLINK OPENWFS
OPENWMS
OPEN_FILE
OPEN_WOR
PASTE
POLYGON
POLYGON_ST
YLE
POLYLINE
PRINT_PDF
RECT
RESHAPE
ROUND_RECT
RULER
RUN
SAVE_FILE
SAVE_WIN
SAVE_WOR
SCALEBAR
SEARCH_BDY
SEARCH_POL
YGON
SEARCH_RADI SEARCH_REC
US
T
SYMBOL
SYMBOL_STY
LE
TEXT
NEW_REDIST
RICTER
ODBC_DISCO
NNECT
SET_TARGET_ STATISTICS
MAP
MapXtreme v7.1
563
TEXT_STYLE
Developer Guide
UNDO
UNSELECT_AL WEB_SERVIC
L
E_PREF
ZOOM_OUT
ZOOM_QUEST
ION
MapXtreme v7.1
564
WINDOW_FRA
ME
WRENCH
ZOOM_IN
Developer Guide
The MapInfo Codespace is a list of definitions and standards that are commonly
used in creating MapInfo maps and workspaces. You can refer to these
definitions to assist you in using MapXtreme. You may want to compare our
codespace definitions with another commonly used codespace, the European
Petroleum Survey Group (EPSG), which is available on their website:
www.epsg.org/.
In this appendix:
Position 1
Position
2
Position
3
Position
4
CoordSys file*
[1-255]
brush
[1-8, 12-175]
length
pt= 1/72 in
Unit of length.
Supports inch | foot | yard | mile |
and
millimeter | centimeter | meter |
kilometer |
and
survey foot | nautical mile |
and
link | chain | rod | point | twip | pica |
degree.
pica = 12 pt
Examples:
twip = 1/20 pt
mapinfo:length m
1 deg = (pi/180) *
6370997 meter =
69.09329 mi
(based on great
circle)
mapinfo:length pt
in | ft | yd | mi
mm | cm | m | km
|
sft | nmi | li | ch |
rd | pt | twip | pica
| deg
MapXtreme v7.1
mapinfo:length deg
566
Developer Guide
Position 1
Position
2
Position
3
Position
4
pixel
type
A data type.
boolean
byte
date
datetime
time
decimal
[|(n
n)|]
n.m
n is the
total digits
and
m is the
number of
digits
reserved
for the
right of
decimal
point,
m<=n
optional min
optional max
optional precision
Examples:
mapinfo:type decimal (100 -- all d>100
mapinfo:type decimal 100) -- all d<100
mapinfo:type decimal [200 300] -- all
200<=d<=300
mapinfo:type decimal 10.7 -- all
decimals with no more than 10 digits
with 7 digits reserved for right of
decimal point, thus max of 3 digits to
left of decimal point.
mapinfo:type decimal [200 300] 10.7 -combination of previous two examples.
double
[|(n
n)|]
float
[|(n
n)|]
int
[|(n
n)|]
short
[|(n
n)|]
string
char
MapXtreme v7.1
Developer Guide
Position 1
Position
2
Position
3
operators
Position
4
eq | neq | lt | gt |
lteq | gteq
in | not_in
Example: mapinfo:op eq
like | not_like
intersects
MapXtreme v7.1
568
Developer Guide
Position 1
Position
2
Position
3
mbr_intersects
Position
4
contains
contains_centroi
d
and
Boolean and.
Example: mapinfo:op and
or
Boolean or.
Example: mapinfo:op or
MapXtreme v7.1
569
Developer Guide
Position 1
Position
2
Position
3
area
Position
4
sq
in | ft | yd
| mi | mm
| cm | m |
km | sft |
nmi | li |
ch | rd | pt
| twip |
pica |
degree
Example: mapinfo:area sq mi
acre | a | ha |
perch | rood
Example: mapinfo:time hr
angle
deg | rad
temp
K|F|C
MapXtreme v7.1
570
Developer Guide
Elements of a Coordinate
System
In this appendix:
Standard Parallel 2
Azimuthal Equidistant
Cassini-Soldner
Double Stereographic
Eckert IV
Eckert VI
Equidistant Conic
Gall
Longitude-Latitude
Mercator
Miller
Mollweide
Polyconic
Regional Mercator
MapXtreme v7.1
572
Range
Standard Parallel 1
False Northing
Origin, Latitude
False Easting
Origin, Longitude
Scale Factor
Units
Azimuth
Datum
The following table indicates the parameters applicable to each projection, which are listed in the
order they appear in the relevant coordinate system lines in the MapInfoCoordinateSystemSet.xml.
The document is located in C:\Program Files\Common Files\MapInfo\MapXtreme\7.x.x.
X
X
X
X
X
X
Developer Guide
Stereographic
Transverse Mercator
Range
False Northing
False Easting
Sinusoidal
Scale Factor
Azimuth
Standard Parallel 2
Origin, Longitude
Standard Parallel 1
Units
Robinson
Origin, Latitude
Datum
Projection
The projection is the equation or equations used by a coordinate system. The following list names
the projections MapInfo uses and gives the number used to identify the projection in the
MapInfoCoordinateSystemSet.xml file:
Number
Projection
28
30
Cassini-Soldner
Cylindrical Equal-Area
31
Double Stereographic
14
Eckert IV
15
Eckert VI
17
Gall
29
MapXtreme v7.1
573
Developer Guide
Projection
19
Longitude/Latitude
10
Mercator
11
Miller Cylindrical
13
Mollweide
18
27
Polyconic
26
Regional Mercator
12
Robinson
16
Sinusoidal
20
Stereographic
25
21
22
23
24
MapXtreme v7.1
574
Developer Guide
Meaning
Parameters
1000
2000
3000
Example:
Assume you want to work with a simple system based on the Transverse Mercator projection and
using the NAD 1983 datum. You might have a line such as the following in your
MapInfoCoordinateSystemSet.xml file:
<ProjectedCRS>
<srsName>UTM Zone 1 (NAD 83)</srsName>
<srsID>
<code>coordsys 8,33,7,-177,0,0.9996,500000,0</code>
<codeSpace>mapinfo</codeSpace>
<remarks>Universal Transverse Mercator </remarks>
</srsID>
<baseCRS/>
<definedByConversion/>
<usesCartesianCS/>
</ProjectedCRS>
Now lets say that you want a system based on this, but with an affine transformation specified by
the following parameters:
Units=meters; A=0.5; B=-0.866; C=0; D=0.866; E=0.5; and F=0.
The required line in the MapInfoCoordinateSystemSet.xml file is:
<ProjectedCRS>
<srsName>UTM Zone 1 (NAD 83)- rotated 60 degrees</srsName>
<srsID>
<code>coordsys 8,33,7,-177,0,0.9996,500000,0, 7, 0.5, 0.866, 0, 0.866, 0.5, 0 </code>
<codeSpace>mapinfo</codeSpace>
<remarks>Universal Transverse Mercator</remarks>
</srsID>
<baseCRS/>
<definedByConversion/>
<usesCartesianCS/>
</ProjectedCRS>
MapXtreme v7.1
575
Developer Guide
Projection Datums
The datum is established by tying a reference ellipsoid to a particular point on the earth. The
following table lists these details for each datum:
Datum
Area Maps
Ellipsoid
Adindan
Clarke 1880
Afgooye
Somalia
Krassovsky
MapXtreme v7.1
576
Developer Guide
Datum
Area Maps
Ellipsoid
1007
Australia, A.C.T.
Australian National
1008
Australia, Tasmania
Australian National
1009
Australia, Victoria/NSW
Australian National
1006
Australia
Australian National
Bahrain Island
International
118
American Samoa
Clarke 1866
Cocos Islands
Australian National
119
Clarke 1880
Arc 1950
Clarke 1880
Arc 1960
Kenya, Tanzania
Clarke 1880
Ascension Island
International
Tern Island
International
Astro Beacon E
International
10
International
11
Marcus Island
International
151
Canada
ATS77
12
Australian National
13
Australian National
1006
Australia-National-AGD84 7
param
Australia
Australian National
1007
Australia
Australian National
1008
Tasmania
Australian National
MapXtreme v7.1
577
Developer Guide
Datum
1009
Australia (Victoria/NSW
AGD66 7-param)
151
120
Area Maps
Ellipsoid
Victoria, NSW
Australian National
Ayabelle Lighthouse
Djibouti
Clarke 1880
110
Belgium
Belgium
International
14
Bellevue (IGN)
International
15
Bermuda 1957
Bermuda Islands
Clarke 1866
16
Bogota Observatory
Colombia
International
121
Bukit Rimpah
Bessel 1841
17
Campo Inchauspe
Argentina
International
18
Phoenix Islands
International
19
Cape
South Africa
Clarke 1880
20
Cape Canaveral
Clarke 1866
1005
Cape, 7 parameter
South Africa
WGS 84
21
Carthage
Tunisia
Clarke 1880
22
Chatham 1971
International
23
Chua Astro
Paraguay
International
122
Estonia
Bessel 1841
24
Corrego Alegre
Brazil
International
123
Dabola
Guinea
Clarke 1880
124
Deception Island
Clarke 1880
1000
Deutsches Hauptdreicksnetz
(DHDN)
Germany
Bessel
25
Djakarta (Batavia)
Bessel 1841
MapXtreme v7.1
578
Developer Guide
Datum
Area Maps
Ellipsoid
26
DOS 1968
International
27
Easter Island
International
115
EUREF 89
Europe
GRS 80
28
International
29
International
108
Europe
International
125
Clarke 1880
30
Gandajika Base
Republic of Maldives
International
116
GDA 94
Australia
GRS 80
32
Worldwide
GRS 67
33
Worldwide
GRS 80
126
International 1924
34
Guam 1963
Guam Island
Clarke 1866
35
GUX 1 Astro
Guadalcanal Island
International
150
Hartbeesthoek 94
South Africa
WGS 84
127
Herat North
Afghanistan
International 1924
128
Hermannskogel
Bessel 1841
MapXtreme v7.1
579
Developer Guide
Datum
Area Maps
Ellipsoid
36
International
37
Hjorsey 1955
Iceland
International
38
Hong Kong
International
1004
Hungary
GRS 67
39
Hu-Tzu-Shan
Taiwan
International
40
Indian
Everest (India
1830)
41
Indian
Everest (India
1830)
129
Indian
Pakistan
Everest (Pakistan)
130
Indian 1954
Thailand
Everest (India
1830)
131
Indian 1960
Vietnam
Everest (India
1830)
132
Indian 1975
Thailand
Everest (India
1830)
133
Indonesian 1974
Indonesia
Indonesian 1974
42
Ireland 1965
Ireland
Modified Airy
134
International 1924
43
Diego Garcia
International
152
Japan
GRS80
44
Johnston Island
International
45
Kandawala
Sri Lanka
Everest (India
1830)
46
Kerguelen Island
Kerguelen Island
International
47
Kertau 1948
Everest (W.
Malaysia and
Singapore 1948)
MapXtreme v7.1
580
Developer Guide
Datum
Area Maps
Ellipsoid
135
International 1924
48
L.C. 5 Astro
Clarke 1866
136
Leigon
Ghana
Clarke 1880
49
Liberia 1964
Liberia
Clarke 1880
113
Lisboa (DLx)
Portugal
International
50
Luzon
Philippines (excluding
Mindanao Island)
Clarke 1866
51
Luzon
Mindanao Island
Clarke 1866
52
Mahe 1971
Mahe Island
Clarke 1880
53
Marco Astro
Salvage Islands
International
54
Massawa
Eritrea (Ethiopia)
Bessel 1841
114
Portugal
International
55
Merchich
Morocco
Clarke 1880
56
Midway Island
International
57
Minna
Nigeria
Clarke 1880
137
Clarke 1880
138
MPoraloko
Gabon
Clarke 1880
58
Nahrwan
Clarke 1880
59
Nahrwan
Clarke 1880
60
Nahrwan
Saudi Arabia
Clarke 1880
61
Naparima, BWI
International
109
Netherlands
Netherlands
Bessel
117
New Zealand
GRS 80
31
New Zealand
International
MapXtreme v7.1
581
Developer Guide
Datum
Area Maps
Ellipsoid
1010
New Zealand
International
62
Continental US
Clarke 1866
63
Alaska
Clarke 1866
64
Clarke 1866
65
Clarke 1866
66
Canada (including
Newfoundland Island)
Clarke 1866
67
Canal Zone
Clarke 1866
68
Clarke 1866
69
Clarke 1866
70
Cuba
Clarke 1866
71
Clarke 1866
72
Mexico
Clarke 1866
73
Modified Clarke
1866
74
GRS 80
139
Algeria
Clarke 1880
MapXtreme v7.1
582
Developer Guide
Datum
Area Maps
Ellipsoid
107
Nouvelle Triangulation
Francaise (NTF) Greenwich
Prime Meridian
France
Modified Clarke
1880
1002
Nouvelle Triangulation
Francaise (NTF) Paris Prime
Meridian
France
Modified Clarke
1880
111
NWGL 10
Worldwide
WGS 72
75
Observatorio 1966
International
140
Observatorio Meteorologico
1939
International 1924
76
Old Egyptian
Egypt
Helmert 1906
77
Old Hawaiian
Hawaii
Clarke 1866
97
OldTokyo
Bessel 1841
78
Oman
Oman
Clarke 1880
79
Airy
80
Canary Islands
International
81
Pitcairn Island
International
141
Point 58
Clarke 1880
142
Congo
Clarke 1880
157
Popular Visualization
Worldwide
Popular
Visualization
143
International 1924
1000
Potsdam
Germany
Bessel
82
International
36
International
MapXtreme v7.1
583
Developer Guide
Datum
Area Maps
Ellipsoid
83
Puerto Rico
Clarke 1866
1001
Pulkovo 1942
Germany
Krassovsky
1012
PZ90
Russia
PZ90
84
Qatar National
Qatar
International
85
Qornoq
South Greenland
International
1000
Rauenberg
Germany
Bessel
86
Reunion
Mascarene Island
International
112
Sweden
Bessel
1011
Sweden
Bessel
87
Rome 1940
Sardinia Island
International
88
Santo (DOS)
International
89
So Braz
International
90
International
91
Schwarzeck
Namibia
Modified Bessel
1841
144
Salvage Islands
International 1924
145
Sierra Leone
Clarke 1880
146
S-JTSK
Czech Republic
Bessel 1841
1013
SK42
Russia
PZ90
1024
SK95
Russia
PZ90
92
South American
1969
93
South Asia
Singapore
Modified Fischer
1960
MapXtreme v7.1
584
Developer Guide
Datum
Area Maps
Ellipsoid
94
Southeast Base
International
95
Southwest Base
International
1003
Switzerland
Bessel
147
International 1924
96
Timbalai 1948
Everest (India
1830)
1015
Tokyo
Japan
Bessel 1841
98
Tristan da Cunha
International
99
Clarke 1880
148
Voirol 1874
Tunisia/Algeria
Clarke 1880
149
Voirol 1960
Algeria
Clarke 1880
100
Wake-Eniwetok 1960
Marshall Islands
Hough
101
Worldwide
WGS 60
102
Worldwide
WGS 66
103
Worldwide
WGS 72
104
Worldwide
WGS 84
105
Yacare
Uruguay
International
106
Zanderij
Surinam
International
Units
The following table lists the available coordinate units and the number used to identify the unit in the
MapInfoCoordinateSystemSet.xml file:
MapXtreme v7.1
585
Developer Guide
Number
Units
Centimeters
31
Chains
Inches
Kilometers
30
Links
Meters
Miles
Millimeters
Nautical Miles
32
Rods
Yards
One US Survey Foot equals exactly 12/39.37 meters, or approximately 30.48006 cm.
MapXtreme v7.1
586
Developer Guide
Polyconic Projection
The following description is copied from Map Projections A Working Manual, USGS Professional
Paper 1395, by John P. Snyder.
The Polyconic projection, usually called the American Polyconic in Europe, achieved its name
because the curvature of the circular arc for each parallel on the map is the same as it would be
following the unrolling of a cone which had been wrapped around the globe tangent to the particular
parallel of latitude, with the parallel traced onto the cone. Thus, there are many (poly-) cones
involved, rather than the single cone of each regular conic projection.
MapXtreme v7.1
587
Developer Guide
Datum Conversion
When converting coordinates from one datum to another, MapInfo has used the Molodensky (3parameter) and Bursa-Wolf (7-parameter) methods. These are general-purpose methods that can
convert coordinates from any datum to any other datum.
After the NAD 83 datum was introduced, NOAA developed a program called NADCON, which
stands for North American Datum CONversion. This is a very specialized program that converts
coordinates only from NAD 27 to NAD 83 and vice versa. For this specialized task, its much more
accurate than the Molodensky general-purpose method; NADCON is accurate to about 0.1 meter,
and Molodensky is accurate to only 1030 meters. Most U.S. government agencies, including the
Census Bureau, have standardized on NADCON for converting between NAD 27 and NAD 83.
Beginning with MapInfo 4.1.2, the NADCON algorithm is used to convert coordinates between NAD
27 and NAD 83 if those coordinates lie within the areas covered by NADCON (United States, Puerto
Rico, and the Virgin Islands). If the coordinates lie outside those areas, or if they use datums other
than NAD 27 or NAD 83, MapInfo uses the Molodensky or Bursa-Wolfe conversion methods.
Due to the file access required, the NADCON conversion method can be slightly slower than the
Molodensky method. If you want to turn off the NADCON conversion, remove the *.las and *.los files
from the MapXtreme program or the MapXtreme Common directory.
Custom Datums
A datum is a mathematical description of the earths shape and orientation. Because the earths
shape is not uniform, there are many different local datums used in different parts of the world.
These local datums provide a close approximation to the earths surface in a particular area.
Each Earth coordinate system uses a specific datum to approximate the earths surface. If two
coordinate systems use different datums, then Pitney Bowes Softwares mapping products must
perform a datum transformation when it converts coordinates from one coordinate system to the
other. Pitney Bowes Software uses the Bursa-Wolfe datum transformation method, which is
generally accurate to within 10 meters. (When the conversion is between two coordinate systems
that use the same datum, no datum transformation is performed, and the results are generally
accurate to within 0.1 meter.)
MapXtreme v7.1
588
Developer Guide
An ellipsoid, also called a spheroid. This is an ellipse rotated around its minor axis to form a
three-dimensional surface. The ellipsoid is described by two mathematical parameters: the
length, in meters, of its semi-major axis (denoted by the letter a) and its degree of flattening
(denoted by the letter f). MapInfo supports over 40 predefined ellipsoids, which are listed in the
next table.
Three shift parameters specifying the distance, in meters, to shift the ellipsoid along each of its
axes. These parameters are usually denoted by dX, dY, and dZ. You may also see them denoted
by DX, DY, and DZ, or by u, v, and w.
Three rotation parameters specifying the angle, in arc-seconds, to rotate the ellipsoid around
each of its axes. These parameters are usually denoted by EX, EY, and EZ. You may also see
them denoted by eX, eY, and eZ, or by e, y, and w.
A scale correction factor specifying the amount, in parts per million, to adjust the size of the
ellipsoid. This parameter is denoted by the letter m, or sometimes k.
The longitude of the prime meridian, in degrees east of Greenwich. The prime meridian specifies
which location on earth is assigned longitude 0. Most datums use Greenwich as the prime
meridian, so this parameter is usually zero. However, some datums use a different location as
the prime meridian. For example, the NTF datum uses Paris as its prime meridian, which is
2.33722917 degrees east of Greenwich. If you use the NTF datum in a coordinate system, all
longitudes in that coordinate system are relative to Paris instead of Greenwich.
You can define a custom datum in any coordinate system definition. Use datum number 9999
followed by the datum parameters, in this order:
9999, EllipsoidNumber, dX, dY, dZ, EX, EY, EZ, m, PrimeMeridian
Some datums specify only an ellipsoid and shift parameters (dX, dY, dZ), with no rotation
parameters, scale correction, or prime meridian. In those cases, you can use datum number 999
instead of 9999, to simplify the definition:
999, EllipsoidNumber, dX, dY, dZ
The ellipsoid number must be chosen from the following list. Currently, there is no way to define a
custom ellipsoid. If you need to use an ellipsoid that does not appear on this list, please notify
MapInfo Technical Support so that we can add your ellipsoid to a future MapInfo release.
Number
Ellipsoid
1/f
Airy 1930
6377563.396
299.3249646
13
6377340.189
299.3249646
51
ATS7 77
6378135.0
298.257
Australian
6378160.0
298.25
MapXtreme v7.1
589
Developer Guide
Ellipsoid
1/f
10
Bessel 1841
6377397.155
299.1528128
35
6377492.0176
299.15281
14
6377483.865
299.1528128
36
Clarke 1858
6378293.639
294.26068
Clarke 1866
6378206.4
294.9786982
6378450.047484481
294.9786982
Clarke 1880
6378249.145
293.465
15
6378249.145326
293.4663076
30
6378249.2
293.4660213
37
6378249.136
293.46631
16
6378249.2
293.46598
38
6378300.79
293.46623
39
6377298.556
300.8017
11
6377276.345
300.8017
40
6377301.243
300.80174
50
Everest (Pakistan)
6377309.613
300.8017
17
300.8017
48
6377295.664
300.8017
18
Fischer 1960
6378166.0
298.3
19
6378155.0
298.3
20
Fischer 1968
6378150.0
298.3
21
GRS 67
6378160.0
298.247167427
GRS 80
6378137.0
298.257222101
Hayford
6378388.0
297.0
22
Helmert 1906
6378200.0
298.3
MapXtreme v7.1
590
Developer Guide
Ellipsoid
1/f
23
Hough
6378270.0
297.0
31
IAG 75
6378140.0
298.257222
41
Indonesian
6378160.0
298.247
International 1924
6378388.0
297.0
49
Irish (WOFO)
6377542.178
299.325
Krassovsky
6378245.0
298.3
32
MERIT 83
6378137.0
298.257
33
6378157.5
298.25
43
NWL 10D
6378135.0
298.26
42
NWL 9D
6378145.0
298.25
44
OSU86F
6378136.2
298.25722
45
OSU91A
6378136.3
298.25722
46
Plessis 1817
6376523.0
308.64
54
Popular Visualization
6378137.0
0.0
52
PZ90
6378136.0
298.257839303
24
South American
6378160.0
298.25
12
Sphere
6370997.0
0.0
47
Struve 1860
6378297.0
294.73
34
Walbeck
6376896.0
302.78
25
War Office
6378300.583
296.0
26
WGS 60
6378165.0
298.3
27
WGS 66
6378145.0
298.25
WGS 72
6378135.0
298.26
28
WGS 84
6378137.0
298.257223563
The shift and rotation parameters describe the ellipsoids orientation in space, as compared to the
WGS 84 datum. Its important to make sure that these parameters have the correct signs (positive or
negative). Usually, a document describing a local datum will list the parameters required to convert
MapXtreme v7.1
591
Developer Guide
6378245.0 m
1 / 298.3
+24 m
123 m
94 m
+0.13
+0.25
-0.02
+1.1 10-6
This datum uses the Krassovsky ellipsoid, which is number 3 in the ellipsoid table above. We do not
need to reverse the signs of the parameters, since they describe a conversion from the local datum
to WGS 84. However, the rotation parameters are listed with w first, so we must reverse their order
in the custom datum definition:
9999, 3, 24, -123, -94, -0.02, 0.25, 0.13, 1.1, 0
Heres a final example, LD-3, that provides only the ellipsoid and shift parameters:
LD-3 ellipsoid: Clarke 1880
MapXtreme v7.1
592
Developer Guide
6378249.145 m
1 / 293.465
-7 m
dY
36 m
dZ
225 m
This datum uses the Clarke 1880 ellipsoid, which is number 6 in the ellipsoid table above. We do not
need to reverse the signs of the parameters or worry about the order of the rotation parameters
(since they arent present). In this case, you can use datum number 999 instead of 9999 in the
custom datum definition. These two definitions are equivalent, and you can use either one:
999, 6, -7, 36, 225
9999, 6, -7, 36, 225, 0, 0, 0, 0, 0
As with the other custom datum definitions, you would insert one of these definitions in place of the
datum number in a MapInfoCoordinateSystemSet.xml line, as follows:
"Longitude / Latitude (LD-3)", 1, 999, 6, -7, 36, 225
<srsName>UTM Zone 30 (LD-3)</srsName>
- <srsID>
<code>coordsys 8, 999, 6, -7, 36, 225, 7, -3, 0, 0.9996, 500000, 0
</code>
<codeSpace>mapinfo</codeSpace>
<remarks>Universal Transverse Mercator (LD-3)</remarks>
</srsID>
Canada
Australia
MapXtreme v7.1
593
Developer Guide
New Zealand
Germany
These files are located in the MapXtreme Common Files folder. The default location of this file is:
C:\Program Files\Common Files\MapInfo\MapXtreme\7.0.0
In addition to the algorithm and grid shift files, an XML configuration file, NTv2.xml, has been
installed to enable you to extend the NTv2 algorithm to support additional datum transformations.
You can add new grid shift files to the configuration file, or you can turn the NTv2 algorithm on or off
for particular grid shift files. The NTv2.xml file is located in the MapXtreme Common Files folder.
The NTv2 algorithm and grid shift files for Canada are protected under the following copyright:
1995 Her Majesty the Queen in Right of Canada, represented by the Minister of Natural
Resources.
The next sections describe the supported transformations for each country and how to use the
configuration file.
Canada
The following grid shift files are included for Canada:
NTV2_0.GSBused for converting NAD 1927 to NAD 1983
MAY76V20.GSBused for converting NAD 1927 (Definition 1976) to NAD 1983 for Ontario
These files convert between the NAD 1927 or NAD 1927 (Definition 1976) datums and the NAD
1983 datum. The NAD 1927 datum (Definition 1976) coordinate system is a readjustment of NAD
1927 for Ontario.
Detailed information about the algorithm, software, and grid shift files can be downloaded from the
Geodetic Survey Division of Geomatics Canada web site:
www.geod.nrcan.gc.ca/index_e.php
Australia
The following grid shift files are included for Australia:
A66_National.gsbused for converting AGD 1966 to GDA94.
National_84.gsbused for converting AGD 1984 to GDA94
The Australian grid shift files convert between either the AGD 1966 or AGD 1984 datums and the
GDA 1994 datum.
Detailed information about conversion and grid shift files can be downloaded from the
Intergovernmental Committee on Surveying and Mapping (ICSM) web site:
www.icsm.gov.au/icsm/gda/gdatm/
New Zealand
The following grid shift file is included for New Zealand:
nzgd2kgrid0005.gsbused for converting the NZGD49 datum to the NZGD2000 datum.
MapXtreme v7.1
594
Developer Guide
Germany
The following grid shift file is included for Germany:
BETA2007.gsbused for conversion from DHDN datum to ETRS89
For more information and to download the official grid shift file, see the Information and Service
System for European Coordinate Reference Systems (CRS EU) web site:
www.crs-geo.eu/
Configuration File
The NTv2 configuration file (NTv2.xml) is an XML file that you can edit to add new grid shift files for
other datum conversions and turn NTv2 on or off for particular grid shift files.
To add new grid shift files, you must specify three parameters:
You can define a datum in various ways. For example, when both the source and destination datums
are defined in MapXtreme, the datums are defined in the configuration file by the numbers assigned
to them in the MapXtremeCoordinateSystemSet.xml file. In this example for New Zealand, the XML
in the configuration file will look like this (application of bold text is for emphasis only):
- <NTv2Conversion>
<Description>NTv2 Conversion for New Zealand</Description>
<GridFile>NZGD2KGRID0005.GSB</GridFile>
<Enabled>true</Enabled>
- <SourceDatum>
<DatumID>1010</DatumID>
</SourceDatum>
- <DestinationDatum>
<DatumID>117</DatumID>
</DestinationDatum>
</NTv2Conversion>
- <NTv2Conversion>
Sometimes, however, datums are not that easily defined. You may need to supply datum shift values
(and sometimes even ranges for them) in order to define a datum. For example, the sample XML
below shows the definition of the NAD 27 datum for Canada. Here, the ellipsoid, shift values for
x,y,z, and their ranges have been used to define the datum (bold text is for emphasis only):
- <NTv2Conversion>
<Description>NAD 1927 to NAD 1983 conversion for Canada</Description>
<GridFile>NTV2_0.GSB</GridFile>
MapXtreme v7.1
595
Developer Guide
MapXtreme v7.1
596
Developer Guide
MapXtreme v7.1
597
Developer Guide
User-Defined Metadata
In this appendix
ViewsWhen defining view tables in the remote database server, the onus is upon the database
administrator to add a corresponding entry into the MapCatalog. This may be inconvenient, and
there is a risk of inaccuracy in the content.
Stored ProceduresAs a potentially dynamic generator of spatial result sets, it may not be
feasible to place a single, static entry into the MapCatalog that accurately represents all of the
result sets capable of being generated as output to invocations of the stored procedure.
Stored Procedure queries are currently supported for SQL Server only.
Tables containing multiple spatial columnsAlthough spatial databases may allow for tables to
contain more than one spatial column, the MapCatalog schema currently only permits the
metadata to be defined for a single spatial column of a table.
Complex queriesEven when the MapCatalog contains accurate information for base tables
referenced in complex queries, the inferencing logic may be unreliable for several reasons:
It may be difficult for the metadata inferencing logic to properly locate the correct metadata
(e.g., complex join queries).
The MapCatalog metadata may be inaccurate due to functions applied on the geometries
(e.g., coordinate system transformations, buffering points, convex hull aggregations, etc.)
The inferencing logic may not know how to properly reconcile metadata identified for two or
more base tables (e.g., UNION queries).
ColumnHints Property
The ColumnHints property added to TableInfoServer gives users an explicit means of providing
user-defined metadata to influence the proper identification of FeatureGeometry and Style columns
in a query result set. These "hints" are principally intended for providing complete metadata in cases
where MapCatalog metadata could not be located; however, these hints may also be used as
potentially sparse definitions to selectively override components of the MapCatalog metadata. In
either case, user-defined metadata is considered definitive, so users are cautioned to use column
hints only when necessary, and when the details of the query results are well understood.
MapXtreme v7.1
599
Developer Guide
Coordinate System
FeatureGeometry Type
Default View
Default Style
Taking all of these properties into account, a more complete example of a FeatureGeometry hint
might look something like this:
[C#]
CoordSysFactory cfs = new CoordSysFactory();
CoordSys cs = cfs.CreateFromMapBasicString("Earth Projection 1, 0");
GeometryColumn geo = new GeometryColumn("geo", cs);
geo.PredominantGeometryType = GeometryType.Polygon;
geo.DefaultView = new DRect(-74, 40, -70, 44);
geo.DefaultStyle = new MapInfo.Styles.AreaStyle(
new MapInfo.Styles.SimpleLineStyle(new LineWidth(2.0,
MapInfo.Styles.LineWidthUnit.Pixel)),
new MapInfo.Styles.SimpleInterior(10));
hints.Add(geo);
MapXtreme v7.1
600
Developer Guide
601
Developer Guide
MapXtreme v7.1
602
Developer Guide
Migrating to MapXtreme
This appendix is for existing users of MapX to become familiar with the .NETbased object model in MapXtreme and how it differs from the architecture of
MapX.
In this appendix:
MapXtreme v7.1
604
Developer Guide
MapX 5.0
AffineTransform
MapXtreme
AffineTransform
It is non-mutable (no set). Use CoordSysFactory.CreateAffineTransform to
create one.
AllFeaturesConstraint
Annotation
Annotations
Obsolete.
BindLayer
BitmapSymbol
BitmapPointStyle
BitmapSymbols
BoundsConstraint
CoordSys
CoordSys.
It is non-mutable (no set). Use CoordSysFactory to create one.
Dataset
Obsolete.
Replacements:
Datum
Datum
It is non-mutable (no set). Use CoordSysFactory.CreateDatum() to create one.
Feature
MapXtreme v7.1
605
Developer Guide
MapXtreme
See Feature.
FeaturesConstraint
FeatureFactory
Field
Fields
Find
Find
FindFeature
FindResult
FindMatch
FindCloseMatch, FindAddressRange
FindMatches
FindCloseMatchEnumerator, FindAddressRangeEnumerator
FindResult
FindResult
Geoset
Geosets
Graphic
Obsolete.
IndividualValueCategory
IndividualValueThemeBin
IndividualValueCategories
ModifierThemeBins
Label
LabelLayer, LabelSource
Labels
LabelLayer, LabelSource
LabelProperties
LabelProperties
MapXtreme v7.1
606
Developer Guide
MapXtreme
UserDrawLayer, LabelLayer, FeatureLayer, ObjectThemeLayer, GroupLayer...
MapXtreme v7.1
607
Developer Guide
MapXtreme
Layers
Layers
LayerInfo
MapXtreme v7.1
Find: Find
GetDrillDownFeaturesByID: Not addressed
GetFeatureByID: Equivalent functionality is a key cursor using
MICommand.
Invalidate: IMapLayer.Invalidate
KeyField: Obsolete. Equivalent functionality is MICommand.
LabelAtPoint
LabelProperties: LabelSource.DefaultLabelProperties.
Labels
Name: FeatureLayer.Name or Alias.
NoFeatures
OverrideStyle: Equivalent is the FeatureLayer.Modifiers collection.
Pack: Equivalent is FeatureLayer.Table.Pack
PredominantFeatureType:MISpatialColumnInfo.PredominantObjectType.
You can get the column from the Table.TableInfo.ColumnInfos property.
Refresh: Flushes the cache. Equivalent: Table.Refresh()
Search: Equivalent is MICommand. the result, however, can contain more
than just feature keys.
SearchAtPoint: No easy equivalent.
SearchWithinDistance: No easy equivalent.
SearchWithinRectangle: No easy equivalent.
SearchWithinFeature: No easy equivalent.
Selectable: FeatureLayer.Selectable.
Selection: Selection class in Session.Sessions collection.
ShowCentroids: FeatureLayer.ShowCentroids
ShowLineDirection: FeatureLayer.ShowLineDirection
ShowNodes: FeatureLayer.ShowNodes
Style: Equivalent is now the FeatureLayer.Modifiers collection.
SupportsPack: Table.SupportsPack
Type: IMapLayer.Type
UpdateFeature: Equivalent through MICommand
Visible: IMapLayer.Enabled. IMapLayer.Visible takes into account:
ZoomLayer: IMapLayer.ZoomRangeEnabled
ZoomMax: IMapLayer.ZoomRange.End
ZoomMin: IMapLayer.ZoomRange.Start
608
Developer Guide
MapXtreme
Legend
Legend
LegendText
LegendRow
LegendTexts
LegendRows
MapXtreme v7.1
609
Developer Guide
MapXtreme
Map has now been separated into two entities: Map and MapControl.
MapControl contains functionality applicable to the
System.Windows.Forms.Control; an object that can be embedded in a
WinForm.
Map contains the actual mapping functionality, regardless of how it is being
viewed (whether it is a WinForm or an export.)
The following is a list of properties/methods in the former Map class and how
they are being handled in the MapXtreme model:
Annotations: Obsolete.
CenterX/Y: Map.Center
ConvertCoord: DisplayTransform.ToDisplay(),
DisplayTransform.FromDisplay()
DefaultStyle
MapXtreme v7.1
DisplayCoordSys: Map.GetDisplayCoordSys().
Distance: CoordSys.Distance().
DynamicSelectionSupport:
MapTools.DynamicSelectionModeSelectMapTool.DynamicSelectionEnabl
ed
EditableLabels
ExportMap: MapExport class that allows exporting a map with a widerange of options.
ExportSelection: MapExport.ExportSelection
FeatureEditMode enums:
miEditModeFeature -> MapTools.NodeMode = false
miEditModeNode -> MapTools.NodeMode = true
miMoveDuplicateNodes -> MapTools.MoveDuplicateNodes
miDeleteDuplicateNodes -> MapTools.DeleteDuplicateNodes
miEditModeAddNode -> MapTools.AddNodeMode
FeatureFactory: FeatureProcessor
GeoDictionary: Geodictionary
Geoset: Obsolete.
610
Developer Guide
MapXtreme
MapXtreme v7.1
Geosets: Obsolete.
GeosetWidth
hWnd
InfotipPopupDelay
InfotipSupport: Not addressed.
IsPointVisible
Layers: Layers
MapPaperHeight/Width: PaperSize (through MapExport.ExportSize)
MapScreenHeight/Width: MapControl.Size, Map.Size
MapUnit: CoordSys.Units of the display coordsys
MatchNumericFields: GeoDictionary functionality.
MatchThreshold: GeoDictionary functionality.
MaxSearchTime: GeoDictionary functionality.
MilitaryGridReferenceToPoint: CoordSys.MilitaryGridToPoint()
MilitaryGridReferenceFromPoint: CoordSys.PointToMilitaryGrid()
Mouseicon: MapControl.Cursor
MousePointer: MapControl.Cursor
MouseWheelSupport:
MapControl.MouseWheelSupport.MouseWheelBehavior
NumericCoordSys: Obsolete. Geometries have their own CoordSys now.
Everything that has a coordinate has a coordsys.
Pan
PanAnimationLayer
PreferCompactLegends
PrintMap: Map.Draw()
PropertyPage
RedrawInterval: Map.IncrementalDraw.Interval.
Refresh
ReuseEquivalentOnRestore
Rotation: Map.Rotation.
SaveMapAsGeoset
SearchPath.
SelectionStyle: Selection.Style
SetSize
SnapToNodeSupport
SnapTolerance: MapTools.SnapTolerance
Title: Adornments
TitleText
Version
WaitCursorEnabled
Zoom
ZoomTo
611
Developer Guide
MapXtreme
MultivarCategory
MultiVariableThemeCategory
MultivarCategories
MultiVariableThemeCategories
NotesQueryInfo
Obsolete.
NotesViewInfo
Obsolete.
OCIQueryInfo
Obsolete.
ODBCQueryInfo
Obsolete.
Parts
Equivalent
Point
DPoint
Points
Obsolete
RangeCategory
RangedThemeBin
RangeCategories
ModifierThemeBins
Rectangle
DRect
ResolveObject
MatchResolver
ResolveObjects
MatchResolver Collection.
RowValue
MICommand
RowValues
MICommand
Selection
Selection
SourceRow
SourceRow
SourceRows
SourceRows collection
State
Style
Theme
ObjectTheme, FeatureStyleModifier
Themes
ThemeProperties
Title
Adornments
MapXtreme v7.1
612
Developer Guide
MapXtreme
Variable
Variable
MIParameterCollection.
MapXtreme v7.1
613
Developer Guide
Localization Kit
The Localization Kit is a Visual Studio solution for translating software text
elements (error messages, dialog/control text) into a language other than
English, Japanese, and Simplified Chinese.
In this appendix:
Localization Kit
MapXtreme provides a Visual Studio solution for developers who wish to translate error messages
and dialog/control text elements for use in their own MapXtreme-based applications.
This localization kit contains resource projects for all runtime components of MapXtreme. It is
organized as a Visual Studio solution to make it convenient to edit the resource strings and build the
assemblies while much of the behind-the-scenes resource management is taken care of. The
solution can be used in Visual Studio 2008, Visual C# 2008 Express Edition, and by the MSBuild
command line build utility.
Included in each project are the English resource strings for translating and a strong named key
(.snk) file. that will compile into an assembly that can be incorporated into your MapXtreme
application. By following the information in the table below, you can easily identify which project(s)
you need to translate for your application. You can also drill down inside each project to find only the
resource files or individual strings you need to translate.
The LocalizationKit.sln includes the following projects:
Project
Description
GeoDictionaryManager.resources
Provides the error strings and dialog text elements for the
GeoDictionaryManager.exe
MapInfo.CoreEngine.resources *
MapInfo.LinearReferencing.resources
MapInfo.Ogc.resources
MapInfo.Services.resources
MapInfo.Web.resources
MapInfo.WebControls.resources
MapInfo.Wfs.Server.resources
MapInfo.Windows.Dialogs.resources
MapInfo.Windows.resources
MapInfo.Wms.Client.resources
WorkspaceManager.resources
Provides the error strings and dialog text elements for the
WorkspaceManager.exe
MapXtreme v7.1
See the following table for resource information related to this namespace.
615
Developer Guide
Resource File
Product Area
EllisAllTypeResources.en-US.resx
EllisCommandProcessorResources.en-US.resx
EllisCoordSysExceptions.en-US.resx
EllisCoordSysResources.en-US.resx
EllisDAEngineResources.en-US.resx
EllisDBInfoResources.en-US.resx
EllisDBLayerResources.en-US.resx
EllisExceptions.en-US.resx
EllisExprPacketCreatorResources.en-US.resx
EllisExprPacketResources.en-US.resx
EllisFcnInfoServerResources.en-US.resx
EllisFindResources.en-US.resx
EllisGeoObjectProcessResources.en-US.resx
EllisGeoObjectResources.en-US.resx
EllisGeoResources.en-US.resx
EllisGeosetResources.en-US.resx
EllisGmlXlatResources.en-US.resx
EllisLegendResources.en-US.resx
EllisMapBasicInternalFcnResources.en-US.resx
EllisMapBasicTranslatorResources.en-US.resx
EllisMapperResources.en-US.resx
EllisMILexerResources.en-US.resx
MapXtreme v7.1
616
Developer Guide
Product Area
EllisMILicensingResources.en-US.resx
EllisMIRDBResources.en-US.resx
EllisMIRDBSpatialResources.en-US.resx
EllisMIWindowResources.en-US.resx
EllisProgramResources.en-US.resx
EllisRasterResources.en-US.resx
EllisTextFileReaderResources.en-US.resx
EllisThematicsResources.en-US.resx
EllisUtilityResources.en-US.resx
EllisXMLUtilResources.en-US.resx
strings.en-US.resxGeneric
System Requirement
Visual Studio 2008 or Visual Studio 2008 C# Express Edition.
MapXtreme v7.1
617
Developer Guide
Signing Assemblies
The satellite assemblies you build with the Localization Kit are signed with one of the following
strong named public keys (included in the kit):
MapInfo.CoreEngine.Public.snk
MapInfo.Ogc.Public.snk
MapInfo.WebControls.Public.snk.
MapXtreme v7.1
618
Developer Guide
For developers using Visual C# 2008 Express Edition, you will have to add MSBuild and the
directory containing the Strong Name Utility and Global Assembly Cache Utility to your
system path.
619
Developer Guide
MapXtreme v7.1
620
Developer Guide
Glossary
This glossary defines terms used in this guide and in MapInfo products that are
necessarily understandable or are used in a way specific to MapInfo products
and technology.
Appendix L: Glossary
Terms
Terms
Adornment
A MapXtreme map element that consists of either a legend, title, or scalebar.
Affine Transformation
A linear transformation, such as a rotation, scaling or shearing, of a geometric object along with a
shift from that transformation. Used in GIS for transforming maps from one coordinate system to
another.
Anti-aliasing
Smooths the jagged edges of lines, curves, and the edges of filled areas when representing a highdefinition rendition at a lower resolution.
Cartesian
A coordinate system using an x,y scale not tied to any real-world system. Most CAD drawing uses
this method of registering objects (for example, a drawing of a ball-bearing assembly or a floor plan).
If a drawing uses Cartesian coordinates, one corner of the drawing probably has coordinates 0, 0.
Cartesian Coordinates
The conventional representation of geometric objects by x and y values on a plane.
Centroid
Usually the center of a map object. For most map objects, the centroid is located at the middle of the
object (the location halfway between the northern and southern extents and halfway between the
eastern and western extents of the object). In some cases, the centroid is not at the middle point
because there is a restriction that the centroid must be located on the object itself. Thus, in the case
of a crescent-shaped region object, the middle point of the object may actually lie outside the limits
of the region; however, the centroid is always within the limits of the region.
Character Encoding
A method of converting a sequence of bytes into a sequence of characters. See also Universal
Character Set (UCS) and Unicode Transformation Format-8 (UTF-8).
Class
In an object-oriented language, a class is an object or a set of objects that contain(s) methods for
performing some type of function, similar in meaning to a derived type in procedural languages.
Codespace
See MapInfo Codespace.
Convex Hull Buffer
A type of buffer that creates a region object that represents a polygon based on the nodes from the
input object. You can think of the convex hull polygon as an operator that places a rubber band
around all of the points. It consists of the minimum number of points so that all points lie on or inside
the polygon. With convex hull buffers, no interior angle can be greater than 180 degrees.
COM+ Pooling
A Microsoft component service in which objects are pre-loaded and pooled to save resources.
MapXtreme v7.1
622
Developer Guide
Appendix L: Glossary
Terms
Coordinate
An x,y location in a Cartesian coordinate system, or a Latitude, Longitude location in an earth
coordinate system. Coordinates represent locations on a map relative to other locations. Earth
coordinate systems may use the equator and the Greenwich prime meridian as fixed reference
points. Plane coordinate systems describe a two-dimensional x,y location in terms of distance from a
fixed reference and are usually in the first quadrant so that all coordinates are positive numbers.
Coordinate System
A coordinate system is used to create a numerical representation of geometric objects. Each point in
a geometric object is represented by a pair of numbers. Those numbers are the coordinates for that
point. In cartography, coordinate systems are closely related to projections. You create a coordinate
system by supplying specific values for the parameters of a projection.
Data Provider
A bridge between an application and a data source, which provides mechanisms for accessing data
for use in the application.
Data Binding
The association of a data source with a server control. The MapXtreme DataBinding class contains
information about a single data-binding expression in an ASP.NET server control, which allows
rapid-application development (RAD) designers in Visual Studio to create data-binding expressions
at design time.
Decimal Degree
The decimal representation of fractions of degrees. Many paper maps express coordinates in
degrees, minutes, seconds (for example, 40_30i10I), where minutes and seconds are fractions of
degrees. Thirty minutes equal half a degree, and 30 seconds equal half a minute. MapXtreme
expresses coordinates in decimal degrees (e.g., 72.558 degrees). Thus, the longitude: 40 degrees,
30 minutes, would be expressed in MapXtreme as 40.5 degrees.
Degrees Longitude, Degrees Latitude, Decimal Degrees
Degrees longitude and degrees latitude are coordinates used to represent locations on the surface
of the earth. Longitude, or X-coordinate, represents a location's east-west position, where any
location west of the prime meridian has a negative X value. Latitude, or Y-coordinate, represents a
location's north-south position, where any location south of the equator has a negative Y value.
Derived Class
A class that contains all of the features of its base class but contains either additional functionality or
enhanced functionality with respect to its base.
Enumerate
A type that contains all of the variables and their possible values.
Event Handler
An attribute for an object on a page that can be written in either JavaScript or VBScript. For
example, an event handler describes what to do when a user clicks a button or selects text in a list
box. Both VBScript and JavaScript support explicitly defined event handlers, for example, on Click
and on Select. In addition, you can define functions that replace the explicit event handlers. Such
functions are called implicit event handlers.
MapXtreme v7.1
623
Developer Guide
Appendix L: Glossary
Terms
Feature
A row in a table that has geometry, style, and attributes. A Feature usually has a Table and Key to
identify which row it represents.
FeatureLayer
A MapXtreme layer that displays Features from a Table. For example, a layer of region objects
representing world countries is a FeatureLayer. A FeatureLayer must be added to a Map via the
Map's Layer collection. FeatureLayers can be native .TAB data, remote RDB, seamless or raster
data.
Geocode
The process of assigning X and Y coordinates to records in a table or database so that the records
can be displayed as objects on a map.
GeoDictionary
A MapXtreme file that contains information about tables (TAB files only). The GeoDictionary is used
to automatically determine the table to which application data should be bound.
GeoDictionaryManager
A MapXtreme tool for maintaining the Geodictionary.
Geographic Information System (GIS)
An organized collection of computer hardware and software designed to efficiently create,
manipulate, analyze, and display all types of geographically or spatially referenced data.
Geometric Centroid
A centroid point (see Centroid) that does not need to be contained within the object (usually a
FeatureGeometry).
Geography Markup Language (GML)
A markup language specific to mapping. The GML is being developed by the Open GIS Consortium
(OGC), an international organization that develops and promotes geographic standards.
Graticule
A grid of horizontal (latitude) and vertical (longitude) lines displayed on an earth map, spaced at a
regular distance (for example, every five degrees, every fifteen degrees). Used to establish a frame
of reference.
Grid
An interpolation of data values across an area. A grid is created from a data file in which data is
measured at evenly-spaced points. The entire map area is converted to a grid in which each grid cell
represents a value. See Chapter 17: Grid Images.
Hillshading
Relief shading of a grid map according to a virtual light source. The brightness of each grid cell
corresponds to the light striking the surface and is adjusted based on its orientation to the light
source.
Hypertext Markup Language (HTML)
A plain text (Ascii) language that enables developers to create Web pages that can be displayed by
different Web browsers on different computing platforms. Html uses tags to specify the structure of
the various parts of a document. Html supports links (using URLs) that point to other web documents
and files.
MapXtreme v7.1
624
Developer Guide
Appendix L: Glossary
Terms
Hypertext Transfer Protocol (HTTP)
The message-based network interface between a Web client and a Web server. HTTP runs on top of
TCP/IP.
Inflection
The point in a grid map at which the color changes due to a change in the grid value or percentage.
See Chapter 17: Grid Images and Inflections.
Internet Information Services (IIS)
The software services provided by Microsoft that support the creation, configuration, and
management of web sites. Specifically some commen Internet Information Services include: FTP
(File Transfer Protocol) and SMTP (Simple Mail Transfer Protocol). In MapXtreme, the WMS Server
we provide must be configured to work with IIS to run the Server.
ISession Interface
The MapXtreme MapInfo.Engine namespace interface that provides the starting point for all
MapXtreme applications. ISession manages the initialization of resources needed for a MapXtreme
application, and defines all data and functionality applicable to an instance of an application.
Latitude
The horizontal lines on a map that increase from 0 degrees at the Equator to 90 degrees at both the
North (+90.0 degrees) and South (-90.0 degrees) poles. Used to describe the north-south position of
a point as measured usually in degrees or decimal degrees above or below the equator.
Layer
A basic component of map display in MapInfo products, typically consisting of several superimposed
layers (e.g., a layer of street data superimposed over a layer of county or postal code boundaries).
When a table appears in a Map window, it occupies a layer in that Map window. Typically, each map
layer corresponds to one open table.
Linear Referencing
An alternative reference system to the traditional coordinate reference systems that tie locations of
linear features to points on the earth. Any physical asset that you can map as part of a linear network
can hold data that describes the asset or a condition or event related to that asset. In MapXtreme
the data is stored as an M, or measure value, on the MultiCurve object along with the X and Y
coordinates for the location. The M values can then be further mapped and analyzed for better
resource management. See Chapter 21: Linear Referencing.
Longitude
The vertical lines on a map, running from the North to South poles, used to describe the east-west
position of a point. The position is reported as the number of degrees east (to -180.0 degrees) or
west (to +180.0 degrees) of the prime meridian (0 degrees). Lines of longitude are farthest apart at
the Equator and intersect at both poles, and therefore, are not parallel.
Longitude/Latitude
The default coordinate system for representing geographic objects in a map in MapInfo products.
MapControl
A MapXtreme object that enables you to view a map on a form. The MapControl owns the window
that the map draws to. It also controls the size of the map and interacts with the map tools.
MapXtreme provides desktop and web versions of MapControl.
MapXtreme v7.1
625
Developer Guide
Appendix L: Glossary
Terms
MapInfo Codespace
A list of definitions and standards that are commonly used in creating MapInfo maps and
workspaces. The MapInfo Codespace includes coordinate system settings; pen, brush, and distance
settings and abbreviations; image size settings; frequently used types and their abbreviations; a list
of available operators; time, date, and temperature unit settings, and abbreviations. For details, see
Appendix G: Defining the MapInfo Codespace.
MapInfo MapCatalog
A server table containing column information about spatial tables. See The MapInfo_MapCatalog.
MapInfo SQL Language
A reference of SQL syntax used in MapInfo mapping products. The language is based on SQL3 and
has special MapInfo operators defined for spatial analysis.
Meridian
A line or a portion of a line running from the North to the South pole. A longitudinal line.
Namespace
A hierarchal naming system that provides a way to group classes together independently of
inheritance. For example, two unrelated classes with the same name can exist in different
namespaces: System.Utilities.FileFinder and MyCompany.Utilties.FileFinder could have the same
name, but different functionality. Namespaces also help to prevent the compiler from referencing the
wrong class (a 'collision').
Non-Earth Map
A map whose objects are not explicitly referenced to locations on the earth's surface. Floor plans are
typical examples.
Persistence
Persistence refers to the way MapXtreme (and other MapInfo products) manages data and ensures
that maps created using this API can be used by other MapXtreme users. Persistence is concerned
with loading and saving XML-based workspaces and for parsing and publishing MapInfo Geometry
objects from/to GML, and vice versa.
PointRef Schema
A spatial schema that can be applied to a non-mappable table to make it mappable. The schema
references a Geometry object in another table by matching the values in a column (MatchColumn) of
the non-mappable table with a column (RefColumn) in a mappable table. When the table is opened,
it contains a read-only Geometry column. The table can then be added to a Map as a layer.
Pooling
To shared resources for better performance and scalability. In a MapXtreme web application,
MapXtreme Session instances are available for use in a COM+ pool and ready to service requests
from clients.
MapXtreme v7.1
626
Developer Guide
Appendix L: Glossary
Terms
Projection
A mathematical model that transforms the locations of features on the earth's surface to locations on
a two-dimensional surface, such as a paper map. Since a map is an attempt to represent a spherical
object (the earth) on a flat surface, all projections have some degree of distortion. A map projection
can preserve area, distance, shape or direction but only a globe can preserve all of these attributes.
Some projections (for example, Mercator) produce maps well suited for navigation. Other
projections (for example, equal-area projections, such as Lambert) produce maps well suited for
visual analysis.
Region
A region is a MultiPolygon with one exterior Ring and zero or more interior Rings (holes).
Serialization
Serialization is the process of converting an object into a stream of data in order to preserve it on the
server. This process is an essential part of maintaining objects in MapXtreme web applications. If the
objects are not maintained the server would need to recreate the object (such as a map) for each
web request.
Spatial Schema
A service that can be applied to a table to enhance its spatial capabilities. There are two types of
spatial schemas in MapXtreme: PointRef and XY. Non-mappable tables that contain either a column
that can be referenced to a column in a mappable table, or columns that represent XY values, can
use these schemas to create a Geometry column. These tables can then be added to a Map as a
layer. See the PointRef Schema and XY Schema glossary definitions for information about each
type of schema.
State Management
A general term in web application development that deals with saving and restoring information from
a browser session.
Table
A collection of data organized in row and column format. In MapXtreme, tables contains the data you
wish to display on the map. Tables hold information that describe the features, including their
geometry, style, and attributes. MapXtreme supports tables from a wide variety of sources including,
native tables (MapInfo .TAB), relational database management systems (RDBMS), dBase, MS
Access, ASCII files, and ESRI ShapeFiles. Speciality tables include raster, grid, seamless, views,
WMS, and ADO.NET. The type of table is available through the TableInfo class. Tables are opened
and closed via the Catalog in the Data namespace. See Chapter 8: Working with Data.
Tile Handler
An HTTP handler that processes requests for map tiles from web applications. See MapXtreme Tile
Handler.
Uniform Resource Locator (URL)
The underlying implementation of a hypertext link or image map that contains the address of a Web
page or file somewhere on the World Wide Web. A URL contains information about the network
protocol to use (usually HTTP) and the path to the page or file. An URL example is
http://www.mycompany.com/index.html, which points to the index page for the my company web
site.
MapXtreme v7.1
627
Developer Guide
Appendix L: Glossary
Terms
Universal Character Set (UCS)
The international standard ISO 10646 defines the Universal Character Set (UCS). UCS is a superset
of all other character set standards. UCS also defines several methods for encoding a string of
characters as a sequence of bytes, such as UTF-8 and UTF-16.
Unicode Transformation Format-8 (UTF-8)
An octet (8-bit) lossless encoding of Unicode characters. MapXtreme supports UTF-8 only as
indicated in the workspace persistence schema.
Web Controls
An element on a web page that users interact with to send requests to the web server.
Web Map Service (WMS)
WMS is an OGC-compliant Web service that provides map images for use as layers in a mapping
application. MapXtreme provides a server implementation of WMS if you wish to host a WMS server
and a client for accessing any OGC-compliant (1.0.0, 1.1.0, or 1.1.1) WMS.
Web Feature Service (WFS)
An OGC-compliant Web service that offers geo-referenced map features for use in mapping
applications. MapXtreme provides an implementation of WMS Basic, a read-only service and a
client for accessing WMS servers.
Web server
A computer system that runs the Hypertext Transfer Protocol and Web Server software. A Web
server accepts URL-based HTTP requests from a Web user's browser and sends HTML pages back
to the browser. A Web server can manage one or many Web sites. A commercial server, for
example, would typically have many Web sites.
Workspace
An XML-based persistence file format that allows users of MapXtreme to share maps they have
created in a wide variety of environments. This is the file format that all future MapInfo products will
conform to. For more about creating workspaces, see Chapter 23: Workspace Manager. For more
about the structure of workspaces, see Appendix C: Understanding the MapInfo Workspace.
XY Schema
A spatial schema that can be applied to a non-mappable to make it mappable. The table must
contain X and Y coordinate values, which the schema accesses to create a Geometry column for the
table.
MapXtreme v7.1
628
Developer Guide
Index
Numerics
32-bit
supported architecture 29
64-bit
supported architecture 29
A
abbreviations file
editing 272273, 277
substitution keywords 274
substitution methods 274276
accessing mappable tables 187
accessing non-mappable data 478
accessing non-mappable tables 161, 165, 178,
186187
accessing remote tables
attribute data 233
cache management 234236
DataTable 179
DBMS databases 222
defining mappable tables 231
IDBCommand 181
MapInfo_MapCatalog 236237
mappable tables 231232
mapping to X/Y columns 223
ODBC connection string format 229
performance 202, 233
specifying styles 244
with a .tab file 222
without a .tab file 222
add tools
adding geometry objects to a map 143
drawing geometric features 144
adding
dialog box to application 134
geometry objects to a map 143
grid image to a map 326
raster image to a map 321
address candidates
MapXtreme v.7.1.0
629
Developer Guide
Index
desktop architecture 74
licensing 3132
packaging a desktop 467
packaging a web 472474
planning a desktop application 125126, 140
planning a web 7678, 80, 105106, 109111,
113, 460461, 463, 465466
startup workspace 112, 122123
application state
defined 104
thematic sample 120121
application templates
ASP.NET 4849
MapForm 4648
AppStateManager
implementing 117119
architecture
application 7174
desktop application 74
object model implementation 604
overview 67
supported 29
web applications 7273
ASCII
supported table type 167
ASP.NET AJAX 93
web controls 92, 94
ASP.NET applications
creating without MapXtreme templates 50
session management 204
using ASP.NET template 4849
Web controls 50
ASRP
supported raster format 320
assemblies
creating from source code 9091
creating new 9091
redirecting to new 4546
attribute data
accessing 233
authentication
extensible data provider 521
autolabels
Workspace Manager 433
AvoidList class 377
Azimuthal projections 587
B
background map
defined 103
bar themes
creating 283
MapXtreme v.7.1.0
C
cache management
accessing remote tables 235236
remote tables 234
Caching
MapXtreme Tile Handler 97
CADRG
supported raster format 320
CalculateMissingMeasures
determining measure (M) values 391
callbacks
extensible data provider 521
CandidateAddress class
geocoded addresses 338
Cartesian coordinates
defined 622
cartographic legends 292293
Catalog
analyzing data 200
630
Developer Guide
Index
data access 178
search methods 195
table registry 165
center tool
desktop 142
centroid
defined 622
character encoding
defined 622
UTF-8 in workspace 494
CIB
supported raster format 320
circle tools
drawing circles 144
class
defined 622
close matches
Find class result 269
closing tables 170
codespace
defined 622
definitions 566570
codespace definitions 566, 568
column hints 599602
columns
adding 218
adding expressions 176
supported data types 161162
COM object model
.NET interoperability 125
COM+ pooling
defined 622
composite styles 297
conic projections
standard parallels 587
constraints
geocoding 343
contacting technical support 27
controls
web 8081, 83, 8688, 99101
convex hull
defined 622
coordinate systems
adding to MapXtreme 315317
converting Geometry objects 314
defined 623
extensible data provider 514
geometries 312317
how to determine 314
mapping term description 6364
origin 586588
publications and resources 596
raster images 321
MapXtreme v.7.1.0
631
Developer Guide
Index
curves
creating 309
custom bitmaps
point styles 296
custom tools
behavior 143
customizing
dialog boxes 139
EngineCustomProperties class 478
FeatureOverrideStyleModifier 479
FeatureStyleModifier 479
GMLFeatureCollection 484
search functions 479
styles 483
tools 482
UserDrawLayer 480
web tools 88, 92
Windows controls 481482
Windows tools 146
Workspace Manager 485489
WorkSpaceLoader 484
D
data
analyzing 200
using in MapXtreme 183
data access
DataTable 179
deploying applications 57
ExecuteFeatureCollection 191
expressions 215220
features 193
GeoDictionary Manager 185186
IDBCommand 181182
MapInfo ADO.NET Data Provider 189
MapInfo SQL language 193
MICommand 190191
MIConnection 189
MIDataReader 192
optimizing performance 202
planning for 178, 185186, 200202
source rows 185
SQL commands 190191
data access tools
supported 29
data binding
defined 623
description of 183
registering tables in GeoDictionary 450
Data namespace
overview 68
UML diagram 160
MapXtreme v.7.1.0
data provider
choosing 177
described 501
extensible 499, 525
data source
described 501
data sources
supported 177
Data.Find namespace
overview 69
UML diagram 266
databases, supported 29
date and time expression 219
date and time functions 216
Date data type 162
SQL expressions 217
DateTime data type 162
datums
converting coordinates 588
defining custom 589592
list of 576, 578584
projections 576
dBase
supported table type 166
DBMS databases
accessing remote tables 222
importing spatial tables to 237
decimal degrees
defined 623
default styles
composite styles 297
defining mappable tables 231232
degrees latitude
defined 623
degrees longitude
defined 623
.dem files
supported grid format 325
deploying
a web application 475
deploying applications
installers 52, 56
deployment installations 31
deployment licenses 32
derived class
defined 623
deserialization
process description 207, 518
restoring state 119120
desktop application
architecture 74
creating 457459, 462, 464
MapControl 129
632
Developer Guide
Index
MapTools 140
packaging 467
planning 125126, 140
prototyping 125
session management 204
tutorial 457459, 462, 464
updating 44
desktop controls 126
desktop tools namespace 70
determining measure (M) values
CalculateMissingMeasures 391
DropMeasures 391
Reverse 391
ScaleMeasures 391
SetMeasures 391
SetMeasuresAsDistance 391
TranslateMeasures 391
development environment
supported 29
development frameworks 29
development installations 30
development model
InProc 108110
pooled 110
dialog boxes
adding to applications 134
CreateThemeWizard 135136, 138139
customizing 139
Grid Style 332
distributed applications
licensing 32
documentation set 27
dot density themes
creating 290
drawing circles
circle tools 144
drawing ellipses
ellipse tools 144
drawing lines
line tools 144
drawing points
custom bitmap styles 296
font point styles 297
MapInfo 3.0 Compatible fonts 299
drawing polylines
polyline tools 144
styles 298
drawing rectangles
rectangle tools 145
drawing regions
interior styles 297
styles 296
drawing text
MapXtreme v.7.1.0
E
ECW files
supported raster format 320
ellipses
drawing ellipses 144
.emf files
supported raster format 320
EnableTranslucency property 429, 529
Engine namespace
exception classes 213
overview 69
enumerate
defined 623
Envinsa Location Utility Service
result codes 338
EPSG codes
registering with MapXtreme 315317
error handling
web controls 87
event handler
defined 623
web controls 87
event handling
IWorkspaceManagerNotifications 487
events
tool 147
exception classes
Engine namespace 213
exception handling
extensible data provider 515
ExecuteFeatureCollection 191
exporting
maps to an image 247
expressions
AddColumns 218
Boolean 216
creating 215220
examples 217220
feature search 218
functions 216
InfoTip 220
label 219
633
Developer Guide
Index
label priority 435436
selecting objects outside buffer 218
selecting objects within buffer 218
thematic 219
uses 216
extensible
Workspace Manager 485
extensible data provider
abstract base class 506
authentication 521
building 502
building and testing 510
coordinate systems 514
creating geometries 513
cursor 502
data provider 501
data source 501
exception handling 515
ICursor interface 505
IDataProvider interface 504
IDataSource 509
IFeatureAccessor interface 505
ITable interface 505
ITableDefinition interface 504
ITableMetaData interface 505
optional interfaces 509
overview 500
persistence providers 516
required components 504
serialization 518
SimpleFeatue class 506
software development kit 499, 525
styles 514
thread safety 524
Extensions
Workspace Manager 424
extensions
for Workspace Manager 485489
F
False Eastings 587
False Northings 587
feature geometry styles
extensible data provider 514
FeatureCollection 194
FeatureGeometry 193
FeatureGeomety.Distance
linear referencing 391
FeatureLayer
defined 624
FeatureOverrideStyleModifier
customizing 479
MapXtreme v.7.1.0
G
GDI+ translucency and anti-aliasing 438440, 529
.gen files
supported raster format 320
geocode
defined 624
GeocodeClientFactory class 337
geocoded addresses
CandidateAddress class 338
634
Developer Guide
Index
GeocodeMatchCode class 338
GeocodeRequest class 340
sending geocoding requests 337
GeocodeResponse class
candidate addresses 337
geocoding
adding geocoding client to applications 336
address candidates 337
address dictionaries 340
close matches 346
constraint preferences 344
constraints 343
defined 336
displaying data on maps 65
example 341
input addresses 339
overview 64, 338, 340
postal codes 343
reference addresses 339
result codes 346, 348349
sending requests 337
street addresses 341
street intersections 342
geocoding classes 336
Geocoding namespace
overview 70
Geocoding World component 340
GeocodingConstraints class 338
GeoDictionary 185186
defined 624
utility 450451, 453
GeoDictionaryManager 453
defined 624
Geographic Information System (GIS)
defined 624
Geography Markup Language (GML) 395
defined 624
geometric centroid
defined 624
geometries
coordinate systems 312317
Geometry class 303304
geometry column
mappable tables 231
Geometry namespace
overview 69
UML diagram 304
geometry objects
converting to FeatureGeometry objects 309
GeoTIFF files
supported raster format 320
GIF files
supported raster format 320
MapXtreme v.7.1.0
H
hillshading
defined 624
grid parameter 298
Hotine Mercator projection
Oblique Azimuth 587
HTTP Session
defined 103
635
Developer Guide
Index
Hypertext Markup Language (HTML)
defined 624
Hypertext Transfer Protocol (HTTP)
defined 625
I
ICursor interface
extensible data provider 505
IDataProvider
extensible data provider 504
IDataSource
extensible data provider 509
IDW
See Inverse Distance Weighted interpolator
IFeatureAccessor interface
extensible data provider 505
IInterpolator
programming interface 329
IIS
defined 625
IIS 7.0
developing web applications with 38
installation requirements 38
IIS Support
v 6 and 7 29
importing
features from XML files 484
individual value label themes
creating 289
individual value themes
creating 287
inflection
calculating 330
defined 625
for grids 330
grids 298
inflection values
grids 329
InfoTips 145
InProc
development model 108109
versus pooling 108109
InProc development model
defined 103
versus pooling 107, 110
web applications 107, 110
installation
prerequisites 37
procedure 4043
types of 30
installed bitmap images
accessing 299
MapXtreme v.7.1.0
installers
deploying applications 52, 56
interior styles
BaseInterior class 298
drawing regions 297
SimpleInterior 297
InteriorStyleRepository class
customizing 483
Internet Information Services (IIS)
defined 625
Inverse Distance Weighted
grid interpolator 328
ISearchResultProcessor interface 479
ISession interface
defined 625
session management 204
UML diagram 204
ISessionEventHandlers
Workspace Manager extensions 487
isoChrone
drive-time 379
isoChronePreferences class 379
isoDistance
drive-distance 382
isoDistancePreferences class 382
isogramPreferences class 379
ITable interface
extensible data provider 505
ITableDefinition
extensible data provider 504
ITableMetaData interface
extensible data provider 505
IWorkspaceManagerNotifications
event handling 487
J
JavaScript
web tools 84, 88, 92
JPEG files
supported raster format 320
JPEG2000 files
supported raster format 320
K
Key
MI_Key column 164
keywords
Mapinfow.abb file substitutions 274
L
label themes
creating 286, 289
636
Developer Guide
Index
Label tool
desktop 142
removing manually added labels 433
repositioning curved labels 446
LabelLayer 254
LabelModifier 254
LabelProperties 255
labels
curved 257, 443, 445446
individual value theme 289
mapping term description 61
overview 253
priority expressions 435436
ranged theme 286
styles 434
UML diagram 253
Workspace Manager 433435
LabelSource 254
latitude
defined 625
layer
defined 625
layer control
Workspace Manager 425
layer override styles
composite styles 297
layer types
FeatureLayer 250
GroupLayer 251
MapLayer 251
ObjectThemeLayer 251
UserDrawLayer 251
LayerControl 81
creating custom tabs 481
customizing 481
layer nodes 481482
styles 300
Windows control 133
Workspace Manager 425436
LayerNodeHelper classes
customizing 481
layers
applying translucent effects 440441
customizing appearance 479
mapping term description 61
types 250
UML diagram 250
UserDrawLayer class 480
LegendControl 82
legends 291292
adornments 257
aligning frames 293
cartographic 292293
MapXtreme v.7.1.0
M
M category matches
geocoding result codes 348
Map Application template
637
Developer Guide
Index
rapid prototyping 125
Map class
map contents 248
map legends 291292
aligning frames 293
Map object
determining coordinate system 314
map title
adornments 257
map tools
architecture 84
JavaScript-enabled 84
process diagram 85
using 8586
map view
View tools 142
MapAlias property
web controls 87
MapCatalog
defined 626
MapControl 81
defined 625
in table cells 101
web control 77
Windows control 128, 249
MapControlModel
web applications 85
MapExport
exporting to an image 247
MapFactory
creating maps 248
MapForm applications
using MapForm template 4648
Windows controls 50
MapInfo 3.0 Compatible fonts
drawing points 299
VectorSymbolRepository class 299
MapInfo ADO.NET Data Provider
data access 189
data provider 177
MICommand 190191
MIConnection 189
MapInfo codespace 566570
defined 626
MapInfo codespace definitions 566, 568
MapInfo Grid files
supported grid format 325
MapInfo MapCatalog
defined 626
MapInfo SQL functions
date and time 216
in expressions 216
MapInfo SQL language 193
MapXtreme v.7.1.0
defined 626
MIDataReader 192
reference 201
MapInfo Workspace format (.MWS) 414
MapInfo.Engine.Session.State
defined 104
MapInfo_MapCatalog
adding rows 239, 241242, 244
creating 237
MapInfoCoordinateSystemSet.xml file
coordinate units 585586
projection 575
projection ID numbers 573
Mapinfow.abb file
editing 272273, 277
matching to street abbreviations 263264
substitution keywords 274
substitution methods 274276
MapLoader
loading data 249
MapMarker server
result codes 338
mappable tables
adding rows to MapCatalog 239, 241242
defining with server table queries 231232
making tables 186
Mapping namespace
overview 69, 247
UML diagram 247
mapping terms and concepts 6062, 64
Mapping.Legends namespace
overview 69
Mapping.Thematics namespace
overview 69
UML diagram 279280
MapPrinting
class 531
maps
cartographic legends for 292293
mapping terms and concepts 6062, 64
MapStyleControl 530
MapToolBar
Windows control 130132
MapTools
for desktop applications 140
MapView
list of views 249
MapX 5.0
migrating to MapXtreme 603613
MapXtreme
architecture overview 67
creating an application 456
feature overview 22
638
Developer Guide
Index
installing 40
migrating to 24
object model 6870, 604
product overview 22
support resources 27
upgrading 43, 46
web controls architecture 83
MapXtreme ASP.NET Web applications
building without templates 50
using templates 48
MapXtreme JavaScript web controls
migrating from MapXtreme postback controls 99
MapXtreme Session
defined 103
MapXtreme Session instance
clean 120
description 121
MapXtreme Tile Handler 94
caching 97
request available maps 95
using 95
MapXtreme Windows Map applications
using templates 46
matches
geocoding 346
matching data
automatching 185186
GeoDictionary 185186
matrix routing 373
MatrixRouteRequest class 374
MatrixRoutingPreferences class 375
MDAC 2.8
supported tools 29
MemTable
supported table type 167
merge modules
creating an installer 53, 56
meridian
defined 626
metadata
TAB files 173
TableInfo 172
MI_Geometry column 164
MI_Key column 164
MI_Style column 164
MICommand 191
analyzing data 200
data access 189
SQL statements 190
MIConnection
data access 189
MapInfo ADO.NET data provider 189
Microsoft Data Access Components (MDAC)
MapXtreme v.7.1.0
deploying applications 57
MIDataReader 192
migrating to MapXtreme 24, 603613
modifier styles
composite styles 297
modifier themes
description 279
dot density theme 290
individual value label theme 289
individual value theme 287
ranged 284
ranged label theme 286
modifying features 194
MrSID files
supported raster format 320
MS Access
supported table type 167
MSI installers
creating an installer 53, 56
MultiPoint objects
creating 305
multipoint routing 372
MWS
workspace with named resources 208209
.mws
MapInfo Workspace format 414
MXTRunNCP.exe
See runtime installer
N
NAD 83 datum 588
NADCON
converting between NAD 27 and NAD 83 588
named connections
types 417
named resources
opening ans saving workspace 208209
namespaces 6870
defined 626
National Transformation v. 2 (NTv2) 593596
.NET object model
COM interoperability 125
NITF
supported raster format 320
non-earth map
defined 626
non-match codes
geocoding result codes 349
North American Datum Conversion (NADCON)
See NADCON
639
Developer Guide
Index
O
object model
architecture 68
data access 178, 185186, 200202
implementation 604
MapXtreme versus MapX 604
namespaces 6870
object themes
bar 283
description 280
graduated symbol 280281
pie 282
Oblique Azimuth
Hotine Oblique Mercator projection 587
ODBC connection string format 229
OGC query interface
analyzing data 200
OpenGIS Implementation Specification
Web Feature Service 395
Web Map Service 351
opening tables
Catalog 165
operating systems
supported 29
operating sytems
supported 29
operations
linear referencing 391
optional interfaces
extensible data provider 509
Oracle applications
troubleshooting 245
Oracle Spatial
connection string format 230
geometry conversion 223226
overriding styles 301
P
packaging
a desktop application 467
a web application 472474
packing tables 170
pan tool
desktop 142
parameters
projections 572
pattern scaling 534
PCX files
supported raster format 320
pen styles 555
in remote spatial tables 244
performance
MapXtreme v.7.1.0
640
Developer Guide
Index
development model 111
versus InProc 107, 109111
pooling, defined 626
postal centroid matches
geocoding result codes 348
postal code geocoding 343
pre-defined styles 299
printing from MapXtreme applications 527531,
533539
product architecture 67
product features
highlights 22
project templates
shipped with MapXtreme 126
projections
datums 576, 578584
defined 627
MapInfoCoordinateSystemSet.xml 575
MapInfoCoordinateSystemSet.xml ID numbers
573
mapping term description 6364
parameters 572
publications and resources 596
prototyping
rapid desktop application development 125
Q
queries
customizing with QueryDefinition class 479
QueryDefinition
customizing 479
QueryFilters
customizing 479
R
radius tool
desktop 142
range
in projections 587
ranged label themes 286
creating 286
ranged themes
creating 284
distribution types 285286
Raster
supported table type 168
raster handlers 322323
raster images
adding to a map 321
coordinate systems 321
limitations 321
main classes 320
MapXtreme v.7.1.0
641
Developer Guide
Index
rings
creating 309
RoadTypePercentageSpeedUpdate class 387
RoadTypeRelativeSpeedUpdate class 387
RoadTypeSpeedUpdate class 387
route geometry 376
RouteInstructionsRequest class 375
RouteRequest class 372
RouteSegmentDataRequest class 383
routing
adding routing client to applications 370
avoiding points, features, segments 376
defined 370
driving directions 375
matrix 373
multipoint 372
overview 65
point-to-point 371
preferences 374
returning segment information 383
start and end times 377
stop times 378
time-based 377
transient updates 384
Routing namespace
overview 71, 370
UML diagram 371
RoutingPreferences class 375
runtime installations 31
runtime installer
deploying applications 52
runtime licenses 3132
S
S category matches
geocoding result codes 347
sample applications
AJAXDemo 9394
linear referencing 393
search 197
shipped with MapXtreme 126
sample code
Workspace Manager extension 488
sample connection strings 230
scale factor
Transverse Mercator projection 587
scalebar
adornments 257
ScaleMeasures
determining measure (M) values 391
scaling patterns 534
SDK
MapXtreme v.7.1.0
642
Developer Guide
Index
ShapeFile
supported table type 167
.sid files
supported raster format 320
SimpleFeature
extensible data provider utility class 506
single close address matches
geocoding result codes 347
SmoothingMode property 529
source code
MapXtreme web controls 9091
source rows 185
spatial schemas
defined 627
PointRef 186187
XY spatial 186
SpatialWare applications
troubleshooting 245
special characters
Mapinfow.abb file substitutions 276
Spot files
supported raster format 320
SQL language
MapInfo reference 201
SQL statements
MICommand 190191
SRID codes
registering with MapXtreme 315317
standard parallels
conic projections 587
state management
automatic 112
configuring manual 114
defined 103, 105, 627
manual 112, 117119
manual example 113115
options 105
pooled applications 112
session object 204
terms 103104
thematic sample 115, 117, 119121
web application planning 103
web applications 80, 471
web controls 88
StateManager class
defined 104
implementing 117119
stock dialogs
provided with MapXtreme 135
stock styles
default styles 299
stock tools
desktop 146
MapXtreme v.7.1.0
web 79, 84
street abbreviations
matching to with Find 263264
street address geocoding 341
street addresses
Find result codes 270
matching to with Find 263
street intersection geocoding 342
street intersections
matching to with Find 263
street names
matching to with Find 263
style overrides
layer settings 436
StyleRepository
style storage 299
StyleRepository classes
accessing predefined styles 299
styles
area 296
composite 297
creating custom bitmaps 300
customizing with repository classes 483
fill 297298
font 297
font point 297
grid 297
grid hillshading
grids 329
in remote spatial tables 244
inflection 298
label 434
LayerControl 300
line 298
lookup tables 540
modifying 259
overriding 260, 301, 426
points 296, 298
raster 298
stock 299
supported custom bitmap symbols 560
supported fill patterns 541
supported line styles 555
supported vector symbols 556
text 299
vector points 299
Workspace Manager 434
Styles namespace
overview 70
UML diagram 295
substitutions
Mapinfow.abb file keywords 274
supported architecture 29
643
Developer Guide
Index
supported environments 29
IIS 6, 7 29
supported file formats
grids 325
raster images 320
supported operating systems 29
symbol font sets 556
symbol styles
in remote spatial tables 244
T
.TAB
supported table type 166
table
extensible data provider
extensible data provider
table 502
TableInfo
metadata 172
tables
adding expression columns 176
alias 161
Catalog 165
closing 170
columns 161162
creating permanent native 173
creating temporary MemTable 175
creating temporary native 174
defined 627
events 171
mappable 186187
mapping term description 60
MI_Geometry column 164
MI_Key column 164
MI_Style column 164
non-mappable 161, 165, 178, 186187, 626
628
opening 165
packing 170
relating 184186
result sets 185
supported types 166
views 184
Targa files
supported raster format 320
technical support, contacting 27
templates
ASP.NET 4849
for MapXtreme projects 126
MapForm 4648
terminology
pooling 103104
MapXtreme v.7.1.0
644
Developer Guide
Index
enabling in Workspace Manager 429, 438440
MapStyleControl 530
when printing 529
Transverse Mercator projection
scale factor 587
TravelTime class 377
trial licenses 32
Triangulated Irregular Network
grid interpolator 329
troubleshooting
licensing 3537
Oracle applications 245
SpatialWare applications 245
TrueType fonts
StyleRepository class 299
tutorial
applications 46
creating a desktop application 457459, 462,
464
creating a web application 467472
packaging a desktop application 467
packaging a web application 472474
U
UML diagram
Data namespace 160
Data.Find 266
Geometry 304
Mapping 247
Mapping.FeatureStyleModifier 260
Mapping.Labels 253
Mapping.Layers 250
Mapping.Thematics.IModiferTheme 279
Mapping.Thematics.ObjectTheme 280
Raster 319
Routing 371
Styles 295
Unicode Transformation Format (UTF-8)
defined 628
supported in workspace 494
Uniform Resource Locator (URL)
defined 627
Universal Character Set (UCS)
defined 628
updating existing applications 44
upgrading to MapXtreme 43, 46
URL request
client side 8485
MapControlModel 85
server-side 85
user state
defined 104
MapXtreme v.7.1.0
managing 115
user-created installers
deploying applications 53, 56
user-defined metadata 599602
UserDrawLayer class 480
USGS DEM files
supported grid format 325
utilities
GeoDictionary Manager 185186, 450454
Workspace Manager 414, 448
V
VectorPointStyleRepository class
customizing 484
Vertical Mapper Classified Grid
supported raster format 320
Vertical Mapper Continuous Grid
supported grid format 326
supported raster format 320, 326
ViaPoint class 378
View
supported table type 169
view tables 184
view tools
changing map view 142
Views
MapView 249
Vista
See Windows Vista
Visual Basic .NET
ASP.NET application template 4849
development framework 29
Map application template 46
MapForm application template 47
Visual C# 29
Visual Studio
creating applications in 47, 49
development framework 29
W
watermarks
with runtime licenses 32
with SDK licenses 31
with trial licenses 32
web application
adding ASP.NET AJAX controls 9294
architecture 7273
background map 77
client side command execution 84
client side map interaction 84
deploying 475
design considerations 76
645
Developer Guide
Index
design time view 78
initial request 120
MapXtreme Session instance 120121
packaging 472474
packaging tutorial 472474
planning 7678, 80, 103, 105111, 113, 460
461, 463, 465466
pooling 80
run-time view 79
server-side command architecture 85
state management 80
terminology 103104
tools 79
tutorial 467472
updating to MapXtreme 44
web applications
state management 471
web browers
supported
databases
supported 29
web controls 8081, 83, 8688, 99101
architecture 83
ASP.NET AJAX 93
ASP.NET Web applications 50
defined 628
description 8183
directory structure 81
distributing 9091
error handling 87
event handling 87
in frames 100
localizing 101
MapAlias property 87
migrating from MapXtreme postback controls 99
modifying source code 9091
state management 88
tools 79
using 81, 8688, 99101
Web Feature Service (WFS)
client 406, 408409
configuring server 400403
creating map layers 409
defined 628
requests to server 395399
Web Map Service (WMS)
configuring server 356357, 359, 363364
configuring server with IIS6 362
configuring server with IIS7 361
defined 628
layer configuration on server 365, 367368
map requests via client 354
requests to server 351353
MapXtreme v.7.1.0
Web server
defined 628
web tools
architecture 84
customizing 88, 92
description 8183
interacting with MapControl 84
javascript-enabled 80
using 8586
using with MapControl 101
versus full page postback 80
web.config file
preloaded workspace 86
session management 116117, 204
settings 86
WebControls namespace
overview 70, 80
WFS
See Web Feature Service (WFS)
where clause 216
Windows 7
installation requirements
supported operating system 29
Windows Bitmap files
supported raster format 320
Windows controls
desktop applications 126
LayerControl 133
MapControl 128
MapForm applications 50
MapToolBar 130132
Windows dialog boxes
adding to applications 134
CreateThemeWizard 135136, 138139
customizing 139
Windows enhanced metafiles
supported raster format 320
Windows metafiles
supported raster format 320
Windows Server 2003
supported operating system 29
Windows Server 2008
installation requirements
supported operating system 29
Windows Vista
installation requirements 38
Windows Vista Ultimate
supported operating system 29
Windows XP
supported operating system 29
Windows.Controls namespace
overview 70
Windows.Dialogs namespace
646
Developer Guide
Index
overview 70
.wmf files
supported raster format 320
WMS
See Web Map Service (WMS)
supported table type 168
Workspace
opening MWS containing named resources
208209
Workspace Manager
customizing 485489
Extension menu 424
feature summary 414
Grid Style dialog 332
Label tool 433, 446
labels 434
Layer Control 425, 431432, 434436
layer control tools 425
LayerControl 426427, 433
LayerControl tools 428430
menu commands 415418, 420, 422423
named connections 417
overriding styles 426
save as XML 414
themes 432
tools menu commands 421
Workspace Manager extension
creating 485
sample code 488
Workspace Manager extensions
loading 487
WorkSpaceLoader class
customizing 484
workspaces
creating programmatically 497
defined 628
loading 112, 122123
pre-loading 77
reprojected images 321
structure 493495
XML format 415
X
XML files
GeoDictionary 450451, 453
importing features from 484
Workspace format (.MWS) 414
XY schema 186
defined 628
Z
Z category matches
MapXtreme v.7.1.0
647
Developer Guide