Accessing attribute data, Performance issues, Accessing attribute data performance issues – Pitney Bowes MapXtreme User Manual

Page 226

Advertising
background image

Chapter 11: Accessing Data from a DBMS

Accessing Attribute Data

MapXtreme v7.1

233

Developer Guide

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.

When you add a DBMS table, for performance sake, you should only specify the columns in the
query that you intend to use in your application. These are the spatial column, the key column(s),
which are added automatically if you do not specify them, and columns you want to label with, or
create a theme from. You may use the pseudo columns “OBJ” for any mappable table to refer to the
column(s) containing the spatial data. This is required for a table using the MapMarker
MDIGEOADDRESS column on a table with an X/Y column.

You can use any server side expression/function to specify a column. Also, avoid select * from tab in
a real application.

The following code example defines a server table using a TableInfoServer and adds a layer to a
map using this definition. You can now label or place themes based upon the columns in this table.

VB example:

Public Shared Sub MapInfo_Data_TableInfoServer(ByVal connection As _
MIConnection)

' Note: Do not specify any columns. These are determined
' dynamically from the query

Dim ti As TableInfoServer = New TableInfoServer("Provinces")
ti.ConnectString = "SRVR=ontario;UID=mapx;PWD=mapx"
ti.Query = "Select * From Provinces"
ti.Toolkit = ServerToolkit.Oci

ti.CacheSettings.CacheType = CacheOption.Off ' On is the default
Dim tbl As Table = connection.Catalog.OpenTable(ti)

End Sub

Performance Issues

Establishing a connection with the database server may take several seconds. This is a one-time
cost, incurred when the table is first opened.

The map-display speed depends on how much data is retrieved from the server. In some cases,
displaying a map from a server is noticeably slower than displaying a map from a local file. Speed
also depends on whether your MapXtreme application has already cached the map features that are
being displayed.

Advertising