beautypg.com

Create a temporary memtable – Pitney Bowes MapXtreme User Manual

Page 168

background image

Chapter 8: Working with Data

Table Metadata (TableInfo)

MapXtreme v7.1

175

Developer Guide

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.CreateTable(ti)
End Sub

Create a Temporary MemTable

The MapInfo.Data.Table.TableInfo property for a memory table returns an instance of
TableInfoMemTable. This class may be used to access properties that are specific to memory table
types. New instances of this class may be created and used to construct new tables.

Data in formats such as XML or GML from a Web service can be brought into the Catalog and used
in this fashion. It can be 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.

This approach is also appropriate if you wish to make data available for use in MapXtreme, but not
necessarily for map display.

MapXtreme supports reading and writing Z and M values to MemTables. M values on MultiCurves
allow you to carry out linear referencing operations and dynamic segmentation. See

Chapter 21:

Linear Referencing

.

VB example:

Public Shared Sub MapInfo_Data_TableInfoMemTable()

Dim ti As TableInfoMemTable = New TableInfoMemTable("NewTable")

' Note: The TablePath property does not apply - it can be set but it _
' is meaningless.

ti.Columns.Add(ColumnFactory.CreateIndexedStringColumn("Capital",_

25))

ti.Columns.Add(ColumnFactory.CreateStringColumn("Country", 30))
ti.Columns.Add(ColumnFactory.CreateDoubleColumn("Pop_Grw_Rt"))

' Make the table mappable

ti.Columns.Add(ColumnFactory.CreateStyleColumn())
Dim Robinson As CoordSys = _

Session.Current.CoordSysFactory.CreateFromPrjString("12, 62, _