[Gdal-dev] ogr2ogr and the MapInfo and PostGIS drivers

Frank Warmerdam fwarmerdam at gmail.com
Wed Mar 16 22:08:11 EST 2005

On Thu, 17 Mar 2005 13:03:38 +1100, Rhys Ickeringill
<rhysi at omnilink.com.au> wrote:
> Hi List,
> There seems to be no documentation defining the "format specific" data
> source and layer creation options for the OGR MapInfo driver. Am I correct
> in assuming there are none?


The drv_mitab.html (http://www.gdal.org/ogr/drv_mitab.html) is the place
where all format specific creation options and issues should be discussed.
I am not aware of any creation options missing from that document, but 
there could easily be.  I see this document does not discuss the spatial
indexing for Mapinfo TAB files at all. 
> Hunting around in the OGR source (looking for the above) I also noted an
> undocumented "-nlt" option for ogr2ogr that seems to allow me to do what I
> need (create a PostGIS layer with a manually specified type). Should it not
> be used? Is there an "official" way to do this?

The -nlt is the correct way to fix a particular geometry type for a layer. 
I see it was properly described in the ogr2ogr usage message, but
not in the online documentation. I have added it.
> Finally, does the MapInfo driver make use of index files (*.ind) created by
> MapInfo Pro? Are there other ways to speed up MapServer's rendering of
> layers which use the OGR MapInfo driver?

Somwhat oddly, MITAB can read attribute indices, but OGR provides
no support for using them to accelerate attributes queries.  However, 
the OGR shapefile driver actually uses Mapinfo .ind format for attribute
indexing and does accelerate some queries using them.   In any event, 
the result is that attribute indexes are not utilized for mapinfo formats at
this time. 

I would add that mapinfo .tab spatial indexes are used to speed up
spatial filtering. 

> eg. I have the MapServer layer definition (irrelevant directives removed):
>     TYPE line
>     CONNECTION roads.tab
>     DATA "select * from roads where roadtype = 1"
> Given that roads.tab is BIG, is there some way I can speed up the rendering
> of this layer? Or is pre-splitting roads.tab into multiple files based on
> the roadtype attribute going to be the best option?

There can be very serious performance issues with use of 
OGR layers in MapServer (really just with query operations) 
when using the SQL statement style of DATA statement, so I 
generally discourage it in performance sensitive situations. 

In your case if performance is a problem, I would indeed suggest
you pre-extract the specific road types you want to render into 
seperate files ahead of time. 

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the Gdal-dev mailing list