Adding coordinate systems to mapxtreme – Pitney Bowes MapXtreme User Manual

Page 308

Advertising
background image

Chapter 16: Spatial Objects and Coordinate Systems

Coordinate Systems

MapXtreme v7.1

315

Developer Guide

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.

EPSG codes represent a collection of coordinate systems (known as codespaces) maintained in the
EPSG Geodetic Parameter Dataset under the auspices of the International Association of Oil & Gas
Producers (OPG). The OPG’s Survey and Positioning Committee took over this responsibility from
the European Petroleum Survey Group in 2005.

SRID codes are unique spatial reference numbers that refer to codespaces for Oracle Spatial tables.

(MapXtreme supports a third codespace called MapInfo.)

MapXtreme provides you with many of the common EPSG and SRID mappings. If you need to
register a different EPSG or SRID code to a particular coordinate system, this feature provides you
with two methods to do so.

To extend MapXtreme’s ability to use any EPSG or SRID codespace, you may add the information
programmatically, in which case, the coordinate system information will only last as long as the
MapXtreme Session. Or you may add it to the Web.config file for your web application or app.config
file for a desktop application as a more permanent solution. Each is discussed below.

Register EPSG and SRID Codes Programmatically

The MapInfo.Geometry.CoordSysFactory class contains methods that allow you to register EPSG
and SRID codes to a specified coordinate system.

RegisterEPSGCode() and RegisterSRIDCode() each take two parameters: one being the EPSG or
SRID code that represents the codespace, the second is the coordinate system information that first
parameter will map to.

The following example demonstrates registering a fictional code with the Long/Lat NAD83
coordinate system.

VB example:

Public Shared Sub MapInfo_Geometry_RegisterEPSGCode()
Dim factory As CoordSysFactory = Session.Current.CoordSysFactory
' create CoordSys objects from srsName
Dim csysNAD83 As CoordSys = _

factory.CreateCoordSys("mapinfo:coordsys 1,74")

' 9998 is a fictional code for demonstration purposes
Try
factory.RegisterEPSGCode(9998, csysNAD83)
Catch ae As ApplicationException
'code already exists. Codes cannot be duplicated

Advertising