Pitney Bowes MapXtreme User Manual
Page 211

Chapter 10: Creating Expressions
Expression Examples
MapXtreme v7.1
218
Developer Guide
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. In MapInfo SQL, string literals must be
enclosed in single quotation marks while identifiers such as column names, table names, aliases,
etc.) should be enclosed in double quotation marks, but only needed if the parsing logic is unable to
correctly parse the identifier. This would include identifiers that have spaces in their names or other
special characters.
To find features that fall outside the buffer, the expression would look like:
NOT Obj CentroidWithin MI_Buffer(Obj, 5, ‘km’, ‘Spherical’, 24)
Add Columns Example
When adding temporary (computed) columns to a table using the AddColumns method, the columns
supplied contain an expression that defines how the value for the column is computed. The
expression may contain an aggregation function if multiple source records are expected to match up
to a single record in the table to which the columns are being added.
The example below uses expressions to represent population density "Pop_1990 /
MI_Area(Obj, 'sq mi', 'Spherical')". The expressions are preceded by their new column
names. PopDensity1990 and PopDensity2000.
VB example:
Public Shared Sub MapInfo_Data_TableAddColumns(ByVal miTable _
As Table)
Dim NewCols As Columns = New Columns
NewCols.Add(New Column("PopDensity1990", "Pop_1990 / _
MI_Area(Obj, 'sq mi', 'Spherical')"))
NewCols.Add(New Column("PopDensity2000", "Pop_2000 / _
MI_Area(Obj, 'sq mi', 'Spherical')"))
miTable.AddColumns(NewCols)
End Sub
For more information on adding columns, see
Adding Expression Columns to a Table
Feature Search Example
The following example uses a boolean expression SearchWhere("State='FL'") that, when
executed, will return a value of 1 for each row that contains FL.
VB example:
Public Shared Sub MapInfo_Data_SearchInfo(ByVal catalog As Catalog)
Dim fFlorida As Feature = catalog.SearchForFeature("usa", _
MapInfo.Data.SearchInfoFactory.SearchWhere("State='FL'"))
Dim si As SearchInfo = _
MapInfo.Data.SearchInfoFactory.SearchWithinGeometry(fFlorida._
Geometry, ContainsType.Centroid)
Dim fc As IResultSetFeatureCollection = _