MapInfo SpatialWare Reader/Writer
Licensing options for this format begin with FME Professional Edition.
SpatialWare is server-based data management software from MapInfo® Corporation. It enables businesses to store, manage, and manipulate spatial data (that is, location-based data), within an Informix or SQL Server database.
SpatialWare enables a Relational Database Management System (RDBMS) to store both spatial and non-spatial data by providing a new spatial sw_geometry
column type to the underlying RDBMS. Spatial data include a variety of non-traditional data types. Digital representations of highways, fiber-optic lines, sales territories, or land parcels are all examples of spatial data; data that have a physical context or existence in space.
FME is a SpatialWare client application capable of connecting to SpatialWare through ODBC regardless of the platform on which it is located.
Overview
SpatialWare provides a seamless data model into which geographic data is stored. SpatialWare provides a relational data model organized around tables. With typical uses of FME, a SpatialWare feature type1The terms “feature type” and “table” are used interchangeably throughout this chapter. is equivalent to an RDBMS table. FME can be used to read and write any RDBMS table whether or not it has a spatial (sw_geometry
) column. A spatial column has the following properties:
- Each spatial column may have a spatial index.
- A single relational table can only have 1 spatial column.
- Features in a spatial column may be either 2D or three-dimensional (3D). Mixed dimensionality is allowed in a spatial column.
- Each table may have a single coordinate system in which features are ultimately stored.
FME’s SpatialWare Reader and Writer leverage the unique capabilities of SpatialWare.
The reader retrieves features from SpatialWare by constructing queries consisting of both spatial and/or non-spatial components. A SpatialWare database may have a very large number of features, therefore the query building capability is critical to ensure that FME reader module is capable of satisfying highly focused data requests.
The writer takes advantage of SpatialWare’s transaction model to ease the task of importing data into SpatialWare. The SpatialWare writer is also able to operate in three modes (a “DELETE” mode, an “UPDATE” mode or an “INSERT” mode), enabling FME to be used as a key component in a SpatialWare-based solution. The SpatialWare reader is also capable of performing multi-table join queries, thereby exploiting the full power of the underlying RDBMS.
Reader Overview
The SpatialWare reader begins by starting a SpatialWare connection through ODBC with the server upon which the SpatialWare dataset resides. Once connected, the SpatialWare reader queries SpatialWare and passes the resulting features – that is, rows – to FME for processing.
When reading features from SpatialWare, the tables from which features are retrieved, as well as attribute and spatial constraints, can be specified with the <ReaderKeyword>_DEF
statement. Multiple queries may be used in a single pass of reading. If no spatial or attribute constraints are specified, then all features from the identified tables are read. SpatialWare stored procedures can also be executed in the same fashion as that of an SQL query. However, the user needs to be familiar with using SpatialWare spatial queries. An example of the syntax is shown below (note positions of the single quotation marks):
exec sp_spatial_query 'select * from canada where ST_Contains(canada.sw_geometry, ST_Point(-101.362325, 48.999346))'
This will return the features containing the point (-101.362325, 48.999346).
The SpatialWare reader requires that at least one <ReaderKeyword>_DEF
, one <ReaderKeyword>_DEF_OVERRIDE
, or one <ReaderKeyword>_IDs
statement be specified, identifying the queries by which data is to be retrieved. If none of these statements are specified, then no features are read from the database.
Writer Overview
The SpatialWare writer module stores FME features in a SpatialWare database. The SpatialWare writer module provides the following capabilities.
Transaction Support: The SpatialWare writer provides transaction support that eases the data loading process. Occasionally, a data load operation terminates prematurely due to data difficulties. The transaction support provides a mechanism for reloading corrected data without data loss or duplication.
WARNING: This functionality is currently available only for SQLServer. Also, in case more than one reader or writer is accessing SpatialWare through FME (which is possible using FME Objects), then concurrency issues may arise. In such a case, we use isolation levels for transactions as READ_COMMITTED. This means that if we have a writer that writes a feature on a table, then, until the time this transaction is committed, any attempt to read the same table by another reader will cause the program to hang. The reason for that is that SQLServer will maintain a lock on the table until the transaction gets committed. Currently, the user cannot set the transaction isolation levels, but this may be changed in the future.
Table Creation: The SpatialWare writer module uses the information within the FME mapping file to automatically create SpatialWare tables as needed. If a mapping file table definition has a spatial column, then the associated SpatialWare spatial column is also created.
Table Validation: When data is loaded into an existing table, the SpatialWare writer module performs validation operations between the table definition in the mapping file and that within SpatialWare. All discrepancies found are logged. All critical discrepancies result in the data load operation being halted.
Non-homogeneous Aggregate Loading: Provides the ability to load non-homogeneous aggregates into SpatialWare tables, as supported by SpatialWare.
Update Capability: This functionality is provided for SQLServer and not for Informix. The SpatialWare writer module enables features to be updated in SpatialWare through the use of specified keys and the UPDATE mode of operation. If area replacement of features is desired, this can also be accomplished by combining the capabilities of the SpatialWare writer with the SpatialWareQueryFactory. Refer to Modes of Operation (for SQLServer only) for more detail on how to use this keyword.
Delete Capability: This functionality is provided for SQLServer and not for Informix. Refer to Modes of Operation (for SQLServer only) for more detail on how to use this keyword.
SpatialWare Reader/Writer Highlights
The SpatialWare Reader/Writer format has the following capabilities:
- Programmatic Table Creation: You do not have to create tables before a data import operation. All table creation details are handled by FME.
- Programmatic Spatial Column and Attribute Verification: When loading data into an existing spatial database, FME verifies that the table definitions specified in the mapping file match the existing RDBMS definitions.
- Transaction Support: Transactions are fully supported enabling a partially complete load operation to be resumed later, without the loss of or duplication of data.
- Attribute Query Support: Any complex Structured Query Language (SQL) query can be specified to limit the data being exported.
- Spatial Query Support: FME exploits all additional spatial query capabilities of SpatialWare. Any complex SQL/Spatial query can be specified to limit the data being exported.
- Multi-Table Query Support: The queries may combine multiple RDBMS tables, thereby exploiting the full SQL capabilities of the underlying RDBMS.
- Multiple SpatialWare Connections: FME can support multiple SpatialWare connections open to the same or different SpatialWare databases. This may be used for selective replication between different SpatialWare sites, for moving data from a preparation SpatialWare to a production SpatialWare, or for building result sets of features from multiple SpatialWare databases.
- Non-Spatial Table Support: Any table can be read or written to a SpatialWare database with FME whether or not it is spatially enabled. For example, if your SpatialWare uses SQL Server, you can use FME to read, write, or create regular SQL Server tables.
- Fully Automatic Import and Export: FME’s SpatialWare support provides fully automated import and export of data through Workbench or the Quick Translator. This is ideal for quick data imports or quick data exports.
Tip: The query support enables the data export operation to be highly focused, thereby reducing the amount of data that is exported.
The SpatialWare modules in FME are designed to work with other SpatialWare products. For example, a user with a simple GUI search engine can easily identify all features satisfying a complicated query, then use FME with the SpatialWare reader to process these features.