MapXtreme v7.
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.
Table of Contents Chapter 1: Introduction to MapXtreme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Overview of MapXtreme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .22 Key Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .22 Migrating to MapXtreme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Table of Contents Map Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .46 ASP.NET Web Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .48 MapXtreme Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50 Building ASP.NET Web Applications Without a Template . . . . . . . . . . . . . . . . . . . . . .
Table of Contents MapInfo.Windows Namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .70 MapInfo.Tools Namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .70 MapInfo.Geocoding Namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .70 MapInfo.Routing Namespace. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71 Application Architectures. . .
Table of Contents Using the MapControl in Table Cells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .101 Web Control Localization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .101 Chapter 6: Understanding State Management . . . . . . . . . . . . . . . . . . . . . . . . . . 102 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .103 Terminology. . . . . .
Table of Contents MapInfo.Windows.Dialogs Namespace. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .134 CreateThemeWizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .135 Customizing Controls and Dialog Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .139 Overview of the MapInfo.Tools Namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .140 MapXtreme Desktop Tools API . . . . . . .
Table of Contents MICommand. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .190 MIDataReader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .192 MapInfo SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .193 Features and Feature Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Table of Contents Functions In Expressions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .216 DateTIme and Time Expressions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .217 Expression Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .217 Chapter 11: Accessing Data from a DBMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Table of Contents Chapter 12: Adding Mapping Capability to Your Applications . . . . . . . . . . . . . 246 Introduction to the MapInfo.Mapping Namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . .247 Base Mapping Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .247 MapExport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .247 Map . . . . . . . . . . . . . . . . . . . . .
Table of Contents Chapter 13: Finding Locations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 Functional Overview of Find . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .263 The Find Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .263 Matching Address Numbers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Table of Contents Bivariate Thematic Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .291 Legends Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .291 Theme Legends . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .292 Cartographic Legends . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Table of Contents Checking for Points in Polygons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .311 Coordinate Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .312 Creating a CoordSys Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .313 Changing the Coordinate System of a Geometry Object . . . . . . . . . . . . . . . . . . . . . . .
Table of Contents AddressCandidates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .338 BaseGeocodeMatchCode and GeocodeMatchCode . . . . . . . . . . . . . . . . . . . . . . . . . .338 CandidateAddress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .338 Understanding the Geocoding Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .338 Geocoding Trade-offs . . . . . . . .
Table of Contents Chapter 20: Routing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369 Overview of MapInfo.Routing Namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .370 Main Routing Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .370 Calculating Routes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Table of Contents Chapter 23: Workspace Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413 Features of the Workspace Manager. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .414 Workspace Format and Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .415 Workspace Manager Menu Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .415 File Menu Commands . . . . . . . . . . . . . . .
Table of Contents Building a Web Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .467 Running a Sample Web Application. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .467 Modifying Your Application. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .469 State Management Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Table of Contents Optional Building Blocks: Base Classes, Helpers and Utilities . . . . . . . . . . . . . . . . .506 Sample: COTW (Center of the World) Data Provider . . . . . . . . . . . . . . . . . . . . . . . . . .507 Optional Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .509 IDataSource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .509 IDataSourceDefinition . . . . .
Table of Contents Vector Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .556 MapInfo Arrows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .556 MapInfo Cartographic. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .556 MapInfo Miscellaneous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Table of Contents Building from the Command Line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .618 Private Key Signing for Satellite Assemblies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .620 Appendix L: Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 621 Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .622 Index . .
Introduction to MapXtreme Welcome Developers to Pitney Bowes Software’s latest offering in the world of .NET programming. In support of Microsoft’s .NET Framework for Windows, MapXtreme reflects a single object model for developing or extending mapping applications for the desktop, traditional client/server environments or the Web.
Chapter 1: Introduction to MapXtreme Overview of MapXtreme Overview of MapXtreme MapXtreme is Pitney Bowes Software’s 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 .
Chapter 1: Introduction to MapXtreme Overview of MapXtreme For developers upgrading to MapXtreme, see the Release Notes for what’s new and changed in the product. See also Migrating to MapXtremefor a mapping of features in MapX to features in MapXtreme .NET. Feature * Purpose Tables, Layers, Features Maps in MapXtreme consist of geographic features like point locations, boundaries and street networks. The feature information is stored in tables and display in the map as layers.
Chapter 1: Introduction to MapXtreme Migrating to MapXtreme Feature * Purpose Geographic processing and analysis This refers to making new features from existing ones, such as combining postal code boundaries to create sales territories. It also refers to using the feature’s location coordinates to learn more about its relationship to other features. For example, create a buffer around a point that measures five miles in radius to find out what other points fall within the buffer zone.
Chapter 1: Introduction to MapXtreme Migrating to MapXtreme MapX5.0 /MapXtreme3.0 Datasets, data binding MapXtreme Add a temporary column to an Table using the Table.AddColumns() method. Related topic: Geodictionary Manager MapInfo.Data namespace Geosets. Geoset Manager Workspaces (.MWS): XML format. Geosets are supported. Related topics: Workspace Manager. MapInfo.Persistence namespace Annotations Adornments: a Legend, a Title, a Scalebar, or some other similar user-defined object in a single map.
Chapter 1: Introduction to MapXtreme Learning to Use MapXtreme MapX5.0 /MapXtreme3.0 Raster and Grid Images MapXtreme New table structure, RasterImageInfo, GridImageInfo. Related topics: controllable styles: brightness, contrast, color/grayscale, translucency, one-color transparency. MapInfo.Raster namespace Label objects and Label collections LabelLayer: allows the separate ordering of labels and layers. LabelSource: information from the data source that is used for labeling. MapInfo.
Chapter 1: Introduction to MapXtreme Learning to Use MapXtreme MapXtreme Learning Resources Page Accessible from the Start Menu after you install MapXtreme, the Learning Resources Page brings together a wide variety of information about MapXtreme, including best development practices, code samples, tutorial web applications, links to all documentation and online resources on the MapInfo website, and much more.
Getting Started This chapter provides all the information you need to install, configure, and deploy your first MapXtreme application. In this chapter: Installation Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29 Types of Installations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .30 MapXtreme Licensing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31 Before You Install . . . . . . . . . . . . . . . . . . .
Chapter 2: Getting Started Installation Requirements Installation Requirements Pitney Bowes Software Inc.has tested and supports MapXtreme on the following.
Chapter 2: Getting Started Types of Installations 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.
Chapter 2: Getting Started MapXtreme Licensing Deployment (Runtime) Installations The Deployment installation option installs the Location Runtime Environment which lays down the MXTRuntimeNCP.exe (or MXTRuntimeSCP.exe for software-copy protected versions of MapXtreme). For instructions on installing the Runtime installer see Deploying With the Runtime Installer. Side-By-Side Installations and Use You may have more than one version of MapXtreme installed on your system at the same time.
Chapter 2: Getting Started MapXtreme Licensing • • 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.
Chapter 2: Getting Started MapXtreme Licensing Deployment Type SDK Version of MapXtreme NodeLocked? How to Obtain Runtime License Desktop Non-copy-protected (NCP) No Contact Customer Service for a runtime license for one or more seats. Desktop Copy-protected (SCP) Yes Generate a node ID file for each seat and submit to Customer Service. Web NCP Yes Generate a node ID file for each seat and submit to Customer Service.
Chapter 2: Getting Started MapXtreme Licensing License Type License Name Location of License Desktop NCP MapXtremeDesktop.lic In the same folder as the application executable to avoid potential conflicts with other applications Desktop SCP MapXtremeDesktopIntl.lic In the same folder as the application executable to avoid potential conflicts with other applications Web NCP MapXtremeWeb.lic Program Files\Common Files\MapInfo\MapXtreme\7.x.x Web SCP MapXtremeWeb.
Chapter 2: Getting Started MapXtreme Licensing 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). Troubleshooting Licensing Problems Problem Description Possible Cause Solution "Licensing ErrorUnable to Initialize MILicensing object.
Chapter 2: Getting Started MapXtreme Licensing Troubleshooting Licensing Problems (continued) Problem Description Possible Cause A license exception occurs when using a trial version downloaded from the Pitney Bowes Software website (System.ComponentModel.Li censeException' occurred in mapinfo.coreengine.dll.) The MapXtreme trial license is invalid due to a detected system clock setback. Solution Install the trial on a different machine or purchase a valid license.
Chapter 2: Getting Started Before You Install Troubleshooting Licensing Problems (continued) Problem Description Possible Cause Moving a Virtual PC changes MapXtreme license node ID the network node ID and thus changes and causes Exponare license to revert to invalidates the license. trial license when a Virtual PC is moved. Directly after installation and first use, user gets the error message “Your MapXtreme trial license has expired”.
Chapter 2: Getting Started Before You Install IIS 7.x and IIS 6 Support MapXtreme supports web deployment under Internet Information Services (IIS) 6 and IIS 7. For IIS 6, the operating system requirement is Windows Server 2003. For IIS 7, the operating system requirement is Windows Vista, Windows Server 2008 or Windows 7. MapXtreme does not support web deployment on Windows XP. Throughout the Developer Guide references to IIS will refer to IIS 7.
Chapter 2: Getting Started Before You Install loaded into VS2010 with MXT 7.1 installed on your system. Initially, this property is commented out. Simply uncomment to make the proper edits for an application running in Integrated Pipeline mode in IIS7. Change the value to 'classic', or simply recomment the property, to comment out the system.webServer node for backwards compatibility with Classic Pipeline more or IIS6.
Chapter 2: Getting Started Installing MapXtreme in Your Environment Installing MapXtreme in Your Environment To install MapXtreme: 1. Place the MapXtreme product media in the disk drive. 2. At the CD Browser main page, click Install. The Install Description page appears. 3. Choose either Development Install to install the SDK or Deployment Install to install the runtime version. L The Deployment installation requires a runtime license. See Runtime Licenses for Deployment. 4.
Chapter 2: Getting Started Installing MapXtreme in Your Environment 7. At the Customer Information dialog box, enter your user name and company name in the appropriate fields and, if necessary, the product serial number which is located on the package. Click Next. The Setup Type dialog box appears. 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).
Chapter 2: Getting Started Installing MapXtreme in Your Environment 9. If you chose Custom in the previous step, select the components that you want to install, or click the Change button to specify a new installation path. Click Next. 10. At the Ready to Install the Program dialog box, click Install. 11. The Installing MapXtreme dialog box launches. MapXtreme v7.
Chapter 2: Getting Started Upgrading to MapXtreme 12. At the InstallShield Wizard Completed dialog box, uncheck the Launch Learning Resources checkbox if you do not wish to view the MapXtreme Learning Resources page, and then click Finish to leave the software installer. The MapXtreme Learning Resources page is available anytime from the Windows Start menu from an SDK installation It is not available for a runtime installation.
Chapter 2: Getting Started Migrating Web Sites to 64-bit Web Applications Updating Existing Web Sites Follow the instructions in this section if you wish to update a 32-bit MapXtreme Web Site to use the latest assemblies. In order to run a Web site created with a previous release of MapXtreme, you must edit your application’s Web.config file to point to the new versions of the assemblies. Assemblies are located in C:\Windows\Microsoft.NET\assembly\GAC_32. At a minimum, you must include MapInfo.CoreEngine.
Chapter 2: Getting Started Migrating Web Sites to 64-bit Web Applications Set Copy Local property to False Verify that the Copy Local property for your controls is set to False. There exists a known issue that when you drag and drop a MapXtreme desktop control onto a Windows form, references are loaded that have the Copy Local property set to True.
Chapter 2: Getting Started Creating Applications in Visual Studio Machine Configuration File Specifying redirection settings in the machine configuration file will cause all applications referencing the assembly to use the upgraded version. Use this method of redirection carefully, since the machine configuration file overrides settings in both the application configuration file and the publisher's policy file.
Chapter 2: Getting Started Creating Applications in Visual Studio 4. Choose an appropriate name and click OK. MapXtreme creates the application. Under Solution Explorer double-click MapForm.vb and MapForm.vb [Design] appears. 5. On the Debug menu, click Start Debugging to run the application. 6. Click the Open Table icon and load your data. The default location for sample data is Program Files\MapInfo\MapXtreme\7.x.x\Samples\Data. MapXtreme v7.
Chapter 2: Getting Started Creating Applications in Visual Studio 7. Use the controls in the toolbar to manipulate the map as you would with any other Pitney Bowes Software mapping application. ASP.NET Web Applications The following procedure outlines the steps to make a simple ASP.NET Web Application using the MapXtreme 7.1.0 Web Application template. The template is pre-configured for both IIS 6 and IIS 7. This example is specific to Visual Basic.NET. To create a Visual C# ASP.
Chapter 2: Getting Started Creating Applications in Visual Studio 5. Build the project. 6. On the Visual Studio Debug menu, click Start Debugging to run the application. 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.
Chapter 2: Getting Started Building ASP.NET Web Applications Without a Template 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.
Chapter 2: Getting Started Building ASP.NET Web Applications Without a Template 3. In this situation, you will notice that the MapXtreme web controls and tools will display red X’s 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. 4.
Chapter 2: Getting Started Deploying Your Application 7. Save Web.config.
Chapter 2: Getting Started Deploying Your Application 3. Follow the prompts to proceed with the installation. 4. Deploy your Windows or Web application as you wish (for example, create a deployment project in Visual Studio and add your application). 5. Install your runtime license file in the path \\Common Files\MapInfo\MapXtreme\7.x.x under Program FIles or Program Files(x86), depending on whether you are installing the 64-biti or 32bit runtime.
Chapter 2: Getting Started Deploying Your Application MapXtreme Merge Modules The following are the merge modules for MapXtreme. Include them as necessary in your installer MSI. See Packaging Your Desktop Application for more information on using merge modules. Note the 7.x.x in each MSM filename represents the current version of the product. MSMs are located in \Program Files\Common Files\Merge Modules.
Chapter 2: Getting Started Deploying Your Application Name of Merge Module 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.
Chapter 2: Getting Started Deploying Your Application Name of Merge Module WFS 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.
Chapter 2: Getting Started Deploying Your Application Deploying Applications that Access Data Any Visual Basic or Visual C# application that includes data access has a dependency on Microsoft Data Access Components (MDAC) version 2.7 or later. MDAC must be installed on a target computer prior to installing your application or the application will fail.
Chapter 2: Getting Started Deploying Your Application By default, MapXtreme applications look in the following directories for data files: • • Program Files\Common Files\MapInfo\MapXtreme\7.x.x—This is the directory the MapXtreme installer places these files. The directory where your application is located. For a Windows application, this is the directory where the .exe file is located. For web applications, this is the directory where the Web.config file is located.
Mapping Concepts Before you create a mapping application, it’s helpful to understand basic mapping concepts and how these concepts are implemented in MapXtreme. This chapter discusses the common concepts you will come across as you learn MapXtreme. At the end of this Developer Guide, we have provided Appendix L: Glossary containing mapping and programming terms that you will also find useful. In this chapter: Mapping and MapXtreme. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 3: Mapping Concepts Mapping and MapXtreme Mapping and MapXtreme The central element to a mapping application is the map. This chapter presents a short overview of the most important mapping terms that you will likely encounter while building your application with MapXtreme. The introductions also point you to the appropriate namespace in the MapXtreme object model so that you can quickly get the technical information you need.
Chapter 3: Mapping Concepts Mapping and MapXtreme 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.
Chapter 3: Mapping Concepts Mapping and MapXtreme Other text elements can also be used in a map to help deliver its message properly. Legends are cartographic elements that describe the features in a coded manner. For example, the legend may describe the boundaries as school districts, the lines as a power line network, or points as corporate office locations. Legends also contain a title to describe collectively what the map represents.
Chapter 3: Mapping Concepts Mapping and MapXtreme 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.
Chapter 3: Mapping Concepts Geocoding with MapXtreme A projection is a method of reducing the distortion that occurs when objects from a spherical surface are displayed on a flat surface. There are two main trade-offs to be considered: the preservation of equal area, and the preservation of the true shape of a feature. There are many different types of projections, each designed to reduce the amount of distortion for a given area.
Chapter 3: Mapping Concepts Routing with MapXtreme The MapXtreme framework provides classes for using a geocoding client that can access Pitney Bowes Software’s server geocoding products. For more information about geocoding see Chapter 18: Geocoding and the MapInfo.Geocoding namespace in the online Help (accessible via Visual Studio). Routing with MapXtreme Another component available to developers of MapXtreme is routing.
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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .67 Object Model Overview . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 4: Understanding the MapXtreme Architecture MapXtreme Architecture MapXtreme Architecture MapXtreme is built on top of Microsoft’s .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.
Chapter 4: Understanding the MapXtreme Architecture Object Model Overview Object Model Overview The MapXtreme Object Model is made up of many namespaces. A .NET namespace is a type classification system that differentiates specific classes, methods, and properties from others with the same name. By utilizing namespaces, .NET developers can avoid collisions between names of objects and their methods and properties.
Chapter 4: Understanding the MapXtreme Architecture Object Model Overview 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.
Chapter 4: Understanding the MapXtreme Architecture Object Model Overview MapInfo.Raster Namespace The MapInfo.Raster namespace exposes the full functionality of Pitney Bowes Software’s 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.
Chapter 4: Understanding the MapXtreme Architecture Application Architectures 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.
Chapter 4: Understanding the MapXtreme Architecture Web Application Architecture Web Application Architecture Architecture Description The Web application illustrated above takes into account the following components and capabilities: • • • • MapXtreme Web Application Microsoft .
Chapter 4: Understanding the MapXtreme Architecture Web Application Architecture Build views by dragging and dropping MapXtreme web controls onto a Visual Studio web form. Build your internal data structures and interact with external data sources, base maps and dynamic content by using objects under MapInfo.Engine and MapInfo.Data namespaces.
Chapter 4: Understanding the MapXtreme Architecture Desktop Application Architecture Desktop Application Architecture 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.
Web Applications, Controls, and Tools This chapter brings together a host of information related to building ASP.NET web applications using the web controls, tools, and conveniences provided with MapXtreme. In this chapter: Web Application Request/Response Lifecycle . . . . . . . . . . . . . . .76 Components of a MapXtreme Web Application. . . . . . . . . . . . . . .76 MapXtreme Web Controls and Tools . . . . . . . . . . . . . . . . . . . . . . .80 Web Control Architecture . .
Chapter 5: Web Applications, Controls, and Tools Web Application Request/Response Lifecycle Web Application Request/Response Lifecycle In order to plan and build an effective web application, you need a solid understanding of the behind the scenes interactions between the client (browser) and the server (web application). In its simplest form, a web application is a software application that is accessed through a web browser over an Internet or intranet connection.
Chapter 5: Web Applications, Controls, and Tools Components of a MapXtreme Web Application 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.
Chapter 5: Web Applications, Controls, and Tools Components of a MapXtreme Web Application Figure: a MapXtreme Web Application View at Design Time MapXtreme v7.
Chapter 5: Web Applications, Controls, and Tools Components of a MapXtreme Web Application Figure: a MapXtreme Web Application View at Run Time 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.
Chapter 5: Web Applications, Controls, and Tools MapXtreme Web Controls and Tools State Management and Pooling Capabilities One of your goals in building a MapXtreme web application is to make it stable, scalable and offer a satisfying experience for your users. MapXtreme provides configurations to help you manage the state of your application, and allow it to grow with the numbers of users. The MapXtreme web application template and the sample applications are configured to manage state manually.
Chapter 5: Web Applications, Controls, and Tools MapXtreme Web Controls and Tools These JavaScript-enabled tools do not trigger a full page postback with each use. Typically, only the image of the map is refreshed after each tool use. See Map Tools Architecture for an understanding of this development model. See Managing Your Web Controls for information on event handling, error management and state management. Previous MapXtreme controls (pre-v6.
Chapter 5: Web Applications, Controls, and Tools MapXtreme Web Controls and Tools LegendControl The LegendControl allows you to display a legend for a given MapControl. The legend that is returned is a non-interactive image. The default export format is .GIF. The legend to display can be specified at design time using its LegendAlias or its index in the map's legend list. This can also be set using JavaScript on the page. JavaScript can also be used to show and hide the legend.
Chapter 5: Web Applications, Controls, and Tools Web Control Architecture ZoomBarTool Allows you to zoom a map to a series of preset levels between 500 and 12,500 map units. ZoomInTool Allows you to zoom a map by either a single click or by selecting a rectangular area ZoomOutTool Allows you to draw a rectangle representing the view to zoom out of the map. InfoTool Sample Web Application An example of an InfoTool is included in the sample Web applications.
Chapter 5: Web Applications, Controls, and Tools Web Control Architecture The MapXtremeWebResources folder included with the Visual Studio MapXtreme Web templates contains dependencies for the web controls and map tools. Make sure to include these files when deploying an application. Map Tools Architecture MapXtreme map tools are used to interact in some way with the map, such as panning to a different view or selecting an area of the map to collect data for further analysis.
Chapter 5: Web Applications, Controls, and Tools Web Control Architecture The client Command generates a URL request that is sent to the server, which then processes the response to display the new map. The interaction object can be null. This means there is no client side interaction, such as pan, zoom, point select, that will fire off the command automatically. The command can still be fired, but it would have to be done programmatically. Server Side Command Architecture On the server, the MapInfo.
Chapter 5: Web Applications, Controls, and Tools Using the MapXtreme Web Controls 2. The tool’s ClientInteraction property called RectInteraction collects the screen coordinates that define the rectangle. RectInteraction is defined in Interaction.js. 3. The tool’s ClientCommand property MapCommand creates a URL request and assigns it to the MapControl’s image.src property. ClientCommand is defined in Command.js. The URL request looks like: MapController.
Chapter 5: Web Applications, Controls, and Tools Managing Your Web Controls If your application requires multiple maps, they can exist in one or more workspaces, each with a unique MapAlias property. To preload more than one workspace in the Web.config file, use a semicolon between the full path of each workspace. 3.
Chapter 5: Web Applications, Controls, and Tools Creating a Custom Tool The Global.asax files provided with our sample applications demonstrate an example of handling application errors. If the application encounters an error while processing a request for a map image, the Application_Error method creates an image containing an error message, and returns that to the client. For more information on Error Management, refer to the MSDN site on error handling with ASP.NET. State Management The MapInfo.
Chapter 5: Web Applications, Controls, and Tools Creating a Custom Tool 1. Drag the generic WebTool from the MapXtreme toolbox onto your web form. You can also use one of the existing map tools if you want to extend the existing behavior. 2. In the WebTool property page, set the properties for MapControlID, InActive/ActiveImageUrl and CursorImageUrl. 3. Set the appropriate ClientInteraction property by selecting from the drop-down list.
Chapter 5: Web Applications, Controls, and Tools Using and Distributing Custom Web Controls MapInfo.WebControls.MapControlModel controlModel = MapControlModel.SetDefaultModelInSession(); controlModel.Commands.Add(new AddPinPointCommand()); 10. Add the tool to the Visual Studio toolbox by creating a new assembly. See Using and Distributing Custom Web Controls. 11.
Chapter 5: Web Applications, Controls, and Tools Using and Distributing Custom Web Controls • The following files are used by the Web controls: • *.GIF images that represent tool actions (for example, DistanceToolControlActive, DistanceToolControlInactive). • *.BMP images that represent tool icons (for example, label, selection arrow) • JavaScript defining tool interactions and behaviors (Interaction.js, Command.js, LayerControl.js, LegendControl.js and Tool.js) • *.
Chapter 5: Web Applications, Controls, and Tools Adding an InfoTool to a Web Application Adding an InfoTool to a Web Application MapXtreme provides a sample application for an InfoTool that can be adapted and used in a web application. Use this tool to capture information at the point a user clicks on the map and get information returned from the web application. Follow these steps to modify the InfoTool sample. 1.
Chapter 5: Web Applications, Controls, and Tools ASP.NET AJAX and MapXtreme Web Applications MapXtreme provides a sample application that demonstrates how to use Microsoft's ASP.NET AJAX controls in a MapXtreme web mapping application. The sample is located in ..\MapInfo\MapXtreme\7.x.x\Samples\VisualStudio2005\Web\Features. L The AJAXDemo sample requires that the Microsoft ASP.NET AJAX Extensions 1.0 or later be installed on your system.
Chapter 5: Web Applications, Controls, and Tools MapXtreme Tile Handler If any of those first four httpHandlers entries are missing from your Web.config file, copy the missing entries from the AJAXDemo Web.config file, and paste them into your Web.config file. (It is not necessary to copy the LayerController.
Chapter 5: Web Applications, Controls, and Tools MapXtreme Tile Handler contain information exclusive to the user, such as information returned from a query, these maps are generated on the fly. Because they are tiled, only the tiles that would be visible in the map window (based on the tile size, map window size and zoom level) would be returned.
Chapter 5: Web Applications, Controls, and Tools MapXtreme Tile Handler "Map2Alias", "Map3Alias" ] } 4. Using the listed map names from step 3, request more information about a map using the following URL format: http://server/TileServer/{mapname}/description.{ext} where mapname is the name of the map on the Tile Server to get metadata about. The value is case-insensitive.
Chapter 5: Web Applications, Controls, and Tools MapXtreme Tile Handler Argument Description TileServer The path to your instance of the MapTiling handler. This must match the beginning of the "path" entries in the "httpHandlers" section of your web.config. See above. mapname The name of the map on the Tile Server. level The level of requested tiles. Zero-based. x;y The x and y ordinates of the requested tile (zerobased). For example, at level 3 the map consists of 64 tiles in 8 rows and 8 columns.
Chapter 5: Web Applications, Controls, and Tools HTML/XHTML Validation Issues Server Specifies that the response is cached only at the origin server. Similar to the NoCache option. Clients receive a Cache-Control: nocache directive but the document is cached on the origin server. Equivalent to ServerAndNoCache. 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.
Chapter 5: Web Applications, Controls, and Tools Migrating Post-back Web Controls to JavaScript Web Controls The id attribute that causes this validation error is not output by MapXtreme; it is an attribute that is output by ASP.NET. To resolve this validation error, you may need to replace the DOCTYPE tag on your .aspx page. Specifically, if you update your DOCTYPE tag to an XHTML DOCTYPE tag, the resulting page will validate, even with the id attribute shown above. (ASP.
Chapter 5: Web Applications, Controls, and Tools Specialized Topics for Web Controls 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.
Chapter 5: Web Applications, Controls, and Tools Specialized Topics for Web Controls ' If the StateManager doesn't exist in the session put it in, else get it. If StateManager.GetStateManagerFromSession() Is Nothing Then StateManager.PutStateManagerInSession(New AppStateManager()) End If Using the MapControl in Table Cells Due to HTML behavior, as soon as an element is dragged out of another element, it is resized to a basic size (mainly 0).
Understanding State Management This chapter describes concepts and best practices for state management—a subject of great importance when writing web applications. In this chapter: Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .103 Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .103 What is State Management? . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105 InProc Development Model .
Chapter 6: Understanding State Management Overview 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.
Chapter 6: Understanding State Management Terminology Application State - An ASP.NET-defined mechanism for storing state information in memory that applies to all users and sessions of a web application. See the ASP.NET Application State Overview at http://msdn2.microsoft.com/en-us/library/ms178594.aspx. See also Handling Initial Requests on page 125. User state - The saved state of the MapXtreme Session and application state between user requests.
Chapter 6: Understanding State Management What is State Management? What is State Management? Many types of web applications need to perform state management—the process of saving and restoring information about what state, or condition, each user's session is in. For example, when a retail web application provides a shopping cart, the application must remember the state of each user's shopping cart.
Chapter 6: Understanding State Management What is State Management? The earlier you identify the number of users your web application will have, the better off you are. If you develop and test an application with a very small number of users (as a pilot project perhaps), then later on you might discover that your application does not perform well when there are many users.
Chapter 6: Understanding State Management InProc Development Model This tag instructs the MapXtreme Session to load this workspace whenever a new instance of the Session is created. How Will Users be Allowed to Modify the Map? Most web applications allow the user to click, drag, or perform other actions that modify the map in some way.
Chapter 6: Understanding State Management InProc Development Model You might find it helpful to think of a web application as being analogous to a restaurant. Web applications need to service simultaneous requests from multiple users, just as restaurants need waiters to take food orders from multiple tables. The InProc model is analogous to a restaurant that hires one waiter per table. It would be expensive for a restaurant to employ one waiter per table.
Chapter 6: Understanding State Management InProc Development Model 7. The user clicks on the Select tool, and then clicks on the portion of the map that shows Australia. 8. On the server, the application performs a selection: to select the Australia region. A new map image is rendered, to display the new selection. There are now two ways the Map's status has changed from its original state: Its center and zoom changed (in step 6), and now there is a Selection. 9.
Chapter 6: Understanding State Management State Management For Pooled Objects Once you decide to follow this option of an InProc session, each user who accesses your web site will be given a copy of the MapXtreme Session object and all it contains. Obviously if the number of users grows, then so will the memory footprint. Your application will also load the workspace defined in the Web.config each time a MapXtreme Session is created.
Chapter 6: Understanding State Management State Management For Pooled Objects This diagram represents an application that has a COM+ pool of two MapXtreme Session objects, being accessed by three users (web clients). Whenever a client submits a request, the request will be serviced by one of the two MapXtreme Session objects. In this model, no client has its own dedicated MapXtreme Session. Instead, MapXtreme Session objects are shared and re-used. The following sequence of events is possible: 1.
Chapter 6: Understanding State Management State Management For Pooled Objects Saving State for Pooled Applications The pooled development model offers you two options for managing the state of your pooled objects. You can use automatic state management, and have MapXtreme take care of the current user state, or you can use manual state management and control the changes that must be saved and restored for each user.
Chapter 6: Understanding State Management State Management For Pooled Objects There are four possible beginning states that your application must handle. Each situation involves a user condition and a MapXtreme Session state. User is... MapXtreme Session in the Pool is.... New to the site Clean * New to the site Dirty† Returning to the site Clean * Returning to the site Dirty† * † MapXtreme Session and its background map are in their initial state.
Chapter 6: Understanding State Management State Management For Pooled Objects 9. The application modifies the Map object's Zoom property so that it is zoomed into Australia. The application renders a new map image and streams the image to the client browser. Again, the application saves the user's state at the end of the request. 10. The user clicks on the Select tool, and then clicks on the Australia region of the map, to select Australia. 11.
Chapter 6: Understanding State Management A Detailed Look at Manual State Management 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.
Chapter 6: Understanding State Management A Detailed Look at Manual State Management 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.
Chapter 6: Understanding State Management A Detailed Look at Manual State Management • • • MapInfo.Engine.Session.Pooled: Because this key has a value of "true", MapXtreme Session objects are pooled by the COM+ service. When a new MapXtreme Session is retrieved upon a new client request, the Session could be "clean" - a new object just created - or it could be a "dirty" object which has already been used to handle a previous request.
Chapter 6: Understanding State Management A Detailed Look at Manual State Management The RestoreState and SaveState methods are used as follows: 1. Each time a client submits a request, the Page_Load method calls RestoreState. RestoreState is also called each time a map tool is used on the client.
Chapter 6: Understanding State Management A Detailed Look at Manual State Management 3. At the end of the request processing cycle the Page_Unload method calls SaveState. SaveState is also called after a map tool is used on the client. The SaveState method saves the map's latest state, so that when and if the user submits yet another request, that request will be able to call RestoreState again.
Chapter 6: Understanding State Management A Detailed Look at Manual State Management Automatically Deserializing MapXtreme Objects In the SaveState method, we identify the objects to be saved using specific references, such as a specific layer in the map: ManualSerializer.SaveMapXtremeObjectIntoHttpSession(map.Layers(SampleCons tants.ThemeLayerAlias), "theme_layer") The RestoreState method, however, does not reference the Catalog or the map.Layers collection.
Chapter 6: Understanding State Management A Closer Look at the MapXtreme Session 3. Next, in the Page_Load method, we make a call to RestoreState to check whether this is the first request for this application. If this is the first request for the application, we call SaveDefaultState method to set various properties on the map to their initial state and we call a ManualSerializer method, to store this initial map state in a byte array into HttpApplicationState.
Chapter 6: Understanding State Management A Closer Look at the MapXtreme Session Configuring Microsoft COM+ Object Pooling The MapXtreme Session object is registered with the COM+ services on your system. This system handles configuration and activation of any registered pooled objects. The runtime installer has the logic to register and create default settings for the MapInfo Session object. By default the MapXtreme Session object is configured with two pooled objects and a 60 second time-out.
Chapter 6: Understanding State Management A Closer Look at the MapXtreme Session When the application starts, a request is made to the application pool for a MapXtreme Session object. The COM+ pool then creates the number of pooled objects you specified in the control panel Component Services dialog box. This MapXtreme Session object reads the Web.config file, and the specified workspace is loaded before your application gets an instance from the pool.
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: Planning a Desktop Application . . . . . . . . . . . . . . . . . . . . . . . . . .125 MapInfo.Windows.Controls Namespace . . . . . . . . . . . . . . . . . . .126 Key Controls to Use in Desktop Applications . . . . . . . . . . . . . . .128 MapInfo.
Chapter 7: Desktop Applications, Controls, Dialogs, and Tools Planning a Desktop Application Planning a Desktop Application MapXtreme is a .NET-based object model that exposes mapping functionality to any .NET-based development work. There are many emerging technologies that can be used to develop applications using the .NET framework. Desktop applications provide a rich tool interaction for the user.
Chapter 7: Desktop Applications, Controls, Dialogs, and Tools MapInfo.Windows.Controls Namespace .NET common language runtime (CLR) environment, making the COM object appear to .NET clients as if it were a native .NET object and making the .NET client appear to the COM object just as if it were a standard COM client. You can create references to these COM object directly from Visual Studio for instance, and simply interact with them just as you would with a .NET class. This allows you to build your .
Chapter 7: Desktop Applications, Controls, Dialogs, and Tools MapInfo.Windows.Controls Namespace However, the controls in each namespace cannot be substituted for each other. The controls in this namespace are specifically to be used in desktop applications. For information about controls for web-based applications, seeChapter 5: Web Applications, Controls, and Tools. L Some controls do not display at design time. When dragged and dropped onto a form they merely appear as a rectangle.
Chapter 7: Desktop Applications, Controls, Dialogs, and Tools Key Controls to Use in Desktop Applications Key Controls to Use in Desktop Applications While all the controls included in MapXtreme are useful, several stand out from the rest as being central to most mapping applications. The following sections discuss these. Each of these controls assume the presence of the appropriate references included in your project.
Chapter 7: Desktop Applications, Controls, Dialogs, and Tools Key Controls to Use in Desktop Applications A Form showing a MapControl, a Layer Control, and a MapToolBar The MapControl also has several properties relating to the loaded map that can be preset so that the map shown at run time is further customized for the specific application. Properties that can be modified include zoom level, coordinate system, map center, and settings for three mouse buttons during run time.
Chapter 7: Desktop Applications, Controls, Dialogs, and Tools Key Controls to Use in Desktop Applications 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.
Chapter 7: Desktop Applications, Controls, Dialogs, and Tools Key Controls to Use in Desktop Applications To add tool buttons to the MapToolBar: 1. Open the ToolBarButton Collection Editor by clicking on the ellipsis (...) next to the Buttons property in the Properties window. The ToolBarButton Collection Editor appears. 2. Click the Add button. This creates a new MapToolBarButton below the last one in the list.
Chapter 7: Desktop Applications, Controls, Dialogs, and Tools Key Controls to Use in Desktop Applications 5. Click OK. The MapToolBarButton is now created and added to the button bar. The newly added tool works in the default manner. Adding Custom Buttons to a ToolBar This procedure assumes you have created a custom tool and added it to the MapControl.Tools collection.
Chapter 7: Desktop Applications, Controls, Dialogs, and Tools Key Controls to Use in Desktop Applications 7. In the form's constructor, after the InitializeComponent call, add code to add a custom bitmap to the MapToolBar's ImageList. How the custom bitmap is associated with the application is up to the programmer. One option is to add an ImageList to the form at design-time, populate it with the custom images, then write code to transfer its images to the toolbar's ImageList at runtime.
Chapter 7: Desktop Applications, Controls, Dialogs, and Tools MapInfo.Windows.Dialogs Namespace Customizing Context Menus You can create customized context menu items for your Layer Control that appear when the user right-clicks a node in the layer tree. Use the ContextMenuTargetObject property to return the object that the user right-clicked. A code sample has been provided that shows how to define a LayerControlEnhancer class that allows a user to add custom items to the Layer Control's context menu.
Chapter 7: Desktop Applications, Controls, Dialogs, and Tools MapInfo.Windows.Dialogs Namespace 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.
Chapter 7: Desktop Applications, Controls, Dialogs, and Tools MapInfo.Windows.Dialogs Namespace If the user chooses a single variable theme type (Ranged, Dot Density, Individual Value, or Graduated Symbol) the second dialog box displayed allows them to choose a table and single column.
Chapter 7: Desktop Applications, Controls, Dialogs, and Tools MapInfo.Windows.Dialogs Namespace Create Theme: Step 3 of 3 dialog box (Ranged Theme) The dialog box shows the default theme distribution method: EqualRangeSize. The corresponding name of the distribution method in the user interface of the wizard is Equal Ranges. When a user make a change in the Settings tab, such as changing the number of ranges, the Recalculate Theme button is activated.
Chapter 7: Desktop Applications, Controls, Dialogs, and Tools MapInfo.Windows.
Chapter 7: Desktop Applications, Controls, Dialogs, and Tools Customizing Controls and Dialog Boxes Methods Once the wizard is created, call the CreateTheme() method from the CreateThematicWizard class to create the theme. An optional string parameter can be added to set the theme’s alias.
Chapter 7: Desktop Applications, Controls, Dialogs, and Tools Overview of the MapInfo.Tools Namespace An example of customizing a dialog box is as follows: The LineStyleDlg class creates a Line Style Dialog Box. This dialog box can be created in either a sparse style mode (where nothing is selected when opened), or in a mode where some choices are visible but not enabled (grayed out). The customization provided by setting property values is obviously limited to the specific dialog object being modified.
Chapter 7: Desktop Applications, Controls, Dialogs, and Tools MapXtreme Desktop Tools API For an example of using the desktop tools programmatically, see the sample application under ..\MapInfo\MapXtreme\7.x.x\Samples\Desktop\Features\DesktopTools under your installation of MapXtreme. MapXtreme Desktop Tools API The diagram below shows a UML representation of the MapTool class. Tools are ultimately derived from the MapTool class.
Chapter 7: Desktop Applications, Controls, Dialogs, and Tools MapXtreme Desktop Tools API 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.
Chapter 7: Desktop Applications, Controls, Dialogs, and Tools MapXtreme Desktop Tools API Dynamic Selection shows what objects can be in the selection as the mouse is being moved when using the SelectRectMapTool, SelectRadiusMapTool, and the SelectPolygonMapTool. The selection map tools have properties to set various options, including which layers are selectable. These default tool properties can be set on the MapTools collection which can be found in MapInfo.Windows.Controls.MapControl.Tools.
Chapter 7: Desktop Applications, Controls, Dialogs, and Tools MapXtreme Desktop Tools API 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).
Chapter 7: Desktop Applications, Controls, Dialogs, and Tools MapXtreme Desktop Tools API the mouse button creates the Circle. If the Ctrl key is pressed while dragging, the Circle is drawn from perimeter point to perimeter point. Pressing the Esc key before releasing the mouse cancels the operation. Rectangle Tools The tools included in this group are AddRectangleMapTool and CustomRectangleMapTool. These tools draw a Rectangle.
Chapter 7: Desktop Applications, Controls, Dialogs, and Tools Customizing Tools 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.
Chapter 7: Desktop Applications, Controls, Dialogs, and Tools Tool Events Tool Events The MapInfo.Tools namespace supports tool events with information and the ability to cancel the tool’s operation. A Select Tool’s 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.
Chapter 7: Desktop Applications, Controls, Dialogs, and Tools Editing a FeatureGeometry with the Select Tool Editing a FeatureGeometry with the Select Tool The following section shows you how to edit features by reshaping and adding nodes to a FeatureGeometry. It illustrates the use of a MapControl, LayerControl and the Select tool. See also MapControl on page 135 and Layer Control on page 140. Reshaping a Feature 1. Load a map into the MapControl and zoom in on the Feature you wish to modify. 2.
Chapter 7: Desktop Applications, Controls, Dialogs, and Tools Editing a FeatureGeometry with the Select Tool 5. Select the root node of the map in the layer control tree view. 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.
Chapter 7: Desktop Applications, Controls, Dialogs, and Tools Editing a FeatureGeometry with the Select Tool 8. Using the Select Item tool, select the polygon you want to modify, then click and drag on a node to change its position. Use the Shift key to select a range of nodes and the Ctrl key to toggle the selected state of a node. Adding Nodes To add nodes to a Feature Geometry: 1. Open the LayerControl again and select the root node of the map. 2.
Chapter 7: Desktop Applications, Controls, Dialogs, and Tools Editing a FeatureGeometry with the Select Tool Reshaping and Adding Nodes Programmatically This section describes how to reshape and add nodes programmatically. Code is provided in C# and VB. 1. Add a button named "btnEditNodeTool" to the main form in the Visual Studio designer. 2. Double-click the button to open the button's handler in the code page.
Working with Data The MapInfo.Data namespace contains the classes and interfaces that provide multiple ways of accessing data from a MapXtreme application. In this chapter: Overview of MapInfo.Data Namespace. . . . . . . . . . . . . . . . . . . . .160 Catalog and Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .161 Supported Table Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166 Working with Catalog and Tables . . . . . . . . . . .
Chapter 8: Working with Data Overview of MapInfo.Data Namespace Overview of MapInfo.Data Namespace The MapInfo.Data namespace contains the classes and interfaces that provide multiple ways of accessing data from a MapXtreme application. Within this namespace is the MapInfo ADO.NET data provider with a MapInfo SQL language for standard querying of databases and tables. The Feature object model is another way to access data that uses objects instead of SQL.
Chapter 8: Working with Data Catalog and Tables Following this chapter are two additional chapters related to data access: Chapter 10: Creating Expressions, and Chapter 11: Accessing Data from a DBMS. Catalog and Tables Catalog is the manager of the MapXtreme data access model. Tables are a fundamental unit of MapXtreme. Tables hold the data that you want to display and analyze in your application. The Catalog, as manager, holds a list of tables that are currently open in the session.
Chapter 8: Working with Data Catalog and Tables Supported data types include: Data Type 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 Provides a floating point number which is treated internally the same as a Double.
Chapter 8: Working with Data Catalog and Tables Data Type 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. * † ‡ To ensure backward compatibility with earlier versions of MapXtreme, the MapInfo.Data.MIDataReader.GetDateTime method works with both the DateTime and Date types.
Chapter 8: Working with Data Catalog and Tables Return Column Type and Value Changes in Remote Databases The addition of the new data types has prompted some changes to the return column types and values for remote databases. The table below shows the return column type and value for MapXtreme 6.7.x and MapXtreme 6.8 for the supported types in each remote database. Server / Data Type MapXtreme 6.7.x Return Column Type / Value MapXtreme 6.8.
Chapter 8: Working with Data Catalog and Tables Table tab = MapInfo.Engine.Session.Current.Catalog.GetTable("MapViewer"); TableInfo ti = TableInfoFactory.CreateTemp("Test", ((MapInfo.Data.GeometryColumn)tab.TableInfo.Columns["Obj"]).CoordSys); Table tabTemp = MapInfo.Engine.Session.Current.Catalog.CreateTable(ti); MIConnection conn = new MIConnection(); conn.Open(); MICommand comm = conn.CreateCommand(); comm.CommandText = "Insert Into " + tabTemp.
Chapter 8: Working with Data Supported Table Types VB example: Public Shared Sub MapInfo_Data_Catalog() ’ Catalog is accessible off the Session object Dim catalog As Catalog = Session.Current.Catalog ’ Open a bunch of tables Dim table As Table = catalog.OpenTable("States.tab") table.SessionInfo.ReadOnly = True ’ Make states ReadOnly table = catalog.OpenTable("world.tab") table = catalog.OpenTable("worldcap.
Chapter 8: Working with Data Supported Table Types ASCII 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 Microsoft Access database table. This file-based table located inside of a Microsoft Access .MDB database may have an associated .
Chapter 8: Working with Data Supported Table Types ADO.NET A table of non-spatial data that is based upon an ADO.NET DataTable or IDbCommand. This table type supports many different data providers with providerspecific implementations. ADO.NET is the choice when there is no MapXtreme supported data provider. ADO.NET is designed to support both Connected (IDBCommand) and Disconnected (DataTable) ADO.NET models. IDBTables are read-only. Cache may be applied forcibly (implicit keys).
Chapter 8: Working with Data Working with Catalog and Tables View A view based on a MapInfo SQL Select statement (not a native SQL supported by Server tables). See View Tables. ResultSet A table containing the results of a search. ResultSet is used exclusively for IResultSetFeatureCollections. See Result Sets.
Chapter 8: Working with Data Working with Catalog and Tables 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.
Chapter 8: Working with Data Working with Catalog and Tables • • • • • • 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.
Chapter 8: Working with Data Table Metadata (TableInfo) Table Metadata (TableInfo) The TableInfo class in the MapInfo.Data namespace is an abstract base class that contains information, or metadata, about an existing table, including: • • • Columns – number, names, data types, etc. Table alias, and description and pathname of the data source. Client metadata (the information between the begin_metadata/end_metadata tags in the TAB file). TableInfo is used to open tables and create new tables.
Chapter 8: Working with Data Table Metadata (TableInfo) Examining TAB File Metadata TAB file metadata is accessible and editable. The TableInfo class can be obtained from the Table to get information about the table structure. The following code demonstrates how to get the metadata for an open table. The code also demonstrates how the geometry column can be used to determine the coordinate system and bounds of the table. For a code example that returns M and Z values, see MapInfo.Data.
Chapter 8: Working with Data Table Metadata (TableInfo) Note the use of the ColumnFactory class. This is provided to help you know which arguments are necessary for different data types. For example, a geometry column requires a coordinate system. VB example: Public Shared Sub MapInfo_Data_TableInfoNative() Dim ti As TableInfoNative = New TableInfoNative("NewTable") ti.TablePath = "c:\data\Capitals.TAB" ti.Columns.Add(ColumnFactory.CreateIndexedStringColumn("Capital",_ 25)) ti.Columns.Add(ColumnFactory.
Chapter 8: Working with Data Table Metadata (TableInfo) col = New Column col.Alias = "FDouble" col.DataType = MIDbType.Double ti.Columns.Add(col) col = New Column col.Alias = "FDateTime" col.DataType = MIDbType.Date ti.Columns.Add(col) col = New Column col.Alias = "FBoolean" col.DataType = MIDbType.Boolean ti.Columns.Add(col) ’ Note we do not need to (nor should we) add a column of type Key. ’ Every table automatically contains a column named "MI_Key". Dim miTable As Table = conn.Catalog.
Chapter 8: Working with Data Table Metadata (TableInfo) 7, 0") ti.Columns.Add(ColumnFactory.CreateFeatureGeometryColumn(Robinson)) ' Note we do not need to (nor should we) add a column of type Key. ' Every table automatically contains a column named "MI_Key". Dim table As Table = Session.Current.Catalog.CreateTable(ti) End Sub Adding Expression Columns to a Table Use the MapInfo.Data.Table.AddColumns method to add expression columns to a table.
Chapter 8: Working with Data Table Metadata (TableInfo) 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.
Chapter 8: Working with Data Table Metadata (TableInfo) Methods for Accessing Data MapXtreme provides several ways to bring data into the Catalog: • • • Direct access to data sources Access via an ADO.NET data provider (TableInfoAdoNet) XML/GML from third-party web services 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.
Chapter 8: Working with Data Table Metadata (TableInfo) Data from Third-Party Web Services MapXtreme can integrate Web service XML or GML output into the Catalog for use in a MapXtreme desktop or web application. Data can be brought into the Catalog and converted to a MultiPolygon, LineString, Point, or other Geometry via the MapXtreme API. MapXtreme then turns the Geometry into a FeatureCollection, and, in turn, saves it to a memTable or native TAB format.
Chapter 8: Working with Data Table Metadata (TableInfo) it is important to get the string length correct. The DataColumn has a MaxLength property that should be set to indicate the maximum length string the column could hold. If not set, this value defaults to -1 in which case the value of 254 is used. Before checking the MaxLength property, the Catalog looks to see if the DataColumn has a property defined in its ExtendedProperties collection with the name “StringWidth”.
Chapter 8: Working with Data Table Metadata (TableInfo) 1. In the MapInfo.WebControls.StateManager.SaveState method: a. Place the ADO.NET DataTable or DataSet into the HTTPSession instance. b. Save any MapInfo.Data.TableInfoView or MapInfo.Data.TableInfoResultSet tables that are dependent on the ADO.NET table using the ManualSerializer.SaveMapXtremeObjectIntoHttpSession. c. Close the ADO.NET table in the Catalog. 2. In the MapInfo.WebControls.StateManager.RestoreState method: a.
Chapter 8: Working with Data Table Metadata (TableInfo) has no ability to modify the IDbCommand object to fetch a specific record. Thus, a second IDbCommand object must be supplied for this purpose. The “FetchByKey” IDbCommand object must meet the following requirements: • • 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.
Chapter 8: Working with Data Table Metadata (TableInfo) ti.KeyColumns = sc ti.KeyType = KeyType.Explicit ' Ask the Catalog to open the table. Dim tbl As Table = connection.Catalog.OpenTable(ti) ' Now the MICommand object may be used to select data from the table ' (by the name EuropeanCities since that is the alias we assigned to ' it).
Chapter 8: Working with Data Table Metadata (TableInfo) Dim ti As TableInfoServer = New TableInfoServer("StateCapXY",_ "SRVR=tempest;UID=tn;PWD=tn", "Select * from usa_caps", _ MapInfo.Data.ServerToolkit.Oci) Dim StateCapXY As Table = Connection.Catalog.OpenTable(ti) ' Add the Oracle columns to the USA table Dim states As Table = Connection.Catalog.GetTable("usa") states.AddColumns(Nothing, MapInfo.Data.BindType.Static, _ StateCapXY, "state", MapInfo.Data.Operator.
Chapter 8: Working with Data Table Metadata (TableInfo) 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.
Chapter 8: Working with Data Table Metadata (TableInfo) AutoMatching Using the GeoDictionary The MatchResolver.AutoMatch method in the Data.GeoDictionary namespace initiates the AutoMatching process. It does not call AddColumns, i.e., does not do the binding. A subsequent call to BindColumn is required to perform the autobinding, or a direct call to AutoMatchAndBind. Automatching can encounter ambiguous situations.
Chapter 8: Working with Data Table Metadata (TableInfo) VB example: Public Shared Sub MapInfo_Data_SpatialSchemaXY() Dim ti As TableInfo = _ TableInfo.CreateFromFile("c:\data\customers.TAB") ' a non-mappable table Dim xy As SpatialSchemaXY = New SpatialSchemaXY xy.XColumn = "Xcoord" xy.YColumn = "Ycoord" xy.NullPoint = "0.0, 0.0" ' Any customer at 0,0 means we don't know their location. xy.StyleType = StyleType.None xy.CoordSys = _ Session.Current.CoordSysFactory.CreateLongLat(DatumID.WGS84) ti.
Chapter 8: Working with Data Table Metadata (TableInfo) For more information and code examples, see the MapInfo.Data.SpatialSchemaPointRef class in the Developer Reference Help system. VB example: Public Shared Sub MapInfo_Data_SpatialSchemaPointRef(ByVal _ map As _Map) ' a non-mappable table Dim ti As TableInfo = _ TableInfo.CreateFromFile("c:\data\customers.TAB") Dim pr As SpatialSchemaPointRef = New SpatialSchemaPointRef pr.CoordSys = map.GetDisplayCoordSys() pr.StyleType = StyleType.None pr.
Chapter 8: Working with Data MapInfo ADO.NET Data Provider MapInfo ADO.NET Data Provider MapXtreme provides mechanisms for issuing SQL commands which return record sets from tables using ADO.NET. The MapInfo ADO.NET Data Provider is one mechanism for accessing data in .NET applications in this fashion. For an alternative that uses the Feature class and SearchInfo methods on the Catalog, see Features and Feature Collections.
Chapter 8: Working with Data MapInfo ADO.NET Data Provider command.CommandText = "Select * From States Where Pop > 1000000" connection.Open() Dim reader As MIDataReader = command.ExecuteReader() Dim i As Integer, n As Integer = reader.FieldCount For i = 0 To n - 1 Step i + 1 Console.Out.Write("{0}\t", reader.GetName(i)) Next Console.Out.WriteLine() While reader.Read() For i = 0 To n - 1 Step i + 1 Dim o As Object = reader.GetValue(i) If o Is DBNull.Value Then Console.Write("null\t") Else Console.
Chapter 8: Working with Data MapInfo ADO.NET Data Provider Insert INSERT [INTO] { table_name } [ ( column_list ) ] { VALUES ({expression | NULL}[, ...n]) | query_specification Update UPDATE { table_name } SET {{ column_name } = { expression | NULL }} [, ...n] [WHERE < search_condition > ] Delete DELETE [FROM] { table_name } [ WHERE < search_condition > ] < search_condition > ::= { [ NOT ] < predicate > | ( < search_condition > ) } [ { AND | OR } [ NOT ] { < predicate > | ( < search_condition > ) } [ ,...
Chapter 8: Working with Data MapInfo ADO.NET Data Provider 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.
Chapter 8: Working with Data Features and Feature Collections 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.
Chapter 8: Working with Data Features and Feature Collections You can force a Load using the Load method. Changes made to the Feature are not reflected in the underlying table (if there is one) until the Feature is saved back to the table. This is done using the Update method, or UpdateFeature or InsertFeature. You can throw away any edits done to the Feature object before it is saved using the DiscardEdits method. A Feature has a schema that describes the attributes of the Feature.
Chapter 8: Working with Data Features and Feature Collections // Using SQL command.CommandText = "Select Obj From States Where state = ‘NY’; FeatureGeometry nyGeom = command.ExecuteScalar() as FeatureGeometry; command.CommandText = "SELECT * FROM Cities WHERE Obj within @newyork"; command.Parameters.Add("@newyork", nyGeom); MIDataReader reader = command.ExecuteReader(); // or… to get a FeatureCollection IFeatureCollection fc = command.ExecuteFeatureCollection(); // Using Features Feature fNY = catalog.
Chapter 8: Working with Data Features and Feature Collections ' Set the map view to show search results MapInfo.Engine.Session.Current.MapFactory(0).SetView(fc.Envelope) ' Set the view of the first map. ' Add results to selection. MapInfo.Engine.Session.Current.Selections.DefaultSelection.Add(fc) End Sub SearchInfo and SearchInfoFactory The MapInfo.Data.SearchInfo class defines the query used in a search and handles any necessary post processing of the search results.
Chapter 8: Working with Data Features and Feature Collections SearchInfoFactory Methods Behavior SearchIntersectsGeometry Returns the rows where the table geometry intersects with the search geometry. SearchWithinScreenRadius Creates a SearchInfo that returns the rows where the table geometry intersects a screen circle. SearchWithinScreenRect Returns the rows where the table geometry intersects the given screen rectangle.
Chapter 8: Working with Data Features and Feature Collections Dim map As Map = mapControl1.Map Dim session As ISession = MapInfo.Engine.Session.Current Dim si As SearchInfo = _ MapInfo.Mapping.SearchInfoFactory.SearchNearest(map, _ pt, 3) ' 3 pixel tolerance radius si.QueryDefinition.Columns = Nothing ' fetch all columns instead of just default ' Customize to stop at topmost layer where something is found CType(si.SearchResultProcessor, ClosestSearchResultProcessor)._ Options = ClosestSearchOptions.
Chapter 8: Working with Data Features and Feature Collections System.Drawing.Rectangle rect=mapControl1.Bounds; System.Drawing.Point pt = new System.Drawing.Point(rect.Left, rect.Top); pt.X += rect.Width/2; pt.Y += rect.Height/2; DPoint dpt1 = new DPoint(); // convert center point to map coords (could use map.Center) _map.DisplayTransform.FromDisplay(pt, out dpt1); Distance d = MapInfo.Mapping.SearchInfoFactory.ScreenToMapDistance (_map, 3); SearchInfo si =MapInfo.Data.SearchInfoFactory.
Chapter 8: Working with Data Analyzing Data 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: • • OGC object-based query interface ADO.NET SQL-based interface The diagram below shows the relationship between the two. Group 1 shows the OGC query interface. Use these objects to construct a query.
Chapter 8: Working with Data Analyzing Data you interact so the SQL tends to be optimal. If you are comfortable with the SQL language using the ADO.NET method may be more comfortable. But if you are inexperienced with SQL then the OGC object based query will work just as well. The MapInfo SQL syntax is defined in the SQL Reference which ships with MapXtreme and is integrated into Visual Studio after installing MapXtreme.
Chapter 8: Working with Data Improving Data Access Performance Improving Data Access Performance Performance is always an important aspect to any application that accesses data. Consider the following list in your design and development plans for your application. • • • • • • • • • • • Only request the data you need (especially from an RDBMS). This limits the amount of data sent over the connection.
Working with Core MapXtreme Classes 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.
Chapter 9: Working with Core MapXtreme Classes Session Interface 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.
Chapter 9: Working with Core MapXtreme Classes Session Interface Using Session.Dispose Method The MapInfo.Engine.Session class has two overloaded Dispose methods. Your choice will depend on the type of application you are building. 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.
Chapter 9: Working with Core MapXtreme Classes Serialization and Persistence ISessionEventHandlers MapXtreme provides a MapInfo.Engine.ISessionEventHandler interface for loading custom DLLs that extend MapXtreme’s 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.
Chapter 9: Working with Core MapXtreme Classes Serialization and Persistence 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.
Chapter 9: Working with Core MapXtreme Classes Opening and Saving a Workspace Containing Named Resources 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.
Chapter 9: Working with Core MapXtreme Classes Selection Class Opening an MWS: ResolveResource() On opening and parsing an MWS containing named resources, the ResolveResource() function returns the xmlNode corresponding to the name and type of the named resource. For example, when parsing a named style for a WMS, you would pass NamedResourceType.Style and XmlNode in the form of a string. ResourceResolver parses the parameters and returns a named resource node in the form of an XmlNode.
Chapter 9: Working with Core MapXtreme Classes Selection Class Each Selection must have a name and unique alias. By default, map selection tools modify the Selection when used. Each tool can be set to use any particular Selection. A selection in MapXtreme is not a copy; it is a reference to an IResultSetFeatureCollection for a given table in a Selection.
Chapter 9: Working with Core MapXtreme Classes Selection Code Examples ISerializable Interface on Selection and Selections Classes The ISerializable interface is implemented on the Selection and Selections classes. The following code example demonstrates how to serialize or deserialize a Selections object: // Create a MemoryStream to serialize into MemoryStream stream = new MemoryStream(); // Serialize the Selections object BinaryFormatter formatter = new BinaryFormatter(); formatter.
Chapter 9: Working with Core MapXtreme Classes Selection Code Examples VB example: Public Shared Sub MapInfo_Engine_Selection2() Dim session As ISession = MapInfo.Engine.Session.Current Dim tableUsa As Table = session.Catalog("usa") ' Get fc for selection on usa. Dim fc As IResultSetFeatureCollection = _ session.Selections.DefaultSelection(tableUsa) Dim nCount As Integer = 0 If Not fc Is Nothing Then nCount = fc.
Chapter 9: Working with Core MapXtreme Classes Event Arguments 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: • • • • CollectionCancelableEventArgs – Provides data for a collection event that can be cancelled. CollectionEventArgs – Provides data for a collection event.
Creating Expressions Expressions are used throughout MapXtreme to describe the exact pieces of information you need to display and analyze in your mapping application. This chapter covers creating expressions for a wide range of product areas, including data access, creating themes, labeling maps and more. In this chapter: Expressions Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .215 Creating Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 10: Creating Expressions Expressions Overview 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.
Chapter 10: Creating Expressions Where Clause – Boolean Expressions Select colA, colB, colC from Table1, Table2 Select colA/2, ColB/ColC from Table1 You can also write expressions that perform mathematical operations on your data. For example, RENT + UTILITIES is an expression that adds two columns together. This expression could be used in a SQL statement to find all apartments that have a total cost of less than $800 per month.
Chapter 10: Creating Expressions Expression Examples An example of using a function in an expression might be when you wish to look at the area of a table of boundaries, such as school districts. Use the function MI_Area() to return the area of each record in the table. Additional examples of functions in expressions are found in the Expressions Examples section below.
Chapter 10: Creating Expressions Expression Examples This expression uses a MapInfo SQL special keyword reserved for geographic objects called ‘Obj’. This keyword describes the geometry of the object such as its coordinate system and bounds. This keyword is compatible with previous versions of MapX and MapInfo Professional. It is equivalent to the column name MI_Geometry. Note that km and Spherical are enclosed in single quotes.
Chapter 10: Creating Expressions Expression Examples MapInfo.Engine.Session.Current.Catalog.Search("uscty_1k", si) ' Set the map view to show search results MapInfo.Engine.Session.Current.MapFactory(0).SetView(fc.Envelope) ' Set the view of the first map. ' Add results to selection. MapInfo.Engine.Session.Current.Selections.DefaultSelection.Add(fc) End Sub For more information on the Feature class and search methods, see Features and Feature Collections.
Chapter 10: Creating Expressions Expression Examples modifier.Name = "'Date/Time: ' + DateTimeToString( dateTimeColumn, 'm/d/yyyy hh:mm tt')" End Sub For more information on labeling, see Labels. InfoTips Expression Example InfoTips are text items that display when a tool hovers over a Feature. Expressions can be used to generate text for InfoTips in a similar fashion to the way they are used for labels. Use the MapTool.SetInfoTipExpression static helper function to set the InfoTip.
Accessing Data from a DBMS MapXtreme provides spatial server access. This is a powerful feature that allows developers to connect to live data stored in spatial servers, such as MapInfo's SpatialWare running on Microsoft’s SQL Server or the Oracle Spatial databases. Spatial servers allow companies to host their map data in their enterprise database for central management and security.
Chapter 11: Accessing Data from a DBMS Accessing Remote Spatial Data Accessing Remote Spatial Data You can access data using MapXtreme with different DBMS servers. The servers include: • • • • • • • • Microsoft Access 2007 and Excel 2007 Microsoft Access 2003 Oracle 11G (11.1.0.6.0 and 11.1.0.7.0) Oracle 10G, 10GR2 Microsoft SQL Server 2012 (with SQL Native Client 11) Microsoft SQL Server 2008 (with SQL Native Client 10) MapInfo SpatialWare® 4.9 and 4.9.
Chapter 11: Accessing Data from a DBMS Mapping DBMS Data with X/Y Columns ti.CacheSettings.CacheType = CacheOption.Off ' On is the default Dim tbl As Table = connection.Catalog.OpenTable(ti) End Sub Mapping DBMS Data with X/Y Columns You can access data from a DBMS table that has X/Y coordinates. You need to create a MapInfo_MapCatalog and register the tables as SpatialType 4.0 and specify two column names as the coordinates. The columns should be indexed on the table.
Chapter 11: Accessing Data from a DBMS Accessing Data from Oracle From MapInfo 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 0 *UNKNOWN_GEOMETRY (Spatial ignores this geometry.) 1 POINT Geometry contains one point. Point 2 LINESTRING Geometry contains one line string. MultiCurve 3 POLYGON Geometry contains one polygon.
Chapter 11: Accessing Data from a DBMS Accessing Data from Oracle those dimensions are ignored during insert/update operations. For geometries not containing dimensions supported by the Oracle table, NULL values are supplied for the missing dimensions during insert/update operations. For example, when inserting a geometry with no Z or M values into a table that is defined with dimensions x, y, and m, the M values stored in the table will be NULL.
Chapter 11: Accessing Data from a DBMS Accessing Data from MS SQL Server If the Spatial column does not contain an SRID value, (the value is NULL), your MapXtreme application is also able to interpret the data via the MapInfo Professional Coordsys defined in the MapCatalog. When loading tables that use the Latitude/Longitude coordinate system (Geodetic Data) to Oracle Spatial, it is important to verify that all geometry coordinates are between (-180,180) longitude and (90, 90) latitude.
Chapter 11: Accessing Data from a DBMS Accessing Data from MS SQL Server The following table shows how objects are handled in MapXtreme given a specific object type from SQL Server 2008.
Chapter 11: Accessing Data from a DBMS Accessing Data from MS SQL Server SQL Server 2008 Spatial GEOGRAPHY or GEOMETRY 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.
Chapter 11: Accessing Data from a DBMS DBMS Connection String Format DBMS Connection String Format ODBC Connection String Format The format of the ODBC connection string is defined by several clauses separated by semicolons (;). Each clause has the form Key=Value. Important keys are listed below. Keyword DLG= Description A number that controls the display of the connection dialog box: 0 – Suppresses the connection dialog. 1 – Displays the connection dialog.
Chapter 11: Accessing Data from a DBMS DBMS Connection String Format ODBC Layers and Pooling in Web Applications When adding remote layers via ODBC to an ASP.NET application that uses pooling, be sure to have the DLG=0 clause in the connection string. This will avoid the display of unnecessary user and password dialogs that can time out. This applies to TAB files and workspaces. The following connection string example shows the highlighted DLG=0 clause.
Chapter 11: Accessing Data from a DBMS Defining Mappable Tables in Server Table Queries Defining Mappable Tables in Server Table Queries The query you specify for a server table defines the result set of data from your DBMS that represents the data in the table being added. You can formulate a fairly complex query to do powerful server-side analysis that defines a mappable table in MapXtreme. Your MapXtreme application uses this query internally to access the data.
Chapter 11: Accessing Data from a DBMS Defining Mappable Tables in Server Table Queries SQL Server 2008 Spatial function example: select location_id, geography::Point(lat, long, 4326 /*WGS84*/) as geog from dbo.store_locations Spatialware function examples: select sw_member, ST_Buffer(sw_geometry, 66.0, 0.1) from rdbsdata select ST_Overlap(flood100.sw_geometry, lake.sw_geometry) from flood100, lake where ST_Overlaps(flood100.sw_geometry, lake.
Chapter 11: Accessing Data from a DBMS Accessing Attribute Data Accessing Attribute Data To use all available data columns, specify a query such as Select * From tablename. You are not required to specify * (asterisk); instead, you can designate specifically which columns you want to use. For the best performance, limit your query so that it retrieves only the needed columns.
Chapter 11: Accessing Data from a DBMS Working with the Cache Working with the Cache Knowing how to work with cache in MapXtreme enables you to improve your application’s performance. The sections below describe what the cache is, how it works in the MapXtreme object model, and the CacheSettings property of the TableInfoServer object. What Is the Cache? In place of local files, applications can access MapXtreme features from a remote database.
Chapter 11: Accessing Data from a DBMS Working with the Cache The TableInfoServer Object and the CacheSettings Property When a table is added to the map, the cache is enabled by default but can be further configured using the CacheSettings property of the TableInfo object. This property has four possible values: ON, OFF, ALL, USER, with ON being the default for TableInfoServer, OFF is default for other TableInfo objects.
Chapter 11: Accessing Data from a DBMS The MapInfo_MapCatalog Parameter USER 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.
Chapter 11: Accessing Data from a DBMS The MapInfo_MapCatalog Your application can use a MapInfo_MapCatalog that already exists on the server. (This same catalog is shared by various MapInfo client applications). If there is no MapInfo_MapCatalog on the server, you need to create one. MapXtreme supports the storage of style information for individual features in remote databases. Loading Spatial Data to DBMS If you have spatial data in the form of a MapInfo table, you can import it into your DBMS database.
Chapter 11: Accessing Data from a DBMS The MapInfo_MapCatalog NUMBER_ROWS INTEGER ) L 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.
Chapter 11: Accessing Data from a DBMS Adding Rows to the MapInfo_MapCatalog Adding Rows to the MapInfo_MapCatalog For each spatial table that you want to access from your application, you need to add a row to the MAPINFO_MAPCATALOG table. If you do not use MapInfo Professional to manage the MapInfo_MapCatalog, you will have to add rows to the MAPINFO_MAPCATALOG table manually. The following table describes the syntax and meaning of each column.: MapXtreme v7.
Chapter 11: Accessing Data from a DBMS Adding Rows to the MapInfo_MapCatalog Column Name SPATIALTYPE 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 5.x: SpatialWare for Oracle 6.x: Ingres SQL - Not Supported 7.x: Sybase SQS - Not Supported 8.x: Oracle SDO version 2 - Not Supported 9.x: MapInfo Geocoding DataBlade SpatialWare Point Module 10.
Chapter 11: Accessing Data from a DBMS Adding Rows to the MapInfo_MapCatalog Column Name Values to Assign Examples OWNERNAME The owner name of the table. BOB SPATIALCOLUMN The name of the column, if any, containing spatial features: SW_GEOMETRY (mappable using SpatialWare Type/IDS/UDO) NO_COLUMN (mappable using X–Y) MI_SQL_MICODE (mappable using MI Code) Or the name of the IDS/UDO, or Oracle column that is ST_SPATIAL datatype. Name of the Oracle SDO_GEOMETRY column.
Chapter 11: Accessing Data from a DBMS Adding Rows to the MapInfo_MapCatalog Column Name SYMBOL 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.
Chapter 11: Accessing Data from a DBMS Per-Record Styles Column Name RENDITIONCOLUMN 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.
Chapter 11: Accessing Data from a DBMS Per-Record Styles Symbol, Pen, Brush Clause Syntax If you are manually creating a MAPINFO_MAPCATALOG table to provide support for a remote spatial database, you will need to specify a symbol style, and possibly line and fill styles as well. Specifying Point Styles Use a Symbol clause to specify point styles. There are three types of Symbol clauses: one for specifying MapInfo 3.
Chapter 11: Accessing Data from a DBMS Troubleshooting 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 The table is not matchable. Data binding was attempted against a SpatialWare layer. AddColumns is not currently supported for SpatialWare layers. No object was found using the index that you specified.
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: Introduction to the MapInfo.Mapping Namespace . . . . . . . . . . .247 Base Mapping Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .247 Layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 12: Adding Mapping Capability to Your Applications Introduction to the MapInfo.Mapping Namespace Introduction to the MapInfo.Mapping Namespace The MapInfo.Mapping namespace contains classes, interfaces, and enumerations for creating, displaying, and exporting maps, layers, modifiers, thematics, legends, and labels. The Map class is the top level object for a map in a desktop application. Each Map object can contain exactly one map. Each Map has one Adornment collection and one Layer collection.
Chapter 12: Adding Mapping Capability to Your Applications Base Mapping Classes Example Use of MapExport If you are using a MapControl, you must clone the map prior to exporting it, as shown in the example below: VB example: Public Shared Sub MapInfo_Mapping_MapExport(ByVal mapControl1 As MapControl) ’must clone since map is coming from mapcontrol and is linked to it via the HWND Dim NewMap As Map = CType(mapControl1.Map.Clone(), Map) Dim exportObject As MapExport = New MapExport(NewMap) exportObject.
Chapter 12: Adding Mapping Capability to Your Applications Base Mapping Classes Dim map As Map = Session.Current.MapFactory.CreateEmptyMap(New Size(300, 300)) 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.
Chapter 12: Adding Mapping Capability to Your Applications Layers 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.
Chapter 12: Adding Mapping Capability to Your Applications Layers 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.
Chapter 12: Adding Mapping Capability to Your Applications Layers 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. Code Example: Animation Layer The following VB sample shows how to set the animation of a layer. Private Sub btnInitializeObjects_Click(ByVal sender As System.
Chapter 12: Adding Mapping Capability to Your Applications Labels ftr2.Item("Level") = 2 tblTemp.InsertFeature(ftr2) End Sub Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick Dim cat As Catalog = MapInfo.Engine.Session.Current.Catalog Dim tbl As Table = cat.GetTable("Animation") If IsNothing(tbl) = False Then 'Update the position of the points Dim si As SearchInfo = MapInfo.Data.SearchInfoFactory.SearchWhere("Name= _ 'Kelly'") Dim ftr As Feature = cat.
Chapter 12: Adding Mapping Capability to Your Applications Labels 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.
Chapter 12: Adding Mapping Capability to Your Applications Labels 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.
Chapter 12: Adding Mapping Capability to Your Applications Labels 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.
Chapter 12: Adding Mapping Capability to Your Applications Adornments Dim map As Map = Session.Current.MapFactory.CreateEmptyMap(New _ Size(300, 300)) ' Create a new feature layer that references the table and add it to the map Dim featureLayer As New FeatureLayer(table) map.Layers.Add(featureLayer) ' Create a new label layer and add it to the map. ' Note that if you call MapInfo.Mapping.LayersBase.Add" method instead of ' MapInfo.Mapping.LayersBase.
Chapter 12: Adding Mapping Capability to Your Applications Adornments 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.
Chapter 12: Adding Mapping Capability to Your Applications Feature Style Modifiers Public Shared Sub MapInfo_Mapping_ScaleBarAdornment(ByVal mapControl1 As _ MapControl) ' Create a scalebar Dim sba As ScaleBarAdornment = New ScaleBarAdornment(mapControl1.Map) ' Position the scalebar at the lower right corner of map Dim x As Integer = mapControl1.Map.Size.Width - sba.Size.Width Dim y As Integer = mapControl1.Map.Size.Height - sba.Size.Height sba.Location = New System.Drawing.
Chapter 12: Adding Mapping Capability to Your Applications Feature Style Modifiers 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.
Chapter 12: Adding Mapping Capability to Your Applications Printing Your Map Printing Your Map Once your application is created you may want to give your user the opportunity to print out their generated map. The MapInfo.Printing namespace is provided to facilitate including printing functionality into any application. This classes in this namespace are built upon the .NET Framework classes for printing so the necessary constructions are similar to any other Windows application.
Finding Locations The MapInfo.Data.Find namespace contains the classes to use when searching for map features by address, street intersection or name. In this chapter: Functional Overview of Find . . . . . . . . . . . . . . . . . . . . . . . . . . . . .263 Overview of the Data.Find Namespace . . . . . . . . . . . . . . . . . . . .266 Fine Tuning the Find Process . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 13: Finding Locations Functional Overview of Find Functional Overview of Find Find is used when you wish to locate map features by address, street intersection or name. To find features at locations using selection tools or queries, use the Search classes in the Data namespace (see Searching for Features). A successful Find operation can result in an exact match, one or more close matches, or no match (failed match).
Chapter 13: Finding Locations Functional Overview of Find abbreviation and substitution list, called Mapinfow.abb, to find a suitable match. This list contains standard spellings of street prefix and suffix abbreviations, such as ST for Street and Av for Avenue. You must set a property to tell MapXtreme to use this abbreviations file, but it is a good way to increase the chance of exact matches or find more close matches than without the file.
Chapter 13: Finding Locations Functional Overview of Find • 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.
Chapter 13: Finding Locations Overview of the Data.Find Namespace Overview of the Data.Find Namespace The MapInfo.Data.Find namespace contains classes that enable you to locate a map feature, street address, or street intersection within a mappable table. The properties and methods of the Find class are used to set up a Find. The results of a Find are returned using the FindAddressRange, FindCloseMatch, and FindResult classes. The following UML diagram illustrates the Find namespace.
Chapter 13: Finding Locations Overview of the Data.Find Namespace Property Description AddressNumberAfterStreet Specifies whether the address number is located after the street name (for example, “Smith Street 107”). ChooseAlternateBoundary Specifies whether to match a record found in a refining region other than the refining region specified. ChooseClosestAddressRange Specifies whether to use the closest available address number in cases where the address number does not match.
Chapter 13: Finding Locations Overview of the Data.Find Namespace Method Description Search Searches a mappable table for a named location and returns a FindResult object. SearchIntersection Searches a mappable street table for a given intersection, returning a FindResult object. Dispose Releases unmanaged resources held by the Find object. It is necessary to call this method when finished with the Find object. .
Chapter 13: Finding Locations Overview of the Data.Find Namespace _table = null; } } } find.Dispose(); } 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.
Chapter 13: Finding Locations Overview of the Data.Find Namespace find.Dispose(); } 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.
Chapter 13: Finding Locations Overview of the Data.Find Namespace Member Name Description ExactMatch An exact match was found. SideOfStreetUndetermined The side of the street was undetermined. WithinMinMax The address number was within minimum/maximum range. NotWithinMinMax The address number was not within minimum/maximum range. AddressNumNotSpecified An address number was not specified. StreetsDoNotIntersect The streets do not intersect.
Chapter 13: Finding Locations Fine Tuning the Find Process Member Name Description ExactMatch An exact match was found. SubstitutionUsed A substitution from the abbreviations file used. ExactMatchNotFound An exact match was not found. NoObjectNameSpecified No object name specified; match not found. CloseMatch A close match was found.
Chapter 13: Finding Locations Fine Tuning the Find Process BRIDGE BR CIRCLE CIR COURT CT DRIVE DR EXTENSION EXT HIGHWAY HWY INTERSTATE I LANE LN MOUNT MT PARK PK PARKWAY PKWY PLACE PL PLAZA PLZ POINT PT RAILROAD RR ROAD RD ROUTE RT SAINT ST SQUARE SQ STREET ST STR ST TERRACE TER !EOLNOSPACE , ; # !EOLSPACE FLOOR SUITE "P.O. BOX" !NOSPACE .
Chapter 13: Finding Locations Fine Tuning the Find Process Space-delimited simple substitution !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.
Chapter 13: Finding Locations Fine Tuning the Find Process # “!EOLNOSPACE” is the keyword indicating that the following items are to be treated as cases of simple truncation. After that we have one line with a comma and one with a number sign. Whenever MapXtreme encounters a comma or a number sign in an address it will ignore it and everything after.
Chapter 13: Finding Locations Fine Tuning the Find Process 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: • • • at the beginning of the line; and between the searched for string and the substitution; and at the end of the line. For example, you might want to substitute “STHWY” for “State Highway”.
Chapter 13: Finding Locations Fine Tuning the Find Process \" \\ Adding Lines to the Abbreviation File You can add a new item to the file by adding a new row. The order in which you add rows is not significant, except in those cases where you expect one substitution pair to compensate for the effects of another. The number of spaces between the first and second items in a row is not significant either.
Using Themes and Legends 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: Thematics Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .279 GraduatedSymbolTheme. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .280 PieTheme . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 14: Using Themes and Legends Thematics Overview 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.
Chapter 14: Using Themes and Legends GraduatedSymbolTheme 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.
Chapter 14: Using Themes and Legends GraduatedSymbolTheme Example of a Graduated Symbol thematic map. When To Use a Graduated Symbol Theme Graduated symbols maps work with numeric data only. It makes no sense to create graduated symbols based on the type of cuisine each restaurant serves. However, graduated symbols are appropriate when you want to show the distribution of housing income by city.
Chapter 14: Using Themes and Legends PieTheme 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. When To Use a Pie Theme Pie charts are particularly useful for analyzing demographic data. For example, you have a dataset of demographic information for the United States.
Chapter 14: Using Themes and Legends BarTheme Printing a Map Containing Pie/Bar Themes When cloning a map for printing that contains pie or bar themes, be sure to take the size of the paper into consideration to get expected results. The paper size is used to calculate the size of the pie/bars in the printed output. Use the paper size at 100 percent so that the graphs/themes are the same relative size in the print preview as they are on the MapControl.
Chapter 14: Using Themes and Legends RangedTheme Controlling Display Size for Pie and Bar Themes MapXtreme provides the abstract base class MultiVariableTheme that supports the creation of pie and bar object themes. This class, derived from the ObjectTheme class, provides two properties, DataValueAtSize and Size, that control how large object theme geometries display at particular values. The default value for DataValueAtSize is set to the largest data value of the mapped features.
Chapter 14: Using Themes and Legends RangedTheme Types of Ranged Values MapXtreme can create ranges automatically using five distribution methods: • • • • • • 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.
Chapter 14: Using Themes and Legends RangedLabelTheme 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.
Chapter 14: Using Themes and Legends Ranged Themes and Serialization Ranged Themes and Serialization Beginning with v7.0.0, serialization and deserialization for RangedThemes and RangeLabelThemes has been changed in an effort to boost performance. The changes are during theme serialization, when the theme's bin or category record counts are serialized. Upon deserialization, the record counts are no longer recomputed; rather the serialized record counts are applied to the theme.
Chapter 14: Using Themes and Legends Creating an IndividualValueTheme with Custom Bitmap Symbols Creating an IndividualValueTheme with Custom Bitmap Symbols The following C# example shows how to create an IndividualValueTheme that use custom bitmap symbols. A table of available bitmap symbols is included in Custom Symbols. // Open a connection to the Catalog MapInfo.Data.MIConnection conn = new MapInfo.Data.MIConnection(); conn.Open(); // Retrieve a table from the Catalog MapInfo.Data.Table ti=conn.
Chapter 14: Using Themes and Legends IndividualValueLabelTheme 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. When To Use an IndividualValueLabelTheme Class As with ranged label themes, individual value label themes are also useful when you want use the labels to convey information about what you are labeling.
Chapter 14: Using Themes and Legends DotDensityTheme 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 region’s data value.
Chapter 14: Using Themes and Legends Legends Overview Bivariate Thematic Maps Bivariate thematic mapping uses point or line objects to represent two thematic variables. For example, a star can represent one variable, such as the number of teenagers, while a blue fill for the star represents their annual purchase amounts. To create a bivariate map in MapX, you create two thematic maps, and layer one over the other so that the objects display two variables.
Chapter 14: Using Themes and Legends Legends Overview 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. When to Use a Theme Legend A theme legend is useful whenever you have a map that contains themes. With a weather map that displays precipitation, rainfall may be represented by varying shades of green.
Chapter 14: Using Themes and Legends Legends Overview When to Use a Cartographic Legend A cartographic legend is very useful whenever you have a map that contains objects that represent items on the map. For example, a map with landmarks requires a cartographic legend. Hospitals, schools, churches, and airports would each be represented by a different symbol. The cartographic legend provides a visual explanation of the different types of landmarks that are represented on the map. See the MapInfo.Mapping.
Stylizing Your Maps Styles in MapXtreme affect many components of a mapping application, not just how a map feature looks. Styles are used for labels, text, themes, legends, selection and presentation with many controllable attributes so you can design practically any style you like. This chapter discusses styles in terms of the MapXtreme framework, specifically the MapInfo.Styles namespace. In this chapter: Overview of the MapInfo.Styles Namespace . . . . . . . . . . . . . . . .
Chapter 15: Stylizing Your Maps Overview of the MapInfo.Styles Namespace Overview of the MapInfo.Styles Namespace The MapInfo.Styles namespace highlights the new Styles object model for MapXtreme. The Style class is the base class of all styles. Classes that derive from Style include AreaStyle, BaseLineStyle, BaseInterior, BasePointStyle, CompositeStyle, Font, RasterStyle, and TextStyle. Derived from BaseLineStyle is the SimpleLineStyle class. Derived from BaseInterior is the SimpleInterior class.
Chapter 15: Stylizing Your Maps Style Descriptions MapXtreme comes with a number of sample styles to get you started. There are more than 170 interior fill patterns, approximately 120 line style patterns, and approximately 70 bitmap point style images. You can create bitmap images in any application that can create bitmaps, like MS Paint or Paint Shop Pro. There are virtually no size limitations on the image; however, the ability of MapXtreme to display it will depend on available memory.
Chapter 15: Stylizing Your Maps Style Descriptions MapXtreme ships with a number of bitmap point styles to get you started. They are located in the CustSymb directory. You can also add your own bitmap images to this directory. The maximum number of images allowed is 32,767. CompositeStyle The CompositeStyle class encompasses the collection of all the style types used for default styles, modifier styles, and layer override styles.
Chapter 15: Stylizing Your Maps Style Descriptions 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.
Chapter 15: Stylizing Your Maps Pre-defined Styles and the StyleRepository Class 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.
Chapter 15: Stylizing Your Maps Using Styles 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.
Chapter 15: Stylizing Your Maps Overriding Styles 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.
Spatial Objects and Coordinate Systems This chapter covers the MapInfo.Geometry namespace and provides descriptions and examples for writing applications for creating and manipulating geometry objects. In this chapter: Introduction to MapInfo.Geometry Namespace. . . . . . . . . . . . . .303 Geometries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .303 Including Your FeatureGeometry in a Map . . . . . . . . . . . . . . . . .
Chapter 16: Spatial Objects and Coordinate Systems Introduction to MapInfo.Geometry Namespace Introduction to MapInfo.Geometry Namespace The MapInfo.Geometry namespace is used for creating and manipulating geometry objects, and the coordinate systems in which they are used.
Chapter 16: Spatial Objects and Coordinate Systems Geometries 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. Editing Geometry Objects All Geometry objects contain a method for retrieving an interface to an editor that places the object into Edit Mode.
Chapter 16: Spatial Objects and Coordinate Systems Geometries 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.
Chapter 16: Spatial Objects and Coordinate Systems Geometries CoordSys longLatNad83; CoordSysFactory coordSysFactory = new CoordSysFactory(); longLatNad83=coordSysFactory.CreateLongLat (MapInfo.Geometry.DatumID.NAD83); MultiPoint multiPointGeometry = new MultiPoint (longLatNad83, pointArray); where pointArray is an array of DPoints. MultiCurve The MultiCurve class is derived from the FeatureGeometry class, and contains a possibly disconnected set of Curves.
Chapter 16: Spatial Objects and Coordinate Systems Geometries Curve Sort Order The order of the Curves in a MultiCurve may be altered during construction, as compared to the array of Curves passed to the constructor, and upon completion of editing. Due to this, plus the removal of empty Curves, and limitations in the current implementation, any references to Curves contained in a MultiCurve prior to and during editing may no longer be valid after editing is completed (i.e.
Chapter 16: Spatial Objects and Coordinate Systems Geometries contains 5 points (with the first and last points being identical), and are effected by the coordinate system. In some instances, the converted Rectangle may no longer appear rectangular. Use the CreateMultiPolygon method to convert a RoundedRectangle to a FeatureGeometry object. See the Developer Reference for a code example. Ellipse The Ellipse is inscribed in an axis-aligned rectangle defined by a DRect.
Chapter 16: Spatial Objects and Coordinate Systems Geometries 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.
Chapter 16: Spatial Objects and Coordinate Systems Including Your FeatureGeometry in a Map dPoints[1] = new DPoint(-109.169283,49.241794); ... dPoints[101] = new DPoint(-109.171279,49.214879); Ring newRing = new Ring(longLatNad83, CurveSegmentType.Linear, dPoints); 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.
Chapter 16: Spatial Objects and Coordinate Systems Checking for Points in Polygons column.DataType = MIDbType.Style tableInfo.Columns.Add(column) Dim pointTable As Table = _ Session.Current.Catalog.CreateTable(tableInfo) ’ Set the location and display style of the point Dim Geometry As FeatureGeometry = _ New MapInfo.Geometry.Point(coordSys, x, y) Dim vStyle As SimpleVectorPointStyle = _ New SimpleVectorPointStyle(37, Color.Red, 14) Dim cStyle As CompositeStyle = _ New MapInfo.Styles.
Chapter 16: Spatial Objects and Coordinate Systems Coordinate Systems Dim multiPolygon As MultiPolygon = New _ MultiPolygon(coordSys,CurveSegmentType.Linear,points) Dim insidePoint As DPoint = New DPoint(-0.115108,0.160671) Dim boundaryPoint As DPoint = New DPoint(-0.446043,0.486811) Dim outsidePoint As DPoint = New DPoint(-1.103118,0.021583) If multiPolygon.ContainsPoint(insidePoint) Then _ Console.
Chapter 16: Spatial Objects and Coordinate Systems Coordinate Systems The CoordSysFactory object contains registered coordinate systems. CoordSys definitions can be registered by loading one or more XML projection files or by using the RegisterCoordSys, or RegisterCoordSysInfo methods. Create CoordSys objects from the factory, or code-codespace (EPSG, SRID), PRJ string, MapBasic string, and other Factory creation methods.
Chapter 16: Spatial Objects and Coordinate Systems Coordinate Systems Changing the Coordinate System of a Geometry Object The next example illustrates how to convert a Geometry object from one coordinate system to another.
Chapter 16: Spatial Objects and Coordinate Systems Coordinate Systems Dim mapCoordSysName As String = _ MapInfo.Engine.Session.Current.CoordSysFactory.CoordSys_ Name(mapCoordSys) End Sub Adding Coordinate Systems to MapXtreme If the MapInfoCoordinateSystemSet.xml file does not contain a coordinate system to match your needs, you may add it to MapXtreme. This feature supports adding EPSG codes and SRID codes to extend MapXtreme’s capabilities.
Chapter 16: Spatial Objects and Coordinate Systems Coordinate Systems End Try End Sub L 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.
Chapter 16: Spatial Objects and Coordinate Systems Coordinate Systems My Custom CRS coordsys 8,74,8,110.0833333333,47.5,0.9999375,2624666.667,328083.
Working with Rasters and Grids 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: Overview of the MapInfo.Raster Namespace. . . . . . . . . . . .
Chapter 17: Working with Rasters and Grids Overview of the MapInfo.Raster Namespace Overview of the MapInfo.Raster Namespace The MapInfo.Raster namespace exposes the full functionality of Pitney Bowes Software’s C/C++ Raster and Grid Engine APIs. Raster images are bitmaps that provide useful background and reference layers to maps. Grid images are a type of theme that shows a continuous gradation of color across the image. The gradation represents an interpretation of the underlying data.
Chapter 17: Working with Rasters and Grids Raster Images Below are the raster image formats supported in MapXtreme: • • • • • • • • • • • • • • • • • • • • • • TIFF and GeoTIFF (*.tif) MrSID (*.sid) ECW (*.ecw) Spot (*.bil) JPEG (*.jpg) JPEG2000 (*.jp2, *.j2K) PCX (*.pcx) GIF (*.gif) Windows Bitmap (*.bmp) PNG (*.png) Photoshop (*.psd) Targa (*.tga) Windows Metafile (*.wmf) Windows Enhance Metafile (*.emf) Wireless BMP (.WBMP) Vertical Mapper Continuous Grid (*.grd) Vertical Mapper Classified Grid (*.
Chapter 17: Working with Rasters and Grids Raster Images Raster Images and Coordinate Systems When you display a raster, grid or WMS image as a map layer, MapXtreme automatically sets the rotation and projection of all the vector map layers, so that they match the rotation and projection of the raster image. If a map includes more than one raster, grid or WMS image layer, MapXtreme automatically displays the map in the projection specified by the most visible raster image.
Chapter 17: Working with Rasters and Grids Raster Handlers Table MyTable = Session.Current.Catalog.OpenTable("MyRaster.tab"); FeatureLayer MyLayer = new FeatureLayer(MyTable); MyMap.Layers.Add(MyLayer); VB example: Dim MyTable As Table = _ Session.Current.Catalog.OpenTable("MyRaster.tab") Dim MyLayer As FeatureLayer = New FeatureLayer(MyTable) MyMap.Layers.Add(MyLayer) Raster Handlers MapXtreme can use one of many different libraries to load a raster image.
Chapter 17: Working with Rasters and Grids Raster Handler Properties Raster Handler Raster Format TIFF.RHL TIF (.tif) * VMGRID.RHL Vertical Mapper (.grd, .grc) † HALO.RHV BMP, TIF, GIF, TGA, JPEG, PCX LEADTOOL.RHX BMP, GIF, JPEG, JPEG2000, PNG, TIF, PSD, WMF, EMF * † 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.
Chapter 17: Working with Rasters and Grids Configuring Custom Raster Handlers Note that this value is read from and stored in the ClientMetadata of the table. If a value exists in a .TAB file's metadata it will be read in and recognized. If WriteTabFile is called the value will be persisted into the begin_metadata section of the .TAB file. This property is equivalent to TableInfo.ClientMetadata["\\PreferredRasterHandler"].
Chapter 17: Working with Rasters and Grids Grid Images Use the syntax if the application data is stored in a location relative to a .NET Framework special system folder. For example, if your application data is stored in a directory named MyAppData located under the “My Documents” directory, then the entry in the configuration file could be: MyAppData where “Personal” is the value of the .NET Framework enumeration Environment.
Chapter 17: Working with Rasters and Grids Grid Images • Vertical Mapper Continuous Grids1 2(*.grd, .*grc) Additional grid formats may be supported on a system if a custom grid handler is installed. 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.
Chapter 17: Working with Rasters and Grids Grid Creation This example shows how to open and read cell values from a grid file. VB example: Public Shared Sub MapInfo_Raster_GridReadStartRead(ByVal _ gridread As GridRead, ByVal strGridFilename As String) Dim strHillshadeFilename As String = _ gridread.DefaultHillshadeFilename(strGridFilename) If gridread.
Chapter 17: Working with Rasters and Grids Grid Interpolators The interpolators, IDW and TIN, provide algorithms for determining grid cell values according to their particular formulas. IDW is best used for population data, while TIN is used for terrain data. See Inverse Distance Weighted (IDW) Interpolator and Triangulated Irregular Network (TIN) Interpolator. If one of the provided interpolators does not meet your needs, you can create your own by deriving it from the new IInterpolator interface.
Chapter 17: Working with Rasters and Grids Grid Style For a code example of creating a grid using the IDW interpolator, see MapInfo.Raster.GridCreatorFromFeatures class in the Developer Reference. Triangulated Irregular Network (TIN) Interpolator The second provided interpolator is called the Triangulated Irregular Network, or TIN. The TIN works best for terrain data and for data points that have a linear progression or relationship to each other across the grid, such as temperature.
Chapter 17: Working with Rasters and Grids Grid Style Grid Images and Inflections A continuous grid image shows an interpolation of data values across an area. A grid is made up of grid cells where each cell represents a value. These values are represented on the map as a continuous color gradation that is bounded by the range of data values. The point at which the color changes due to a change in the grid value or percentage is known as an inflection.
Chapter 17: Working with Rasters and Grids Grid Style This process is also incorporated into the Grid Style dialog in Workspace Manager. See Grid Style. L 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.
Chapter 17: Working with Rasters and Grids Grid Style Hillshading is enabled via a checkbox in the GridStyle dialog. The horizontal and vertical light source angles and scale factor are set in LayerControl. Programmatically, hillshading can be added to a grid via the MapInfo.Raster.HillshadeWrite class.
Chapter 17: Working with Rasters and Grids Grid Style Color Adjustments You can make adjustments to affect the color in the grid image. These changes are applied equally to the entire layer. Contrast Use the Contrast scroll bar to adjust the contrast in the image. Slide the bar between 0 and 100% to set the grid’s contrast level. You can use the cursor keys for fine adjustment. Brightness Use the Brightness scroll bar to adjust the brightness in the image.
Chapter 17: Working with Rasters and Grids Grid Style Relief Shading Relief shading allows you to shade your grid surface map according to the orientation of a virtual light source. This enables you to take surface slope and direction into account relative to the direction of the light. The Grid Style dialog provides a setting to enable or disable relief shading. To adjust the relief shading settings, you must first highlight the grid layer in Layer Control and choose the Hillshade tab.
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: Overview of the MapInfo.Geocoding Namespace . . . . . . . . . . . .336 Main Geocoding Classes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .336 Understanding the Geocoding Model. . . . . . . . . . . . . . . . . . . . . .338 Geocoding a Location . . . . . . . . . . . . . . . . . . .
Chapter 18: Geocoding Overview of the MapInfo.Geocoding Namespace Overview of the MapInfo.Geocoding Namespace The MapInfo.Geocoding namespace provides interfaces and classes for geocoding address records. Geocoding is the process of determining the geographic location of a street address, intersection, place or postal code in order to pinpoint the location on a map. The geocoding client sends requests via HTTP to Pitney Bowes Software’s geocoding server or geocoding web service product.
Chapter 18: Geocoding Main Geocoding Classes The following diagram illustrates the interfaces and classes that make up the Geocoding namespace: 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.
Chapter 18: Geocoding Understanding the Geocoding Model 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. BaseGeocodeMatchCode and GeocodeMatchCode These are classes that implement the IGeocodeMatchCode interface.
Chapter 18: Geocoding Understanding the Geocoding Model • Is your goal to geocode as many records as possible? 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.
Chapter 18: Geocoding Geocoding a Location Typically the reference address contains the essential components: address number, street name and prefix, if one exists, and suffix. For non-U.S. locales, additional information such as apartment number, may not be contained in the reference address and thus, ignored in the input address.
Chapter 18: Geocoding Geocoding a Location street address, intersections, primary and secondary postal codes, place names, and a country code. The level of information included in the input address will determine the level and accuracy of the geocode result candidates. Using the geocoding client, you can perform various levels of geocoding: Street Address Geocoding You can use geocoded street address information to display on a map or to perform spatial searches and queries.
Chapter 18: Geocoding Geocoding a Location directionalSuffix); //Create a StreetAddress object MapInfo.Geocoding.StreetAddress streetAddress = new MapInfo.Geocoding.StreetAddress(street); //Create an Address object MapInfo.Geocoding.Address address = new MapInfo.Geocoding.Address(streetAddress, countryCode); address.PrimaryPostalCode = zipCode; address.PlaceList = new MapInfo.Geocoding.Place[] {new MapInfo.Geocoding.Place( cityName, MapInfo.Geocoding.NamedPlaceClassification.Municipality), new MapInfo.
Chapter 18: Geocoding Using Constraints for Accurate Geocoding Postal Code Geocoding Postal code centroids represent the centre of a postal code region. Being able to locate these centroids on a map lets you perform demographic analysis to find market regions to target for advertising or direct mail. For postal code level geocoding, use the Address class specifying only the PrimaryPostalCode information.
Chapter 18: Geocoding Using Constraints for Accurate Geocoding What are the Match Constraints? The match constraints control how to match a given input address, the number or candidates returned for each address, and what auxiliary information will be returned. An input address may not exactly match a real world address possibly due to incomplete or incorrect information.
Chapter 18: Geocoding Using Constraints for Accurate Geocoding • • • • • • • • • • FallbackToPostal – Determines if a street geocode request which produces no close candidates, the geocode is performed on the postal code centroid. The default value is set to false. OffsetFromStreet – Determines the distance from the street segment at which the address is positioned. This value is used to prevent addresses across the street from each other from being given the same point.
Chapter 18: Geocoding Understanding Accuracy for Close Matches component that supports CASS in order to use CASS geocoding. Contact your MapInfo sales representative to obtain a current version in order to comply with CASS address standardization. The default is false. Impact of Relaxing Match Constraints Relaxing the conditions broaden the area in which it searches for a match.
Chapter 18: Geocoding Understanding Accuracy for Close Matches • • Geographic Centroid Matches (G category) Non-Match Codes For either S or M category result codes, each character of the code tells how precisely the geocode operation matched each address component.
Chapter 18: Geocoding Understanding Accuracy for Close Matches • • SX – point located at street intersection SO – no coordinates available (very rare occurrence) Best Match from Multiple Candidates (M Category) Matches in the M category indicate that there is more than one close match candidate for the record and the server or service has chosen the best one of those candidates.
Chapter 18: Geocoding Understanding Accuracy for Close Matches • • • G2 – areaName2 centroid (country secondary subdivision) G3 – areaName3 centroid (municipality) G4 – areaName4 centroid (municipality subdivision) 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.
19 Web Map Service 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: Introduction to MapXtreme’s Web Map Service. . . . . . . . . . . . . Understanding WMS Operations . . . . . . . . . . . . . . . . . . . . . . . . . Code Example: Requesting a WMS Layer . . . . . . . . . . . . . . . . . WMS and Coordinate Systems . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 19: Web Map Service Introduction to MapXtreme’s Web Map Service Introduction to MapXtreme’s Web Map Service The MapXtreme Web Map Service (WMS) allows clients to request and servers to deliver spatially referenced map images over the Internet or private intranet. MapXtreme gives you the tools to both deploy a WMS Server for others to query, and supports the incorporation of WMS Client capabilities into your application to request images from a WMS Server.
Chapter 19: Web Map Service Understanding WMS Operations 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 server’s map layers. Based on the WMS Server capabilities, a GetMap request includes the following. • • • • • • • • • Version–Request version Layers–one or more layers of map data Styles–display styles for rendering the layers. If this is not specified, default styles will be used.
Chapter 19: Web Map Service Understanding WMS Operations You must supply the URL to the server you wish to reach. The version is optional. The MapXtreme Client appends the required information following the ? in an HTTP request to make a complete request of the server’s capabilities. For example: http://www.mapsanddata.xyz/gis/services/maps/hydrography/MapServer/WMSSer ver?request=GetCapabilities&service=WMS&version=1.3.
Chapter 19: Web Map Service Code Example: Requesting a WMS Layer Code Example: Requesting a WMS Layer To request a WMS layer programmatically with MapXtreme, follow the code example below. L MapXtreme’s implementation of WMS limits the size of the returned image to 4000 pixels each for width and height. // build the capabilities ICapabilities capabilities = WmsClientUtilities.GetCapabilities (url, "1.1.1"); // create the WMS client WmsClient wmsClient = new WmsClient(capabilities); wmsClient.
Chapter 19: Web Map Service MapXtreme WMS and Authentication The attributes for EX_GeographicBoundingBox are westBoundLongitude, eastBoundLongitude, southBoundLatitude, northBoundLatitude. EX_GeographicBoundingBox is supplied regardless of what CRS the WMS server supports. It may be approximate if the data are not natively in geographic coordinates. The equivalent parameter in WMS 1.1.1 is LatLongBoundingBox with attributes minx, miny, maxx and maxy in EPSG:4326 longitude/latitude.
Chapter 19: Web Map Service Setting up a MapXtreme WMS Server To support integration of authentication into existing MapXtreme WMS Client implementations, the semantics of the WmsRequest UserDefinedParameters have been extended to include support for a set of well-known authentication parameters, which maps directly to the set of authentication properties on the WmsRequest object model.
Chapter 19: Web Map Service Setting up a MapXtreme WMS Server 3. For IIS 7 classic mode or IIS 6, update the version number and PublicKeyToken (if necessary) for the MapInfo.Wms.Server and the MapInfo.CoreEngine assemblies installed on your system (bold type below). Assemblies are located in C:\Windows\Microsoft.NET\assembly\GAC_32 or GAC_64. PAGE 351Chapter 19: Web Map Service Setting up a MapXtreme WMS Server 1. Open WMSSample.xml in a text editor and modify line to point to your WMS Server. You can modify other elements as you see fit, including the server name, title, abstract, keyword lists and vocabularies, contact information, fees, and access constraints.
Chapter 19: Web Map Service Setting up a MapXtreme WMS Server also be nested so that by requesting a parent layer, all the child layers are included in the response. The following example is the entry for a single layer called States. The bold text below call out the elements added in support of WMS 1.3.0. For more information about how to build these entries, see Configuring Layer Information for a WMS Server.
Chapter 19: Web Map Service Setting up a MapXtreme WMS Server Blue Fill This is a blue area fill with a red border. image/gif PAGE 354Chapter 19: Web Map Service Setting up a MapXtreme WMS Server 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.
Chapter 19: Web Map Service Setting up a MapXtreme WMS Server 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.
Chapter 19: Web Map Service Setting up a MapXtreme WMS Server 2. Open IIS (From the Start menu > Control Panel > Administrative Tools > Internet Information Services). Expand the Default Web Site and locate your WMS server (by folder name or by alias, if you use one). 3. Right-click on the Web site and choose Properties. Under the ASP.NET tab, choose 4.0.30319 for the ASP.NET version (The MapXtreme assemblies are compiled under the 4.0 Framework). 4.
Chapter 19: Web Map Service Setting up a MapXtreme WMS Server 5. Test your setup by sending a GetCapabilities request from a web browser. In the address box type: http://localhost/wms/GetMap.ashx?REQUEST=GetCapabilities&SERVICE=WMS&V ERSION=1.3.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_WMS/GetMap.ashx?REQUEST=GetCapabilities&SERVICE=W MS&VERSION=1.3.
Chapter 19: Web Map Service Configuring Layer Information for a WMS Server Configuring Layer Information for a WMS Server Layers are described in a WMS Server configuration file according to elements laid out in the MXP_WMSConfiguration_1_2.xsd schema. New for WMS 1.3 are in bold. These elements include: • • • • • • • • • • Name–a name of the layer that is used to reference the layer in requests. Title–a name of the layer that is readable by the user. Abstract–a longer narrative description of the layer.
Chapter 19: Web Map Service Configuring Layer Information for a WMS Server Your job, as developer of a WMS Server, is to decide how to assemble your data into WMS layers. For example, you may have geographic data broken out into 10 separate .TAB files, such as boundary files, point files and polyline files. In your WMS configuration file, you can represent these 10 layers as a single WMS layer or you can keep them as individual layers.
Chapter 19: Web Map Service Configuring Layer Information for a WMS Server Feature Layers and More You are not limited to including Feature layer information in your WMS layers. For example, you can also capture label, themes and style overrides in Workspace Manager and paste those sections in your WMS Configuration file. Here is a portion of an .MWS that defines a graduated symbol theme for a population layer. Notice that every element that defines the theme is captured here.
Chapter 19: Web Map Service Configuring Layer Information for a WMS Server MapXtreme v7.
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: Overview of MapInfo.Routing Namespace. . . . . . . . . . . . . . . . . .370 Calculating Routes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .371 Advanced Route Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .374 Iso Routing (Drive-Time and Drive-Distance) . . .
Chapter 20: Routing Overview of MapInfo.Routing Namespace Overview of MapInfo.Routing Namespace The MapInfo.Routing namespace provides an interface and classes for incorporating a MapXtreme routing client into your application, in a similar fashion to the geocoding client. The routing client sends requests via HTTP to Pitney Bowes Software’s routing server or routing web service product. The server and web service are not included in the purchase of MapXtreme.
Chapter 20: Routing Calculating Routes The following diagram illustrates the interfaces and classes that make up the Routing namespace: 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.
Chapter 20: Routing Calculating Routes • Updating a Request using Routing Data 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.
Chapter 20: Routing Calculating Routes The following code sample shows how to create a WayPointList consisting of a startPoint, endPoint, and ViaPoint: Public Shared Sub New_WayPointList() ’ Create a 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(-73, 42) Dim dpt3 As MapInfo.
Chapter 20: Routing Advanced Route Options routing, a list of sequences will be included in the response. Each sequence includes the start and end point, as well as the distance, and time. There are numerous additions you can make to a matrix route request to return additional information in the response. These additions are: • • • Routing Preferences Avoiding Points, Features, and Segments Updating a Request Using Routing Data A matrix route is created using the MatrixRouteRequest class.
Chapter 20: Routing Advanced Route Options • • • • • 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.
Chapter 20: Routing Advanced Route Options • • • • • 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.
Chapter 20: Routing Advanced Route Options 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. L Using the PointExclude class is the recommended method to avoid points. Avoiding Features Currently there are two methods to avoid features (road types) along the route.
Chapter 20: Routing Iso Routing (Drive-Time and Drive-Distance) • • 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.
Chapter 20: Routing Iso Routing (Drive-Time and Drive-Distance) Creating an IsoChrone (Drive-Time) When creating an isoChrone, you are looking for one or more polygons/set of nodes which represents an area that can be travelled in a given amount of time (drive-time cost) from a starting location. The cost specifies the time used to calculate the isoChrone. The cost represents the time it takes to travel from the starting point to the calculated points on the road network.
Chapter 20: Routing Iso Routing (Drive-Time and Drive-Distance) be a problem, but 120, 121, and 122 minute costs may be a problem. The larger the cost the larger the cost increments will need to be. 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.
Chapter 20: Routing Iso Routing (Drive-Time and Drive-Distance) • • • • • • • 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.
Chapter 20: Routing Iso Routing (Drive-Time and Drive-Distance) Creating an IsoDistance (Drive-Distance) When creating an isoDistance, you are looking for one or more polygons/set of nodes which represent the area that can be travelled along a road network, given a distance (drive-distance cost) from a starting location. The cost specified for an isoDistance request is similar to an isoChrone except the cost value is a measure of distance used to calculate the isogram.
Chapter 20: Routing Updating a Request Using Routing Data Updating a Request Using Routing Data Being able to access and your route data, then use this information to create more accurate and meaningful routes, is a very useful capability. After you create a route and get a route response, you may realize that the result contains a location or segment you don't want to pass, and a road type or segment where you may want to reduce or increase the speed.
Chapter 20: Routing Updating a Request Using Routing Data 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.
Chapter 20: Routing Updating a Request Using Routing Data • SegmentRelativeSpeedUpdate - Updates the speed of the segment 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 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.
Chapter 20: Routing Updating a Request Using Routing Data • 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.
Chapter 20: Routing Updating a Request Using Routing Data particular road type which will set those roads to a lower priority, and decrease the chance of them being used in the calculation. Use the following classes to perform the various road type transient updates: • 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.
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: What is Linear Referencing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .389 Using M values for Linear Referencing . . . . . . . . . . . . . . . . . . . .389 Curve Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 21: Linear Referencing What is Linear Referencing What is Linear Referencing Linear referencing is an alternative reference system to the traditional coordinate reference systems that tie locations of linear features to points on the earth. Linear referencing is used in many fields, including water resource management, transportation, and oil and gas exploration.
Chapter 21: Linear Referencing Using M values for Linear Referencing Linear Referencing Sample Application provided in MapXtreme The linear referencing methods follow the OGC Simple Feature Specification as it applies to one dimensional MultiCurve geometries. MultiCurves can consist of several disjointed curves. That is, two Curves can be contained within the MultiCurve for which the end of one Curve does not match the beginning of the other Curve.
Chapter 21: Linear Referencing Using M values for Linear Referencing Measure Value Determination Methods The operations that form this category are helper methods to assist in setting and managing measure values on a MultiCurve. Use them to fill in missing nodes along a MultiCurve when you have at least two M values, or if no M values are present, using a relative start and end node to set M values.
Chapter 21: Linear Referencing Curve Order Dynamic Segmentation Operation (PerpendicularOffset) Perpendicular offset is an operation that produces a new MultiCurve from an existing one. This is different from the above methods that extract a sub-curve with the same underlying x,y coordinates. This operation creates a parallel offset MultiCurve that is some distance measured perpendicularly from the original MultiCurve.
Chapter 21: Linear Referencing Linear Referencing Sample Application The ICurveSorter interface provides a SortCurves method which returns the curve order as an array of integers. You would then use the array to get to the list of curves. See the Developer Reference for a code example. L 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.
Web Feature Service MapXtreme provides the ability to host and/or access map feature data from internet or private intranet Web Feature Services (WFS). In this chapter: Web Feature Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .395 Understanding WFS Server Operations . . . . . . . . . . . . . . . . . . . .395 Configuring a WFS Server. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .400 Using the MapXtreme WFS Client Programmatically . . . . . . . . .
Chapter 22: Web Feature Service Web Feature Service Web Feature Service MapXtreme provides a Web Feature Service (WFS) implementation to send requests over the Internet or through a private intranet to retrieve geospatial data encoded in Geography Markup Language. While a Web Map Service yields a map image, requests to a WFS Server will generate GML, a form of XML that can capture geographic data. A basic WFS client can send three kinds of requests to a WFS server.
Chapter 22: Web Feature Service Understanding WFS Server Operations The following is the XML output from a GetCapabilities request. Some of the key elements are shown in bold text, including supported capabilities, available feature types, and filtering operations for requesting a subset of a feature type’s data. - PAGE 390Chapter 22: Web Feature Service Understanding WFS Server Operations - miwfs:USA Title for usa Abstract for USA Keywords for USA epsg:4326 PAGE 391Chapter 22: Web Feature Service Understanding WFS Server Operations • • • 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. - PAGE 392Chapter 22: Web Feature Service Understanding WFS Server Operations The following is a portion of a sample GetFeatureResponse for a feature type called USA. - PAGE 393Chapter 22: Web Feature Service Configuring a WFS Server Configuring a WFS Server If you have spatial data you wish to make available to others, you first must configure a WFS server to describe what data and capabilities you are offering. There are two configuration files that you need to provide to accomplish this. This discussion assumes you have a working knowledge of schemas and web services.
Chapter 22: Web Feature Service Configuring a WFS Server 5. For IIS 7 Integrated pipeline mode, copy the following section into the web.
Chapter 22: Web Feature Service Configuring a WFS Server 2. Register the tables that the WFS serves by creating a Table element for each table. The value for the id must match the value for . You can include the tables in any order. 3. In the , modify the MYPATH variable to reflect the actual path to your data. The following is a portion of the WFSSample.xml that identifies two tables of features.
Chapter 22: Web Feature Service Configuring a WFS Server MySQLServerTable my_sqlserver2000_advserver select * from MySQLServerTable Step 3: Con
Chapter 22: Web Feature Service Configuring a WFS Server 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.
Chapter 22: Web Feature Service Configuring a WFS Server 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.
Chapter 22: Web Feature Service Using the MapXtreme WFS Client Programmatically Using the MapXtreme WFS Client Programmatically MapXtreme comes with a WFS Client that you can use programmatically to access data from OGCcompliant Web Feature Services. The MapXtreme WfsClient provides the ability to interact with any WFS 1.0.0 compliant Server at the API level. The WfsClient and related classes are located in the MapInfo.Wfs.Client namespace and uses the WFS Basic portion of the OGC specification.
Chapter 22: Web Feature Service Using the MapXtreme WFS Client Programmatically • • • Spatial operators: BBox, Equals, Disjoint, Intersects, Within, Contains Non-spatial comparison operators: Logical operators: AND, OR, and NOT; PropertyIsEqualTo, PropertyIsGreaterThan, PropertyIsGreaterThanOrEqualTo, PropertyIsLessThan, PropertyIsLessThanOrEqualTo, PropertyIsNotEqualTo, Simple arithmetic operators: Add, Div, Mul, Sub L The HTTP protocol mandates a URL length for a GetFeature request of no more than 204
Chapter 22: Web Feature Service Using the MapXtreme WFS Client Programmatically MapInfo.Wfs.Client.IFilter filter = new MapInfo.Wfs.Client.PropertyIsGreaterThanOrEqualTo( new MapInfo.Wfs.Client.PropertyName(wfsUrl, "CAP_POP"), new MapInfo.Wfs.Client.Literal("1000000")); /// Create the Query container /// IList queries = new MapInfo.Wfs.Client.Query[] { new MapInfo.Wfs.Client.Query(new MapInfo.Wfs.Client.TypeName("http://www.mapinfo.
Chapter 22: Web Feature Service Creating a Map Layer from a WFS Response From the filtered GetFeature call, only those rows of data that satisfy PropertyIsGreaterThanOrEqualTo a population of 1,000,000 are returned. Notice Abu Dhabi is not included in the results since its population is listed as 722,000. Obj, Capital, Country, Cap_Pop, MI_Style, Point,Abidjan,IVORY COAST,2700000,MapInfo.Styles.SimpleVectorPointStyle: 12 point, Point,Addis Ababa,ETHIOPIA,1423111,MapInfo.Styles.
Chapter 22: Web Feature Service Creating a Map Layer from a WFS Response Parsing the WFS Response Parsing the response is not specified in the WFS specification, nor does the specification describe an exact format for the results of a GetFeature request. The WFS specification only states that the request must be at least GML2.
Chapter 22: Web Feature Service Creating a Map Layer from a WFS Response // register URL with a specific WFS reader WfsReaderFactory.RegisterHandler(URL, typeof(WfsReader)); // Get the WFS capabilities of the WFS server using the HTTP GET method. try { // Get the WFS capabilities of the WFS server using the HTTP GET method. WfsCapabilities Capabilities = WfsClient.GetCapabilities(RequestMethod.GET, URL); } catch { MessageBox.
Chapter 22: Web Feature Service Creating a Map Layer from a WFS Response // export the map to a file using (MapExport mx = new MapExport(map)) { mx.Format = ExportFormat.Gif; mx.Export(exportFileName); } // clean up the map Session.Current.MapFactory.Remove(map); } } } MapXtreme v7.
Workspace Manager The Workspace Manager utility that comes with MapXtreme enables you to create and manage XML-based workspace files (.MWS format). The Workspace Manager’s 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: Features of the Workspace Manager . . . . . .
Chapter 23: Workspace Manager Features of the Workspace Manager Features of the Workspace Manager The Workspace Manager allows you to control most of the settings that can be stored in a workspace file. For example, a workspace can contain information about cartographic legends and adornments; however, the Workspace Manager does not provide any options for creating cartographic legends or adornments. To create cartographic legends or adornments, use the API.
Chapter 23: Workspace Manager Workspace Format and Contents • Add extensions to add custom functionality to Workspace Manager and Layer Control. Workspace Format and Contents The workspace file is an XML document (.MWS) that contains the locations, descriptions, and metadata of all the maps, tables, layers, and settings that make up the workspace.
Chapter 23: Workspace Manager Workspace Manager Menu Commands 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.
Chapter 23: Workspace Manager Workspace Manager Menu Commands 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.
Chapter 23: Workspace Manager Workspace Manager Menu Commands 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.
Chapter 23: Workspace Manager Workspace Manager Menu Commands 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.
Chapter 23: Workspace Manager Workspace Manager Menu Commands The Previous View and Next View commands can be used together to toggle back and forth between two views of your map. These commands are also available as tools on the toolbar. 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.
Chapter 23: Workspace Manager Workspace Manager Menu Commands 8. Click OK when you are finished. The Ignore Zeros option on the Step 2 of 3 dialog is available when creating Pie and Bar chart themes and IndividualValue themes on Features or Labels. Note that when this option is set, the performance of the theme building operation in Workspace Manager may be affected. To modify a theme, highlight the theme in the Layer tree and click the Theme tab that displays.
Chapter 23: Workspace Manager Workspace Manager Menu Commands 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.
Chapter 23: Workspace Manager Workspace Manager Menu Commands 1. Choose Tools>Radius Select to activate the tool. The cursor changes to a selection arrow with a small circle underneath it when you move the cursor over the map. 2. Click a place on the map that you would like to use as the center point of your radius search. For example, if you want to select all the fire hydrants that fall within two miles of a fire station, click the fire station and use that as the center point. 3.
Chapter 23: Workspace Manager Workspace Manager Menu Commands 4. To close the polygon, make your last click as close as possible to the first click, or double-click on the last point. Workspace Manager closes the polygon and selects the objects that are within it. 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.
Chapter 23: Workspace Manager Layer Control To learn how to create custom extensions, see Workspace Manager Extensions in Appendix B: Customizing MapXtreme. 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.
Chapter 23: Workspace Manager Layer Control 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.
Chapter 23: Workspace Manager Layer Control • • • 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.
Chapter 23: Workspace Manager Layer Control 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.
Chapter 23: Workspace Manager Layer Control The Snap Tolerance setting specifies how far the tools will search for “snappable” nodes. You can choose which layers use the Snap to Node feature. For example, you might want to turn on Snap To Node, but only have the snap crosshair appear when the cursor is near a feature in a particular layer. 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 in the Options tab.
Chapter 23: Workspace Manager Layer Control 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.
Chapter 23: Workspace Manager Layer Control • Always–Raster reprojection is always performed. MapXtreme calculates the image’s coordinates based on a precise formula and then the pixels are resampled using either the Cubic Convolution or Nearest Neighbor methods. Use the Reprojection Resampling settings to specify a resampling method for the reprojected raster image.
Chapter 23: Workspace Manager Layer Control You can also select Show Nodes, Show Centroids, and Show Line Direction to display these items on the map layer. Nodes are the points that define segments of a line or multiline or polygon. A centroid is the center of a map object. Line direction is the direction in which the line was drawn (this is helpful on street layers to indicate the proper addressing sequence). Display these elements when you wish to edit map features.
Chapter 23: Workspace Manager Layer Control Select the Display Within Range check box to specify either a zoom range or scale range in which the theme appears. If you select a zoom range, specify the minimum and maximum zoom distance. Your theme appears within this range. If you select a scale range, specify the closest and farthest scale. Your theme appears within this scale range. Theme The Theme tab indicates the type of thematic map and the expression used to obtain the values.
Chapter 23: Workspace Manager Layer Control 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.
Chapter 23: Workspace Manager Layer Control 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.
Chapter 23: Workspace Manager Layer Control For example, suppose you are configuring the labels for the WorldCapitals layer, which contains point features that represent cities. You probably want the cities with the largest population to have the highest labeling priority. In this case, you would specify a labeling expression such as: cap_pop The cap_pop column represents the population of each capital city.
Chapter 23: Workspace Manager Layer Control Visibility Line/Label Properties Line Spacing MapXtreme v7.
Chapter 23: Workspace Manager Using Workspace Manager Features Extents After making any changes in this tab, click Set Extents to activate the changes. For more information on Graticules, see Graticule Layers. Using Workspace Manager Features This section shows you how to apply some of Workspace Manager’s features to enhance the cartographic quality of your maps.
Chapter 23: Workspace Manager Using Workspace Manager Features L 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.
Chapter 23: Workspace Manager Using Workspace Manager Features To programmatically change a color's translucency, use the System.Drawing.Color.FromArgb() method. This allows you to specify an alpha value for the desired color (in GDI+, the alpha channel is the portion of pixel color data reserved for transparency information). For more information, see the .NET documentation.. Translucency in all colors is supported and tools will work properly when translucency is enabled or disabled.
Chapter 23: Workspace Manager Using Workspace Manager Features To add translucent effects to a layer, use a style override to change the original style of the layer. L When you programmatically superimpose an override style modifier (OverrideType = AddNew), the first style drawn is the feature's style. Since the superimposed style is translucent, the features show through it. 1. In Workspace Manager’s Layer Control, select the "root" node in the layer control (this corresponds to the map).
Chapter 23: Workspace Manager Using Workspace Manager Features The Area Style dialog appears. 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.
Chapter 23: Workspace Manager Using Workspace Manager Features If you want to add a translucent label over your map as shown by this example: 1. In Workspace Manager’s 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 label source in the layer control and go to the Style tab. 3. Click the Text style button to display the Text Style dialog. 4.
Chapter 23: Workspace Manager Using Workspace Manager Features MapXtreme attempts to create a curved label for every arc and polyline record in a map, just as it does for non-curved labels. For example, in street maps, the street can be made of several polylines or one long polyline. The length and number of the polylines, the rules that govern whether a curved label can be created, and the labeling options you choose, all affect which curved labels are created and where they display.
Chapter 23: Workspace Manager Using Workspace Manager Features • • • • 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 (.
Chapter 23: Workspace Manager Using Workspace Manager Features 5. If necessary, use the Orientation buttons on the Position tab to set the label’s position relative to its anchor point. When you select: Left, the curved labels are left-justified starting at the beginning of the arc/polyline Center, the curved labels are centered on the midpoint of the arc/polyline Right, the curved labels are right-justified at the end of the arc/polyline L The length of the polyline(s) affect how the label is positioned.
Chapter 23: Workspace Manager Using Workspace Manager Features 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.
Chapter 23: Workspace Manager Using Workspace Manager Features Managing Graticule Layers After you have added a graticule layer, you can manage and customize the layer from the Layer Control in a number of ways. • • • • • • • Control graticule layer visibility and zoom/scale settings Show and configure spacing of major and minor graticule lines Control visibility and style of graticule labels and lines Specify the extents (in degrees, feet, or meters) of the graticule (east, west, north, south).
Using the GeoDictionary Manager The GeoDictionary Manager is a utility that comes with MapXtreme to aid in your Mapping applications. This chapter deals with how to use this tool. In this chapter: Using the GeoDictionary Manager . . . . . . . . . . . . . . . . . . . . . . . .450 Changes in the GeoDictionary Manager . . . . . . . . . . . . . . . . . . .450 The GeoDictionary Manager’s User Interface . . . . . . . . . . . . . . .450 The GeoDictionary File . . . . . . . . . . . . . . . . . . . . . .
Chapter 24: Using the GeoDictionary Manager Using the GeoDictionary Manager Using the GeoDictionary Manager The GeoDictionary Manager application is designed to support the manipulation of a GeoDictionary file. The GeoDictionary is an XML file containing registration information about the MapInfo tables that can be matched by your application during automatic databinding. Only MapInfo tables that can or will be matched against should be registered in the GeoDictionary. There is no need to register every .
Chapter 24: Using the GeoDictionary Manager The GeoDictionary Manager’s User Interface 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.
Chapter 24: Using the GeoDictionary Manager The GeoDictionary Manager’s User Interface 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.
Chapter 24: Using the GeoDictionary Manager The GeoDictionary File Part Table used to refine searches 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.
Chapter 24: Using the GeoDictionary Manager The GeoDictionary File County Fips_code The elements in the structure correspond to individual fields and controls in the GeoDictionary Manager as defined in the following table: XML Element Table Properties Dialog Box Field Description GeoDictionary none The root element of the file DefaultMatchThr
Chapter 24: Using the GeoDictionary Manager The GeoDictionary File XML Element Table Properties Dialog Box Field Description MatchFields none This element is a container for MatchField and FieldName elements. MatchField, FieldName Field Information list box. Each item in the list box that is checked to be searched for automatch and binding. MapXtreme v7.
How to Create and Deploy a MapXtreme Application This appendix is designed as a tutorial to demonstrate the simplicity of creating, packaging, and deploying a MapXtreme application. At the end of this tutorial you will have gone through all the steps to successfully develop, package, and deploy a well-implemented mapping application. This tutorial assumes that you have already successfully installed Visual Studio and are familiar with the use of that product.
Appendix A: How to Create and Deploy a MapXtreme Application Customizing MapXtreme Samples Customizing MapXtreme Samples This appendix contains two tutorials: • • Building a Desktop Application Building a Web Application These tutorials guide you through customizing MapXtreme desktop applications and Web Applications and preparing them for deployment. Building a Desktop Application We are going to base our desktop application on one of the thematic sample applications provided with MapXtreme.
Appendix A: How to Create and Deploy a MapXtreme Application Building a Desktop Application The application displays a standard map of the United States with a theme based on the land area of each state. The larger states are shaded in blue and the smaller states are shaded in white. The legend shows the color assigned to each range of land area values. The tools provided with the application enable you to perform some basic functions.
Appendix A: How to Create and Deploy a MapXtreme Application Building a Desktop Application 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, let’s make changes to the theme itself.
Appendix A: How to Create and Deploy a MapXtreme Application Building a Desktop Application 7. We’ll increase the number of ranges, or bins, in the theme. On line 221 change the number of bins from 5 to 8. (A bin is a range consisting of a maximum and minimum value and is used by themes to group together like values for the purpose of shading.) 8. Next, we’ll change the distribution method of the ranges. The distribution method indicates how the ranges are calculated.
Appendix A: How to Create and Deploy a MapXtreme Application Building a Desktop Application Next we’ll 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. Let’s change the colors to range from blue to red. 11.
Appendix A: How to Create and Deploy a MapXtreme Application Building a Desktop Application Because we have made a number of changes, the legend is now partially blocking the view of the map. We’ll 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, we’ll change the position of the legend programmatically.
Appendix A: How to Create and Deploy a MapXtreme Application Building a Desktop Application 15. Choose Debug > Start Debugging (or press F5) to build and run your application. Now the legend is in its new location. Close the Form1 window when you are finished. The last modification we’ll make is to add a Label tool to the toolbar. 16. In Visual Studio, open MapForm1.vb in Design mode. 17.
Appendix A: How to Create and Deploy a MapXtreme Application Building a Desktop Application 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. Don’t forget to refresh the legend to match.
Appendix A: How to Create and Deploy a MapXtreme Application Building a Desktop Application Packaging Your Desktop Application This section of the tutorial shows you how to package your desktop application. A package is a collection of files and directories required for a software product. A product must be built into one or more packages so that it can be transferred to a distribution medium, such as a CD-ROM or DVDROM.The package for a desktop application consists of a Setup.
Appendix A: How to Create and Deploy a MapXtreme Application Building a Desktop Application 5. In the Add > File dialog box, select All Files from the dropdown list in the Files of Type box, then navigate to the location of your data files. 6. Select all of the files you need to add to the setup project. 7. Click Open. The files are added to the Solution Explorer, under the ThemeLegendVB project. 8. Repeat steps 5-8 if you have files in different paths to add to your setup project.
Appendix A: How to Create and Deploy a MapXtreme Application Building a Web Application Optional Step: Add Workspace Manager and GeoDictionary Manager If you wish, include the MapXtreme utilities Workspace Manager and GeoDictionary Manager in your package, so your customers can use them. Follow the steps under section Add a License File. Substitute \WorkspaceManager.exe and GeoDictionaryManager.exe. for MapXtreme.lic.
Appendix A: How to Create and Deploy a MapXtreme Application Building a Web Application 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.
Appendix A: How to Create and Deploy a MapXtreme Application Building a Web Application Modifying Your Application To modify this sample application, let’s look at the code behind page, WebForm1.aspx.vb. The code behind page is the code that represents the HTML for the Web form. L This Thematics sample Web application is designed very differently than its desktop sample application counterpart.
Appendix A: How to Create and Deploy a MapXtreme Application Building a Web Application 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 let’s make one more simple change to the Web sample. This change is to the Range Theme. 4. Make the following changes: • • Under the ThemeAndModifierTypes.
Appendix A: How to Create and Deploy a MapXtreme Application Building a Web Application Notice how the theme has changed with more data bins (color codings) and how the countries have changed theme color based on the new data distribution method. 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.
Appendix A: How to Create and Deploy a MapXtreme Application Building a Web Application Configuring for Release Mode When you have completed the modifications, you are ready to do a release build. An important concept to understand in ASP.NET 2.0 is that Visual Studio 2005/2008 knows nothing about compiling a Web Application project. Previously, ASP.NET 1.1 and Visual Studio .NET would build the code-behind source code and web forms and place the compiled code in an output directory.
Appendix A: How to Create and Deploy a MapXtreme Application Building a Web Application The next step is to indicate which parts of the solution to include. 4. In Solution Explorer, right-click on the newly-created Web Setup project and choose Add > Project Output. The Add Project Output Group dialog box displays on the screen. 5. Click on Contents Files and click OK.
Appendix A: How to Create and Deploy a MapXtreme Application Building a Web Application Add a License File When you package a MapXtreme Web application, you need a valid copy of MapXtremeWeb.lic to enable your users to access any maps. For more information on deployment licenses, see Runtime Licenses for Deployment. For this example, we are using the trial license1 that comes with your version of MapXtreme. 1. First, we’ll create a location for the license file.
Appendix A: How to Create and Deploy a MapXtreme Application Building a Web Application 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. Build Web Setup Project Now you are ready to build your Web setup project. 1. Choose Build > Batch Build. The Batch Build dialog box displays on the screen. 2.
Appendix A: How to Create and Deploy a MapXtreme Application Building a Web Application To see the Web Application run, open a browser, and enter the URL: http:///ThematicsWeb_7_0/. The URL should be the location of the Web application on the production server, using the virtual directory that you specified when you packaged the application. After installation you should restart the IIS server on the machine by issuing an iisreset in a command prompt.
Customizing MapXtreme This appendix contains examples of classes, interfaces, and other elements of MapXtreme which can be customized. In this appendix: Customizable Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .478 Workspace Manager Extensions . . . . . . . . . . . . . . . . . . . . . . . . .485 Location of Application Data Files . . . . . . . . . . . . . . . . . . . . . . . .489 Find Abbreviation File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Appendix B: Customizing MapXtreme Customizable Classes 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.
Appendix B: Customizing MapXtreme Customizable Classes Public Shared Sub MapInfo_Engine_CustomProperties() Dim bag As CustomProperties = New CustomProperties bag.Add("One", 1) bag.Add("DateNow", DateTime.Now) Dim i As Integer = CType(bag("One"), Integer) Dim ts As DateTime = CType(bag("DateNow"), DateTime) End Sub 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.
Appendix B: Customizing MapXtreme Customizable Classes { public UsaPopulationDecreasedModifier() : base(null, null) { // use 2 columns for expressions Expressions = new string[] { I18N.Wrap( "Pop_1990",I18N.WrapType.Column), I18N.Wrap("Pop_2000",I18N.WrapType.Column) }; } // called during draw events protected override System.Boolean Modify(MapInfo.Styles.FeatureStyleStack styles, object[] values) { // compares the values from each column if ( double.Parse(values[0].ToString()) > double.Parse(values[1].
Appendix B: Customizing MapXtreme Customizable Classes public MyUserDrawLayer(string Name, string Alias) : base(Name, Alias) {} // Override the abstract Draw method to draw a rectangle. public override void Draw(System.Drawing.Rectangle ClientRect, System.Drawing.Rectangle UpdateRect, Graphics graphics) { // Create a pen. Pen blackPen = new Pen(Color.Black, 3); // Create location and size of rectangle. float x = 10.0F; float y = 10.0F; float width = 200.0F; float height = 200.
Appendix B: Customizing MapXtreme Customizable Classes display a confirmation prompt, even when the GroupLayer is empty, create a class that derives from GroupLayerNodeHelper and override the IsRemovalConfirmed method. The code example below illustrates how this is done. using System; using MapInfo.Windows.Controls; namespace MapInfo.Samples.
Appendix B: Customizing MapXtreme Customizable Classes 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.
Appendix B: Customizing MapXtreme Customizable Classes StyleRepository styleRepository = Session.Current.StyleRepository; LineStyleRepository lineStyleRepository = styleRepository.LineStyleRepository; lineStyleRepository.Reload("C:\MyData\MyLineStyles.PEN"); 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.
Appendix B: Customizing MapXtreme Workspace Manager Extensions XmlNode userData = this.UserDataXmlNode; foreach (XmlNode childNode in userData.ChildNodes) { string text = childNode.Name; text = childNode.InnerText; // user can do their own load stuff here } } } Workspace Manager Extensions MapXtreme’s workspace-building tool Workspace Manager can be extended to add new menu commands, tools and tab windows that make creating workspaces easier.
Appendix B: Customizing MapXtreme Workspace Manager Extensions void ShowPropertiesDialog(IWin32Window owner); IWorkspaceManagerNotifications Load(IWorkspaceManager callback); void Unload(); } To create an extension, create an assembly with at least one class that implements the IWorkspaceManagerExtension interface. The class should have a constructor that takes no arguments.
Appendix B: Customizing MapXtreme Workspace Manager Extensions System.Windows.Forms.TabControl MainTabControl{get;} ContextMenuStrip MapContextMenu{get;} ContextMenuStrip LegendContextMenu{get;} ContextMenuStrip GenericTabContextMenu{get;} } 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.
Appendix B: Customizing MapXtreme Workspace Manager Extensions Command Line Arguments for Loading Extensions You can also control from the command line where Workspace Manager should look for extensions to load: /LoadExtensions=[All|Folder|None] Where: All means to look in loaded assemblies and look in the Extensions folder Folder means only look in the Extensions folder and skip the loaded assemblies None means do not autoload any extensions Unloading Your Extension An extension can be unloaded by the us
Appendix B: Customizing MapXtreme Location of Application Data Files public IWorkspaceManagerNotifications Load(IWorkspaceManager callback) { _callback = callback; Microsoft.Win32.RegistryKey key = _callback.GetRegistryKey(); string s = (string)key.GetValue("RecentFiles"); if (s != null && s.Length > 0) { try { string[] files = s.Split('|'); callback.LoadWorkspace(files[0]); } catch { } } key.
Appendix B: Customizing MapXtreme Location of Application Data Files File Type Filename Projection file MapInfoCoordinateSystemSet.xml Vector symbol file MapInfow.fnt Custom symbol directory CustSymb Nadcon files *.las, *.los jgd2000 files jgd2000.* By default, MapXtreme applications look in the following directories for data files: • • • C:\Program Files\Common Files\MapInfo\MapXtreme\7.x.x—This is the directory the MapXtreme installer places these files.
Appendix B: Customizing MapXtreme Find Abbreviation File In this example MapXtreme will search for custom symbols in a folder like C:\Documents and Settings\username\Application Data\Your Corporation\Your Application\CustSymb. Note that the element should not include the CustSymb folder name. If it does, the path would be interpreted as ...\Your Application\CustMapXrtreme 2004\CustSymb\CustSymb. The duplicated "CustSymb" would be incorrect.
Understanding the MapInfo Workspace MapXtreme provides a workspace format that is portable, interoperable, and uses the MapInfo codespace definition. This appendix covers its definition, capabilities and use. For more about the MapInfo codespace definition, see Appendix G: Defining the MapInfo Codespace. In this appendix: What is the MapInfo Workspace? . . . . . . . . . . . . . . . . . . . . . . . . .493 Creating an .MWS Workspace Programmatically from a .GST .497 Structure of a Workspace . . . . .
Appendix C: Understanding the MapInfo Workspace What is the MapInfo Workspace? What is the MapInfo Workspace? Using MapXtreme, you can persist the maps you create as XML-based workspaces (with an .MWS extension) that are portable and interoperable. You will then be able to share these maps with anyone else using MapInfo products regardless of their working environment.
Appendix C: Understanding the MapInfo Workspace Structure of a Workspace 4. The MapDefinition Section contains definitions of layer, theme, and label features associated with the workspace, such as the label details, the zoom range, the colors used, etc. Named definitions for the map, layers, themes, styles would be included here. An additional section in the schema is for user-defined data. This allows applications to persist their own data.
Appendix C: Understanding the MapInfo Workspace Structure of a Workspace DataSource Definition Section The DataSource Definition section defines the data files (for example, TAB files) and database tables that are retrieved at each connection location. Optional metadata may also be included to describe the data that is retrieved. This example shows a named data source definition, a database datasource definition, and a TAB data source definition.
Appendix C: Understanding the MapInfo Workspace Structure of a Workspace -79.771366,38.
Appendix C: Understanding the MapInfo Workspace Creating an .MWS Workspace Programmatically from a .
Appendix C: Understanding the MapInfo Workspace Creating an .MWS Workspace Programmatically from a .GST // Reads a MapX geoset, writes a MapXtreme workspace. using MapInfo.Persistence; using MapInfo.Mapping; . . . MapLoader MapLoader = MapLoader.CreateFromFile("my.gst"); MapExport MapExport = new MapExport(); MapExport.Map.Load(MapLoader); WorkSpacePersistence wsp = new WorkSpacePersistence(); wsp.Save("c:\\temp\\newwork.mws"); MapXtreme v7.
Extensible Data Providers This appendix presents MapXtreme’s Extensible Data Provider architecture and information on how to construct one for spatial data that MapXtreme does not otherwise provide access for. In this appendix: Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .500 Extensible Data Provider Overview . . . . . . . . . . . . . . . . . . . . . . .500 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Appendix D: Extensible Data Providers Introduction 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 MapXtreme’s data provider model is a difficult undertaking that requires a major commitment of development and testing resources.
Appendix D: Extensible Data Providers Extensible Data Provider Overview There are a few central concepts to understanding how a data provider works and how to go about creating one. The figure below illustrates the relationship between a few of the key interfaces and the existing components of the MapXtreme data access engine. The components of an extensible data provider are shown in lavender with thick borders.
Appendix D: Extensible Data Providers Getting Started Most data provider implementations will contain a data source; however, this concept is not required. Data providers for file based formats may contain only a table model. MapInfo tables and ESRI Shapefiles are examples of data providers that do not require a connection to a data source. Table A table is a set of features that have the same schema (or set of columns).
Appendix D: Extensible Data Providers Getting Started World) Data Provider to see how we have implemented a basic data provider and the SpatiaLite Sample Data Provider which is a full featured data provider installed with source code with the MapXtreme samples. We also recommend that you study the optional building blocks provided in the SDK to learn what has already been implemented for you. See Optional Building Blocks: Base Classes, Helpers and Utilities.
Appendix D: Extensible Data Providers Required Components 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.
Appendix D: Extensible Data Providers Required Components This interface is also typically the information that you will want to have written out to the workspace file. For more information, see Persistence Providers. 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.
Appendix D: Extensible Data Providers Optional Building Blocks: Base Classes, Helpers and Utilities Optional Building Blocks: Base Classes, Helpers and Utilities The MapXtreme Extensible Data Provider is a collection of interfaces that you can implement to access data in formats that are currently not supported. MapXtreme provides a collection of utilities, samples and guidance that can help you jump start your implementation. These are common implementations that most people will want to use.
Appendix D: Extensible Data Providers Sample: COTW (Center of the World) Data Provider The utilities are included in the MapInfo.OGC namespace. It implements data readers and writers for well-known text and well-known binaries and supports both big endian and little endian byte ordering. 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.
Appendix D: Extensible Data Providers Sample: COTW (Center of the World) Data Provider Note that this class is extended from AbstractDataProvider - not IDataProvider itself. As discussed in the Optional Building Blocks: Base Classes, Helpers and Utilities, we provide abstract base classes as building blocks to help provide suitable default implementations wherever possible.
Appendix D: Extensible Data Providers Optional Interfaces 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.
Appendix D: Extensible Data Providers Building and Testing Your Data Provider Building and Testing Your Data Provider Building a data provider is a complex task and is difficult to debug because most of the calls into your data provider code is made by MapXtreme. You will want to build up your data provider in stages and test just the pieces that you have implemented as you go.
Appendix D: Extensible Data Providers SpatiaLite Sample Data Provider Before moving on, you should add support for the SearchByEnvelope method. This will help you get a feel for the performance of your data provider since you now have the ability to send back to MapXtreme only the features that it needs to render the map. You can also turn back on the InfoTip setting and set the InfoTip expression to various values to see if you are getting the right data passed up to MapXtreme.
Appendix D: Extensible Data Providers Advanced Topics / Important Considerations SpatiaLite Data Provider Extension The code in this project shows how the MapXtreme Extensible Data Provider classes and interfaces have been extended to create a SpatiaLite data provider that allows you to open SpatiaLite tables, insert/update/delete records, search tables, changes the styles, and import new tables into an SQLite3 database. Abstract base classes have been used to make coding more efficient. See the Readme.
Appendix D: Extensible Data Providers Advanced Topics / Important Considerations 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.
Appendix D: Extensible Data Providers Advanced Topics / Important Considerations This processing time can be expensive. It is necessary for interactive editing operations where moving a single node may make an interior polygon suddenly become an exterior polygon. Data providers typically already know that their data has been formatted and stored in a way that does not require this expensive processing every time a geometry is built.
Appendix D: Extensible Data Providers Advanced Topics / Important Considerations 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 table’s 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.
Appendix D: Extensible Data Providers Advanced Topics / Important Considerations 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.
Appendix D: Extensible Data Providers Advanced Topics / Important Considerations SupportsDataProvider() is used to identify providers responsible for ITableDefinition and IDataSourceDefinition constructs for a given IDataProvider. Generally, persistence providers are written to support a single data provider, so the implementation for this method can often be as simple as determining if the provided IDataProvider is an instance of your data provider class.
Appendix D: Extensible Data Providers Advanced Topics / Important Considerations The write methods must create an XmlElement that is inserted into the workspace XML. The elements are bound to an XML document instance, so the XmlDocument is provided along with the extensible data provider definition interface to be persisted.
Appendix D: Extensible Data Providers Advanced Topics / Important Considerations the ITableDefinition and ITable interfaces. The ITableDefinition and IDataSourceDefinition interfaces must also provide meaningful overrides to the Equals method in order for deserialization to work properly. The classes implementing ITableMetadata are not required to be explicitly serializable, although there are practical reasons to do so.
Appendix D: Extensible Data Providers Advanced Topics / Important Considerations The IDataSource reference within the ITable should not be serialized as MapXtreme will take care of automatically serializing the datasource for the table. Shared object references are re-established via the serialization logic provided by MapXtreme. The extensible data provider API contains the hooks necessary for the core MapXtreme data access engine to accomplish this work.
Appendix D: Extensible Data Providers Advanced Topics / Important Considerations For additional information and examples, consult the MapXtreme Developer Reference (online Help), the SpatiaLite Sample Data Provider presented in this appendix, and other data provider examples located on the MapXtreme Code Exchange.
Appendix D: Extensible Data Providers Advanced Topics / Important Considerations A typical example of a callback is one which, in a desktop application environment, the OpenDataSource callback resolves a credential authentication error by presenting the user with a dialog, requesting a valid username/password combination for the data provider.
Appendix D: Extensible Data Providers Advanced Topics / Important Considerations DataProviderCallback cb = new DataProviderCallback(); cb.DataSourceDefinitionCallback = InvalidCredentialsCb; // Associate the IDataProviderCallback with the EDP definition data type Session.Current.Catalog.DataProviderCallbacksCollection.
Appendix D: Extensible Data Providers Advanced Topics / Important Considerations } catch (Exception e) { cbinfo = new DataProviderCallbackExceptionInfo(e); } if (ds == null && callbacks != null) { while (!needDS && callbacks.MoveNext()) { // callback will return null if it is unable to modify the // the definition appropriate for a retry attempt // Example: User selected cancel from a credential input dialog tmpDsDef = callbacks.Current.
Appendix D: Extensible Data Providers Advanced Topics / Important Considerations operations while it is open for read operations in a different thread (or different process altogether). For these scenarios, it is important to consider how you architect your data provider. Cursors, feature accessors, and modify processors are all intended to imply a certain type of locking to the data where that may be required.
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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Appendix E: Printing From MapXtreme Applications Overview 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 user’s printing experience. These options are designed to optimize printing depending on the map being printed and the device being used.
Appendix E: Printing From MapXtreme Applications Understanding the Print Options in MapXtreme 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.
Appendix E: Printing From MapXtreme Applications Understanding the Print Options in MapXtreme this to false to let the printing device handle how it prints transparent fill patterns and transparent bitmap symbols. See Need for Speed When Using Fill Patterns? for details about which fill patterns are bitmaps and which are vectors. Display Raster in True Color When Possible Some printers do not support 24-bit (true color) images. MapXtreme has an internal functionality that accommodates this.
Appendix E: Printing From MapXtreme Applications Understanding the Print Options in MapXtreme If you set EnableTranslucency to false, SmoothingMode will automatically be set to None if it is not already. If you set SmoothingMode to AntiAlias, EnableTranslucency will automatically be set to true if not already. While EnableTranslucency is true, you can switch SmoothingMode between None and AntiAlias without losing translucency. MapStyleControl Class The MapStyleControl (MapInfo.Windows.
Appendix E: Printing From MapXtreme Applications Implementing Printing in Your Application patterns, you should set this value to true in order to prevent the printed output from displaying too small and appearing like a solid fill. See Need for Speed When Using Fill Patterns? for details about which fill patterns are bitmaps and which are vectors.
Appendix E: Printing From MapXtreme Applications Implementing Printing in Your Application this.mapPrinting.PageSettingsDialog(); You have access to the printer settings through the print document, which is part of the main printing class. Because we add setting and options to our derived class that support our mapping needs, you must get the class off the map printing object and re-cast it to our derived class. mapPrinting = new MapPrinting(); mapPrinting.Map = mapControl1.
Appendix E: Printing From MapXtreme Applications General Printing Tips and Tricks 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. General Printing Tips and Tricks L 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.
Appendix E: Printing From MapXtreme Applications General Printing Tips and Tricks MapInfo.Mapping.IMapLayerFilter filter = MapInfo.Mapping.MapLayerFilterFactory.FilterByLayerType(normalLyr); MapInfo.Mapping.Legends.LegendFrame frame; foreach(MapInfo.Mapping.FeatureLayer ftrLayer in mapControl2.Map.Layers.GetMapLayerEnumerator(filter)) { frame = MapInfo.Mapping.Legends.LegendFrameFactory.CreateCartographicLegendFrame( ftrLayer); legend.Frames.Append(frame); } //set legend location on the map System.Drawing.
Appendix E: Printing From MapXtreme Applications General Printing Tips and Tricks Need for Speed When Using Fill Patterns? Note that the first six fill patterns (after the solid fill) in of the AreaStyle dialog box are Windows standard and tend to print faster. These fill patterns are vector-based. The rest of the patterns are bitmaps that ship with MapXtreme. You might want to consider this when you are selecting fill patterns. 1 1 Use these fill patterns for fast printing results.
Appendix E: Printing From MapXtreme Applications Resolutions to Known Printing Issues 1 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 printer’s properties. 3. Click the Advanced tab to display the advanced property options.
Appendix E: Printing From MapXtreme Applications Resolutions to Known Printing Issues Hatch Patterns Printing as Black Polygons Printers/Plotters: HP Designjet Series Plotters Issue: When you print maps with hatch patterns, some regions display as solid black. Resolution: According to Hewlett Packard support, the new HP printer driver (4.63) handles nonWindows standard hatch patterns properly. We recommend that you download and install the new HP 4.63 driver to resolve this problem.
Appendix E: Printing From MapXtreme Applications Resolutions to Known Printing Issues 2. Click the Advanced tab. Select the following options: • • Select the Avoid out of memory option. If you are using the Windows 2000 or XP operating system, select a scaling factor of 100%. 3. From this dialog box, click the Printing Defaults button. 4. In this dialog box, select the About button. The About dialog box displays. 5. Holding down the F8 key on your keyboard, click the OK button.
Appendix E: Printing From MapXtreme Applications Resolutions to Known Printing Issues saved under the Quick Set name. The printer driver remembers these settings and they can be used for future print jobs. To print a raster map later with the same settings: 1. Choose the Print command to display the Print dialog box. 2. Choose the Properties button. The Properties dialog box displays. 3.
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. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .541 Line Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .555 Vector Symbols . . . . .
Appendix F: Style Lookups Fill Patterns 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.
Appendix F: Style Lookups Fill Patterns Second, the 0-based indexing scheme must remain synchronized with the 1-based indexing scheme shown in the Pattern Number column. So there are only 172 distinct fill patterns whose indexes range from 1 to 172. The programmatic fill pattern at index 0 was added to give a definition for that index's element. L You will notice that the first eight fill patterns have the same Index Number and Pattern Number.
Appendix F: Style Lookups Fill Patterns Fill Patterns and Associated Index and Patterns Numbers (continued) Fill Pattern MapXtreme v7.
Appendix F: Style Lookups Fill Patterns Fill Patterns and Associated Index and Patterns Numbers (continued) Fill Pattern MapXtreme v7.
Appendix F: Style Lookups Fill Patterns Fill Patterns and Associated Index and Patterns Numbers (continued) Fill Pattern MapXtreme v7.
Appendix F: Style Lookups Fill Patterns Fill Patterns and Associated Index and Patterns Numbers (continued) Fill Pattern MapXtreme v7.
Appendix F: Style Lookups Fill Patterns Fill Patterns and Associated Index and Patterns Numbers (continued) Fill Pattern MapXtreme v7.
Appendix F: Style Lookups Fill Patterns Fill Patterns and Associated Index and Patterns Numbers (continued) Fill Pattern MapXtreme v7.
Appendix F: Style Lookups Fill Patterns Fill Patterns and Associated Index and Patterns Numbers (continued) Fill Pattern MapXtreme v7.
Appendix F: Style Lookups Fill Patterns Fill Patterns and Associated Index and Patterns Numbers (continued) Fill Pattern MapXtreme v7.
Appendix F: Style Lookups Fill Patterns Fill Patterns and Associated Index and Patterns Numbers (continued) Fill Pattern MapXtreme v7.
Appendix F: Style Lookups Fill Patterns Fill Patterns and Associated Index and Patterns Numbers (continued) Fill Pattern MapXtreme v7.
Appendix F: Style Lookups Fill Patterns Fill Patterns and Associated Index and Patterns Numbers (continued) Fill Pattern MapXtreme v7.
Appendix F: Style Lookups Fill Patterns Fill Patterns and Associated Index and Patterns Numbers (continued) Fill Pattern MapXtreme v7.
Appendix F: Style Lookups Line Styles Fill Patterns and Associated Index and Patterns Numbers (continued) Fill Pattern Index Number Pattern Number 170 173 171 174 172 175 Line Styles MapXtreme v7.
Appendix F: Style Lookups Vector Symbols 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.
Appendix F: Style Lookups Vector Symbols MapInfo Miscellaneous MapInfo Oil &Gas MapInfo Shields MapXtreme v7.
Appendix F: Style Lookups Vector Symbols MapInfo Real Estate Map Symbols MapInfo Symbols MapInfo 3.0 Compatible symbols MapXtreme v7.
Appendix F: Style Lookups Vector Symbols MapInfo Transportation MapInfo Weather MapXtreme v7.
Appendix F: Style Lookups Custom Symbols 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.
Appendix F: Style Lookups Custom Symbols MAIL1-32 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.
Appendix F: Style Lookups MapXtreme Icons 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).
Appendix F: Style Lookups MapXtreme Icons 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 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.
Appendix F: Style Lookups MapXtreme Icons UNDO UNSELECT_AL WEB_SERVIC L E_PREF ZOOM_OUT ZOOM_QUEST ION MapXtreme v7.
Defining the MapInfo Codespace 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: Defining the MapInfo Codespace . . . . . . . . . . . . . . . . . . . . . . . . .
Appendix G: Defining the MapInfo Codespace Defining the MapInfo Codespace Defining the MapInfo Codespace In the following table, we show the current MapInfo Codespace. These definitions will allow your XML-based map documents to use our codespace and refer to common values, such as srsName. An example of a point geometry definition, for example, could look like this: ... or ...
Appendix G: Defining the MapInfo Codespace Defining the MapInfo Codespace MapInfo Codespace Definition (continued) Category imagesize Position 1 Position 2 Position 3 Position 4 pixel Explanation and Example A non-linear unit of image dimension. Example: mapinfo:imagesize pixel type A data type.
Appendix G: Defining the MapInfo Codespace Defining the MapInfo Codespace MapInfo Codespace Definition (continued) Category Position 1 Position 2 Position 3 operators Position 4 Explanation and Example A scalar attribute comparison operator or a geometry operator or a boolean operator. eq | neq | lt | gt | lteq | gteq Binary scalar value operator. in | not_in Scalar value in/not_in an enumerated set of scalar values, e.g.
Appendix G: Defining the MapInfo Codespace Defining the MapInfo Codespace MapInfo Codespace Definition (continued) Category operators (continued) Position 1 Position 2 Position 3 mbr_intersects Position 4 Explanation and Example The the mbr (minimum bound rectangle) of the feature geometry (fg) intersects the mbr of the given Polygon. Example: mapinfo:op mbr_intersects contains The feature geometry (fg) contains the given Point. The given Polygon contains the feature geometry fg.
Appendix G: Defining the MapInfo Codespace Defining the MapInfo Codespace MapInfo Codespace Definition (continued) Category Position 1 Position 2 Position 3 area Position 4 Explanation and Example A unit of area. sq Square linear units. in | ft | yd | mi | mm | cm | m | km | sft | nmi | li | ch | rd | pt | twip | pica | degree Example: mapinfo:area sq mi A predefined area unit.
Elements of a Coordinate System This appendix provides a detailed look at the elements of coordinate systems, including supported datums, ellipses, and transformations. In this appendix: Projections and Their Parameters . . . . . . . . . . . . . . . . . . . . . . . .572 Projection Datums . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .576 Datum Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .588 Custom Datums . . . . . . . . . . . .
Appendix H: Elements of a Coordinate System Projections and Their Parameters Projections and Their Parameters Standard Parallel 2 X X X Azimuthal Equidistant X X X X Cassini-Soldner X X X X Cylindrical Equal Area X X X Double Stereographic X X X Eckert IV X X X Eckert VI X X X Equidistant Conic X X X Gall X X X Hotine Oblique Mercator X X X X Lambert Azimuthal Equal-Area X X X X Lambert Conformal Conic X X X X Longitude-Latitude X Mercator X X X M
X Stereographic X X X X Swiss Oblique Mercator X X X X Transverse Mercator X X X X X X X X X X X X Range X False Northing X False Easting Sinusoidal Scale Factor X Azimuth X Standard Parallel 2 Origin, Longitude X Standard Parallel 1 Units Robinson Origin, Latitude Datum Appendix H: Elements of a Coordinate System Projections and Their Parameters Projection The projection is the equation or equations used by a coordinate system.
Appendix H: Elements of a Coordinate System Projections and Their Parameters Number Projection 3 Lambert Conformal Conic 19 Lambert Conformal Conic (modified for Belgium 1972) 1 Longitude/Latitude 10 Mercator 11 Miller Cylindrical 13 Mollweide 18 New Zealand Map Grid 27 Polyconic 26 Regional Mercator 12 Robinson 16 Sinusoidal 20 Stereographic 25 Swiss Oblique Mercator 8 Transverse Mercator, (also known as Gauss-Kruger) 21 Transverse Mercator, (modified for Danish System 34 Jyl
Appendix H: Elements of a Coordinate System Projections and Their Parameters Projection numbers in the MapInfoCoordinateSystemSet.xml may be modified by the addition of a constant value to the base number listed in the Projection table, above. Valid values and their meanings are tabulated below: Constant Meaning Parameters 1000 System has affine transformations Affine units specifier and coefficients appear after the regular parameters for the system.
Appendix H: Elements of a Coordinate System Projection Datums Alternatively, if you want to bound the system to (x1, y1, x2, y2)=(-500000, 0, 500000, 1000000), the required line is: UTM Zone 1 (NAD 83)- bounded coordsys 8,33,7,-177,0,0.
Appendix H: Elements of a Coordinate System Projection Datums Number Datum Area Maps Ellipsoid 1007 AGD 66, 7 parameter Australia, A.C.T.
Appendix H: Elements of a Coordinate System Projection Datums Number Datum 1009 Australia (Victoria/NSW AGD66 7-param) 151 Average Terrestrial System 1977 (ATS77) 120 Area Maps Ellipsoid Victoria, NSW Australian National Ayabelle Lighthouse Djibouti Clarke 1880 110 Belgium Belgium International 14 Bellevue (IGN) Efate and Erromango Islands International 15 Bermuda 1957 Bermuda Islands Clarke 1866 16 Bogota Observatory Colombia International 121 Bukit Rimpah Bangka and Belitun
Appendix H: Elements of a Coordinate System Projection Datums Number Datum Area Maps Ellipsoid 26 DOS 1968 Gizo Island (New Georgia Islands) International 27 Easter Island 1967 Easter Island International 115 EUREF 89 Europe GRS 80 28 European 1950 (ED 50) Austria, Belgium, Denmark, Finland, France, Germany, Gibraltar, Greece, Italy, Luxembourg, Netherlands, Norway, Portugal, Spain, Sweden, Switzerland International 29 European 1979 (ED 79) Austria, Finland, Netherlands, Norway, Spain,
Appendix H: Elements of a Coordinate System Projection Datums Number Datum Area Maps Ellipsoid 36 Hito XVIII 1963 South Chile (near 53×S) International 37 Hjorsey 1955 Iceland International 38 Hong Kong 1963 Hong Kong International 1004 Hungarian Datum (HD 72) Hungary GRS 67 39 Hu-Tzu-Shan Taiwan International 40 Indian Thailand and Vietnam Everest (India 1830) 41 Indian Bangladesh, India, Nepal Everest (India 1830) 129 Indian Pakistan Everest (Pakistan) 130 Indian 1954
Appendix H: Elements of a Coordinate System Projection Datums Number Datum Area Maps Ellipsoid 135 Kusaie Astro 1951 Caroline Islands, Federated States of Micronesia International 1924 48 L.C.
Appendix H: Elements of a Coordinate System Projection Datums Number Datum Area Maps Ellipsoid 1010 (New Zealand (NZGD49 7parameter) New Zealand International 62 North American 1927 (NAD 27) Continental US Clarke 1866 63 North American 1927 (NAD 27) Alaska Clarke 1866 64 North American 1927 (NAD 27) Bahamas (excluding San Salvador Island) Clarke 1866 65 North American 1927 (NAD 27) San Salvador Island Clarke 1866 66 North American 1927 (NAD 27) Canada (including Newfoundland Island
Appendix H: Elements of a Coordinate System Projection Datums Number 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 Corvo and Flores Islands (Azores) International 140 Observatorio Meteorologico 1939 Corvo and Flores Islands (Azores) International 1924 76 Old Egyptian
Appendix H: Elements of a Coordinate System Projection Datums Number Datum Area Maps Ellipsoid 83 Puerto Rico Puerto Rico and Virgin Islands 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 Rikets Triangulering 1990 (RT 90) Sweden Bessel 1011 Rikets Triangulering 1990 (RT 90), 7 parameter Sweden
Appendix H: Elements of a Coordinate System Projection Datums Number Datum Area Maps Ellipsoid 94 Southeast Base Porto Santo and Madeira Islands International 95 Southwest Base Faial, Graciosa, Pico, Sao Jorge, Terceira Islands (Azores) International 1003 Switzerland (CH 1903) Switzerland Bessel 147 Tananarive Observatory 1925 Madagascar International 1924 96 Timbalai 1948 Brunei and East Malaysia (Sarawak and Sabah) Everest (India 1830) 1015 Tokyo Japan Bessel 1841 98 Tristan As
Appendix H: Elements of a Coordinate System Projection Datums Number Units 6 Centimeters 31 Chains 3 Feet (also called International Feet)* 2 Inches 1 Kilometers 30 Links 7 Meters 0 Miles 5 Millimeters 9 Nautical Miles† 32 Rods 8 US Survey Feet (used for 1927 State Plane)‡ 4 Yards * One International Foot equals exactly 30.48 cm. † One Nautical Mile equals exactly 1852 meters. ‡ One US Survey Foot equals exactly 12/39.37 meters, or approximately 30.48006 cm.
Appendix H: Elements of a Coordinate System Projection Datums Standard Parallels (Conic Projections) In conic projections a cone is passed through the earth intersecting it along two parallels of latitude. These are the standard parallels. One is to the north and one is to the south of the projection zone. To use a single standard parallel specify that latitude twice. Both are expressed in degrees of latitude.
Appendix H: Elements of a Coordinate System Datum Conversion The Polyconic projection is neither equal-area nor conformal. Along the central meridian, however, it is both distortion free and true to scale. Each parallel is true to scale, but the meridians are lengthened by various amounts to cross each parallel at the correct position along the parallel, so that no parallel is standard in the sense of having conformality (or correct angles), except at the central meridian.
Appendix H: Elements of a Coordinate System Custom Datums Defining Custom Datums Most coordinate systems use one of Pitney Bowes Software’s predefined datums, listed in this appendix. If you need to use a datum that isn’t in the list, and you know what the datum’s mathematical parameters are, then you can define the coordinate system using a custom datum. MapInfo uses the following information to define a datum: • An ellipsoid, also called a spheroid.
Appendix H: Elements of a Coordinate System Custom Datums Number Ellipsoid a 1/f 10 Bessel 1841 6377397.155 299.1528128 35 Bessel 1841 (modified for NGO 1948) 6377492.0176 299.15281 14 Bessel 1841 (modified for Schwarzeck) 6377483.865 299.1528128 36 Clarke 1858 6378293.639 294.26068 7 Clarke 1866 6378206.4 294.9786982 8 Clarke 1866 (modified for Michigan) 6378450.047484481 294.9786982 6 Clarke 1880 6378249.145 293.465 15 Clarke 1880 (modified for Arc 1950) 6378249.
Appendix H: Elements of a Coordinate System Custom Datums Number Ellipsoid a 1/f 23 Hough 6378270.0 297.0 31 IAG 75 6378140.0 298.257222 41 Indonesian 6378160.0 298.247 4 International 1924 6378388.0 297.0 49 Irish (WOFO) 6377542.178 299.325 3 Krassovsky 6378245.0 298.3 32 MERIT 83 6378137.0 298.257 33 New International 1967 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.
Appendix H: Elements of a Coordinate System Custom Datums coordinates from the local datum to WGS 84. (This is the same as saying that the parameters were derived by subtracting the local datum from WGS 84.) In that case, you can use the parameters exactly as they appear in the document.
Appendix H: Elements of a Coordinate System National Transformation v. 2 (NTv2) a 6378249.145 m f 1 / 293.465 WGS 84 minus local datum LD-3 dX -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 aren’t present). In this case, you can use datum number 999 instead of 9999 in the custom datum definition.
Appendix H: Elements of a Coordinate System National Transformation v. 2 (NTv2) • • 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.
Appendix H: Elements of a Coordinate System National Transformation v. 2 (NTv2) The New Zealand grid shift file converts from the NZGD49 datum to the NZGD2000 datum. Detailed information and an online converter can be found at the Land Information New Zealand (LINZ) web site: www.linz.govt.nz/geodetic/conversion-coordinates/online-conversion-service Germany The following grid shift file is included for Germany: BETA2007.
Appendix H: Elements of a Coordinate System Information on Coordinate Systems and Projections true - 7 -8 150.5 186 17 19.5 8 - 74 Information on Coordinate Systems and Projections The first three publications listed are relatively short pamphlets.
Appendix H: Elements of a Coordinate System Information on Coordinate Systems and Projections www.colorado.edu/geography/gcraft/notes/coordsys/coordsys.html For Information on Map Projections go to: www.colorado.edu/geography/gcraft/notes/mapproj/mapproj.html MapXtreme v7.
User-Defined Metadata This appendix contains information on user-defined metadata support for TableInfoServer queries. In this appendix Metadata and the MapCatalog . . . . . . . . . . . . . . . . . . . . . . . . . . . .599 User-Defined Metadata Support for TableInfoServer Queries . .
Appendix I: User-Defined Metadata Metadata and the MapCatalog Metadata and the MapCatalog When working with spatial database queries, the MapCatalog has long been used as the sole source of metadata when trying to infer accurate definitions for FeatureGeometry and Style columns in the query result set. In some cases, however, the MapCatalog may not be a convenient, appropriate, or reliable source.
Appendix I: User-Defined Metadata User-Defined Metadata Support for TableInfoServer Queries The ColumnHints property is defined as a Columns collection. After creating an instance of the collection, and inserting Column instances for each hint within it, this collection is assigned to the ColumnHints property; for example, for a TableInfoServer variable named tblInfoSrv… [C#] Columns hints = new Columns(); // insert Column instances into the collection to serve as hints (see below) tblInfoSrv.
Appendix I: User-Defined Metadata User-Defined Metadata Support for TableInfoServer Queries If a MapCatalog entry is known to exist which provides default metadata for the spatial column, a "sparse" hint can be used as a means of overriding specific properties. Usually these would be preference variety properties such as default view and default style, although any set of the properties can be overridden depending upon the unique requirements of the complex query.
Appendix I: User-Defined Metadata User-Defined Metadata Support for TableInfoServer Queries In this example, the StringCollection class resides in the System.Collections.Specialized namespace. Composite keys are allowable and would be defined by adding two or more column names into the string collection. Explicit key definitions may also be used as overriding definitions in cases where the database table contains two or more candidates, and the developer has a specific preference for which gets used.
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: Comparing MapXtreme’s Object Model to MapX. . . . . . . . . . . . .
Appendix J: Migrating to MapXtreme Comparing MapXtreme’s Object Model to MapX Comparing MapXtreme’s Object Model to MapX If you have used MapX and MapXtreme for Windows, you will find similarities and differences in the way they work from MapXtreme. This section describes some of the major differences between MapXtreme and previous versions of our APIs. Specific Object Model Implementation Differences The Map object from MapX is now represented by 3 or 4 classes.
Appendix J: Migrating to MapXtreme Comparing MapXtreme’s Object Model to MapX MapX 5.0 AffineTransform MapXtreme AffineTransform It is non-mutable (no set). Use CoordSysFactory.CreateAffineTransform to create one. AllFeaturesConstraint Annotation Obsolete. New Adornments class. The MapControl contains adornments derived from Control Annotations Obsolete. BindLayer Obsolete. Replacement is in Table.AddColumns() arguments.
Appendix J: Migrating to MapXtreme Comparing MapXtreme’s Object Model to MapX MapX 5.0 Features MapXtreme See Feature. FeaturesConstraint FeatureFactory Table-level object processing • • Buffer: For one feature, it is at the Geometry level (FeatureGeometry.Buffer). For multiple features, use FeatureProcessor.Buffer. Combine: For one feature, it is at the Geometry level (FeatureGeometry.Combine). For multiple features, use FeatureProcessor.Buffer.
Appendix J: Migrating to MapXtreme Comparing MapXtreme’s Object Model to MapX MapX 5.0 Layer MapXtreme UserDrawLayer, LabelLayer, FeatureLayer, ObjectThemeLayer, GroupLayer... • • • • • • • • • • • • • MapXtreme v7.1 AddFeature: The current equivalent is to bind a Geometry to the geometry column during an insert operation using MICommand. AllFeatures AutoLabel: This no longer exists. The equivalent is to have the LabelSource.DefaultLabelProperties.Enabled property set to true.
Appendix J: Migrating to MapXtreme Comparing MapXtreme’s Object Model to MapX MapX 5.0 Layer (continued) 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.
Appendix J: Migrating to MapXtreme Comparing MapXtreme’s Object Model to MapX MapX 5.0 MapXtreme Legend Legend LegendText LegendRow LegendTexts LegendRows MapXtreme v7.
Appendix J: Migrating to MapXtreme Comparing MapXtreme’s Object Model to MapX MapX 5.0 Map 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.
Appendix J: Migrating to MapXtreme Comparing MapXtreme’s Object Model to MapX MapX 5.0 Map (continued) 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.
Appendix J: Migrating to MapXtreme Comparing MapXtreme’s Object Model to MapX MapX 5.0 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.
Appendix J: Migrating to MapXtreme Comparing MapXtreme’s Object Model to MapX MapX 5.0 MapXtreme Variable MIParameter. For binding in expressions, the MICommand.Parameters property allows you to define variables used within the command. Variable MIParameterCollection. MapXtreme v7.
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. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .615 How to Use the Localization Kit . . . . . . . . . . . . . . . . . . . . . . . . . .617 Private Key Signing for Satellite Assemblies . . . . . . . . . . . . . . .
Appendix K: Localization Kit Localization Kit 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.
Appendix K: Localization Kit Localization Kit Resource File Product Area EllisAllTypeResources.en-US.resx Error strings for reading from datasources EllisCommandProcessorResources.en-US.resx Error strings for reading from datasources EllisCoordSysExceptions.en-US.resx Error strings for bad coordinate system values EllisCoordSysResources.en-US.resx Error strings for bad coordinate system values EllisDAEngineResources.en-US.resx Error strings for datasource query Errors EllisDBInfoResources.
Appendix K: Localization Kit How to Use the Localization Kit Resource File Product Area EllisMILicensingResources.en-US.resx Error strings for copy protection/licensing components EllisMIRDBResources.en-US.resx Error strings for database connections EllisMIRDBSpatialResources.en-US.resx Error strings for database connections EllisMIWindowResources.en-US.resx Strings for use in GUIs EllisProgramResources.en-US.resx Error strings for file operations EllisRasterResources.en-US.
Appendix K: Localization Kit How to Use the Localization Kit Most of the .resx files are contained in Resources folders under each project. The Windows and Windows.Dialog resources are located in Controls or Dialogs folders. Building the Satellite Assemblies Satellite assemblies are optional, standalone assemblies that contain just the compiled resources. Once you have your .resx strings translated, you are ready to build your satellite assemblies.
Appendix K: Localization Kit How to Use the Localization Kit LocalizationKit.proj The LocalizationKit.proj targets are: build - builds the LocalizationKit solution and calls the LocalizationKit.Utilities project's "RegisterSkipVerifiection" target (default target) rebuild - rebuilds the LocalizationKit solution and calls the LocalizationKit.
Appendix K: Localization Kit Private Key Signing for Satellite Assemblies LocalizationKit> msbuild LocalizationKit.proj /target:build /property:configuration=release This command will build the release versions (no debug information) of the satellite assemblies, signing each with the appropriate public strong name key file, and registering the satellite assemblies for skipping verification, then installing the satellite assemblies into the Global Assembly Cache.
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.
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.
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.
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.
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.
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.
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.
Index Numerics 32-bit supported architecture 29 64-bit supported architecture 29 A abbreviations file editing 272–273, 277 substitution keywords 274 substitution methods 274–276 accessing mappable tables 187 accessing non-mappable data 478 accessing non-mappable tables 161, 165, 178, 186–187 accessing remote tables attribute data 233 cache management 234–236 DataTable 179 DBMS databases 222 defining mappable tables 231 IDBCommand 181 MapInfo_MapCatalog 236–237 mappable tables 231–232 mapping to X/Y columns
Index desktop architecture 74 licensing 31–32 packaging a desktop 467 packaging a web 472–474 planning a desktop application 125–126, 140 planning a web 76–78, 80, 105–106, 109–111, 113, 460–461, 463, 465–466 startup workspace 112, 122–123 application state defined 104 thematic sample 120–121 application templates ASP.
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 566–570 codespace definitions 566, 568 column hints 599–602 columns adding 218 adding expressions 176 supported data types 161–162 COM object model .
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 481–482 Windows tools 146 Workspace Manager 485–489 WorkSpaceLoader 484 D data analyzing 200 using in MapXtreme 183 data access DataTable 179 deploying applications 57 ExecuteFeatureCollec
Index MapTools 140 packaging 467 planning 125–126, 140 prototyping 125 session management 204 tutorial 457–459, 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 108–110 pooled 110 dialog boxes adding to a
Index label priority 435–436 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
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, 348–349 sending requests 337 street addresses 341 street inter
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.
Index Label tool desktop 142 removing manually added labels 433 repositioning curved labels 446 LabelLayer 254 LabelModifier 254 LabelProperties 255 labels curved 257, 443, 445–446 individual value theme 289 mapping term description 61 overview 253 priority expressions 435–436 ranged theme 286 styles 434 UML diagram 253 Workspace Manager 433–435 LabelSource 254 latitude defined 625 layer defined 625 layer control Workspace Manager 425 layer override styles composite styles 297 layer types FeatureLayer 250 G
Index rapid prototyping 125 Map class map contents 248 map legends 291–292 aligning frames 293 Map object determining coordinate system 314 map title adornments 257 map tools architecture 84 JavaScript-enabled 84 process diagram 85 using 85–86 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 M
Index installing 40 migrating to 24 object model 68–70, 604 product overview 22 support resources 27 upgrading 43, 46 web controls architecture 83 MapXtreme ASP.
Index O object model architecture 68 data access 178, 185–186, 200–202 implementation 604 MapXtreme versus MapX 604 namespaces 68–70 object themes bar 283 description 280 graduated symbol 280–281 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
Index development model 111 versus InProc 107, 109–111 pooling, defined 626 postal centroid matches geocoding result codes 348 postal code geocoding 343 pre-defined styles 299 printing from MapXtreme applications 527–531, 533–539 product architecture 67 product features highlights 22 project templates shipped with MapXtreme 126 projections datums 576, 578–584 defined 627 MapInfoCoordinateSystemSet.xml 575 MapInfoCoordinateSystemSet.
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 3
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 90–91 source rows 185 spatial schemas defined 627 PointRef 186–187 XY spatial 186 SpatialWare applications troubleshooting 245 special characters Mapinfow.
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 .
Index enabling in Workspace Manager 429, 438–440 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 35–37 Oracle applications 245 SpatialWare applications 245 TrueType fonts StyleRepository class 299 tutorial applications 46 creating a desktop application 457–459, 462, 464 creating a web application 467–472 packaging a desktop application 467 packaging a we
Index design time view 78 initial request 120 MapXtreme Session instance 120–121 packaging 472–474 packaging tutorial 472–474 planning 76–78, 80, 103, 105–111, 113, 460– 461, 463, 465–466 pooling 80 run-time view 79 server-side command architecture 85 state management 80 terminology 103–104 tools 79 tutorial 467–472 updating to MapXtreme 44 web applications state management 471 web browers supported databases supported 29 web controls 80–81, 83, 86–88, 99–101 architecture 83 ASP.NET AJAX 93 ASP.
Index overview 70 .