You are on page 1of 34

MapInfo Professional

Remote databases

Peter Horsbll Mller, Systems Engineer


August 2009

Agenda
1. Supported databases
2. Data Sources
Map Catalog
Working with the data
Tips

1. Supported databases

Supported databases
Spatial databases:
Oracle 11g including Annotation Text (Spatial and Locator)
Oracle 10g and 9iR2 (Spatial and Locator)
SQL Server 2000, 2005 and 2008 with MapInfo SpatialWare
SQL Server 2008 Spatial, both Geometry and Geography (v10.0)
PostgreSQL with PostGIS extension (v10.0)
Point and textual data:
SQL Server 2000, 2005 and 2008
MS Access 1997, 2003 and 2007
Any ODBC database
ESRI SDE and Geo databases can be opened read-only thru Open
Universal Data. Have a look at this demonstration by Safe:
http://www.safe.com/solutions/application/mapinfo.php#

2. Data Sources

ODBC and OCI


ODBC Open DataBase Connectivity
OCI Oracle Call Interface
OCI is used when connecting to Oracle 9i, 10g or 11g for
spatial data
ODBC is used when connecting to any ODBC compatible
database
ODBC can also be used for connecting to older versions of
Oracle or when using non-spatial data

Connecting to the database

MapInfo Professional installs by default all the support it provides for remote
databases
For MapInfo Professional prior to 9.5 these install were optional
ODBC installation is a standard part of Windows. MapInfo Professional
installation might update the drivers.
ODBC drivers not installed by Windows must be installed by end users, for
instance PostgreSQL/PostGIS.
Oracle client drivers must also be installed by end users.
If you have an Oracle client on your computer, you will be prompted to
choose between ODBC and Oracle Spatial when clicking File > Open DBMS
connection.
Otherwise you will be asked to Select a Data Source directly.
The support for DBMS is located in two dlls (midlodbc.dll and midloci.dll)
that can be copied into the MapInfo program folder afterwards. They are
specific to the MapInfo version. Note that the installer - in this case - might
not remove these when uninstalling MapInfo Professional

Creating a data source


Open the dialog Select Data Source.
Can be accessed from the Open dialog
or from File > Open DBMS Connection.
Select type of data source
File Data Source
Machine Data Source
Click on the button New
Select the type of driver/database
Enter a name/file name
Data source will now be created

Configuring a Data Source


MS Access
Depending on database/driver

MS SQL Server

3. Map Catalog

Map Catalog
The Map Catalog (MapInfo.MapInfo_MapCatalog) describes
spatial tables in the database with values like:
Kind of spatial table, for example. XY, SpatialWare, Oracle,
SQL Server, PostgreSQ/PostGIS, etc.
Coordinate system
Data bounds
Symbol, default and per row
Default view
The Map Catalog must exist once in the
databases holding spatial data
The Map Catalog has been expanded
from time to time. With MapInfo
Professional 9.5.1 default zoom is
supported thru the the VIEW_* columns

Creating the Map Catalog


Run the tool DBMS Catalog from Tools >
Tool Manager.
Run Tools > DBMS Catalog > DBMS Catalog
and click Create Catalog.
Select the data source pointing to the
database where you want to create the Map
Catalog
The Map Catalog should now exist in the
database
You can also create the Map Catalog directly
in the database using SQL
Also note EasyLoader creates the Map
Catalog automatically
The Map Catalog for PostgreSQL/PostGIS
can only by created thru EasyLoader

Uploading existing data with EasyLoader


EasyLoader lets you upload existing table to a database
Oracle Locator/Spatial
SpatialWare
SQL Server2008 Spatial
PostgreSQL/PostGIS
MS Access, XY coordinates
Unregister tables from Map Catalog if it is missing
Select several tables to upload
Specify how to upload
Options
Grant public access
Create spatial index
Identity column as ID
Creates the Map Catalog
Updates the Map Catalog

EasyLoader
EasyLoader is provided with MapInfo Professional. It can also
be downloaded from our website
EasyLoader has the same version as the version of MapInfo
Professional it was built to.
EasyLoader is a standalone application that can run outside of
MapInfo Professional
EasyLoader is a Windows application but it can connect to
databases running on other operating systems
Can be run in batch mode
bat file
program

Making a remote table mappable

Select Table > Maintenance > Make


DBMS Table Mappable
Select the table to make mappable
and click Open
Now specify how the table should be
made mappable:
Type
X and Y coordinates
Style
Symbol
Coordinate system
Click OK
Cancel the dialog Select DBMS table
if you dont want to make more
tables mappable.
Note: You do not need to do this if
you have
uploaded the table with
EasyLoader
saved the table to the database
thru MapInfo Professional

4. Working with the data

Opening a remote table


Select File > Open
Click on Open DBMS Connection
or select the open connection in
the File Type dropdown list
Select the table to open and
click Open.
Specify:
Column
Rows
Access type
Linked
Live
Where to place Tab file

Linked versus Live - 1 - Linked


Linked
Data is copied to the MapInfo table the when you create the
linked table and when you refresh it
Access to the database is only needed when saving or refreshing
-> working offline and long transactions are built in so your data
is locally available
Speed is as fast as local data after download
Data can be accessed read-only without a primary key
Using a query to get just the data you need, will speed up
download time. Queries are set when you create the linked table
via the Row, Column or Expert dialogs
Data is downloaded to the same location as the .TAB file
Duplicate data

Linked versus Live - 2 - Live


Live with/without cache
First time opening a table may be faster depending on the zoom
of your map window
One view entire layer or zoom out to the entire view will
download the whole table
Data must have a primary key
You always need access to the database

Linked versus Live - 3 Live without cache


Live without cache
MapInfo Professional always reads directly from the database
Every draw, browse, select click which can negatively affect
performance.
Using Snap is really not recommended
Data is reread from the server on every access

Linked versus Live - 4 Live with Cache


Live with cache
Uses a temporary cache
9.5.0 and earlier:
Memory table, large tables might fail the cache or be very
slow
Cache is for one map view. Going outside a previous map
view causes the cache to be restarted
9.5.1 and later:
MapInfo table stored in a temporary MapInfo table.
The cache is progressive, as you pan, zoom out or have
more than one map window of the same data, the cache
grows
Data is cached as used in the map, so subsequent access to the
same data will be quicker
The cache is cleared when the table closes

Linked versus Live - 5 Conclusion


Only use LIVE when
The table data is very large and it is not feasible to create
a filter query to download less data
The data is highly volatile (changing minute to minute or
even sooner)
If you have a small data size in your table, it will probably not
matter if you choose Live or Linked
If you need to snap to your data you should not use Live
without cache.
If you use live tables we recommend that you access your
data thru a workspace with zoom levels set on the live table
to prevent downloading unnecessary data

Reopening a remote table


Its only the first time you open a DBMS table, that you need
to specify which data to open
Afterwards you can reopen this table by opening the tab file
The tab file contains all the necessary information
Table structure
Connection information
Can also hold the Username and Password
If the table was opened as Linked, you may want to refresh
the data.
If the table was opened as Live, MapInfo will read the latest
data from the database

Refreshing
Reloading data from the database can be done with Table >
Maintenance > Refresh DBMS Table...
Refreshing a DBMS table
Checks the database for changes
Reapplies the query condition. Note that the query
conditions are static.
If you have specified to filter using the current map or
current selection, this filter will always be applied to the
table. To specify a different map extent, you have to
reopen the table from the database.

Editing
The remote table must contain a primary unique index
In a view this column should be named MI_Prinx
You can edit the data with every tool available in MapInfo
Professional
When editing coordinates of a XY-coordinate table, the
coordinates are updated in the columns with the X and Y
coordinates in the database table

Saving
Click Save Table to save the pending edits to the DBMS table
When saving the edits to the database, MapInfo checks if the
records you have changed, have been changed in the
database since you accessed these. If so, a dialog appears
asking you to solve the conflict
Saving changes offline (only for Linked tables) can be done
by closing the table. MapInfo will ask how to store the
pending edits:
 Save locally
Save to the database
Discard

Querying - 1
Linked
Query is performed when
the table is opened the first time
the table is refreshed.
Live with cache
Query is performed when
the table is added to a map
you zoom or pan in the map
Live without cache
Query is performed when
the table is added to a map
you zoom or pan in the map
you click in the map with a select tool
you click in the map with the info tool

Querying - 2
You can specify which records to retrieve from the database
By attributes
Like and not like only available for
text columns

By geography
Selection only available when a
selection is active
Current_Mapper only available when
a map is active
Object is only available for mappable
tables

Query is performed when the table is opened the first time


and when the table is refreshed. Value of Current_Mapper and
Selection are static and not updated when the table is
refreshed.

Querying - 3
Write your own SQL statement
Syntax depends on the database
MapInfo Professional will translate certain expression when
passing the query to the database:
Object
Within
Selection
Current_Mapper

You can save and open queries

5. Tips

Questions & Answers


Q My Open DMBS connection is greyed out?
A You need to install the ODBC support
Q When I open a DBMS table, MapInfo tells me it is read-only?
A Make sure you are permitted to edit the table in the database and that
the table has a unique primary index for views this column should be
named MI_PRINX
Q Im not asked to choose between Oracle Spatial and ODBC?
A You either havent installed support for Oracle Spatial (OCI) or you
havent a Oracle client installed
Q My DBMS table can not be shown in a map?
A The table has probably not been made mappable
Q I have opened a DBMS table and made it mappable but it still cant be
added to a map?
A You need to reopen the table from the database to make MapInfo
Professional read the mapping information
Q How do I see the columns with the coordinates inside MapInfo Professional?
A Create a view and add these columns twice (once with an alias), make
the view mappable and then open the view instead of the base table

Seeing the coordinates in MapInfo Pro


MapInfo will hide the columns containing coordinates when
they are translated into a point
To show the coordinates you must create a view that
includes the coordinate columns twice
Includes the primary index column as MI_PRINX
The view could look like this:
SELECT HOLE_ID, ID, LENGTH,
LOCATIONX, LOCATIONY, LOCATIONZ,
LOCATIONX As X, LOCATIONY As Y, ID As MI_PRINX
FROM dbo.DRILLHOLES
Finally make the view mappable thru the X and Y column

Internet resources

MapInfo Professional: www.mapinfo.com/mipro


MapInfo MapBasic: www.mapinfo.com/mapbasic
Encom Discover: www.encom.com.au/discover
MapInfo SpatialWare: www.mapinfo.com/spatialware

MapInfo FAQ: www.mapinfo.com/support/search-knowledge-base


MapInfo-L discussion: groups.google.com/group/mapinfo-l
MapInfo-L wiki: www.mapinfo-l.com/Wiki

Questions?

The Power of Insight


MapInfo Professional

Peter Horsbll Mller


Systems Engineer
peter.moller@pb.com

You might also like