OGR connection vs shp DATA

Frank Warmerdam warmerdam at POBOX.COM
Thu Nov 18 07:08:32 PST 2004


Eduin Carrillo wrote:
> Can somebody explain me benefits of using OGR as shapefile datasource vs.
> reading shp files directly?

Eduin,

Advantages of using OGR for shapefile access:

  o OGR is slower than built-in Shapefile support because of many extra
    layers of abstraction and conversion.
  o OGR is slower because it doesn't currently support use of spatial
    indexes for shapefiles while the built-in mapserver shapefile support
    does.  (Note: I actually have support for mapserver style spatial indexes
    half implemented in my local development tree, but no ETA).
  o OGR supports "OGR SQL" in the DATA statement, though most effects you
    might accomplish that way can be simulated at least as efficiently using
    MapServer expressions and other mechanisms.
  o You can use OGR style joins, including the ability to join to some
    non-shapefile types of stuff as long as it is supported by OGR.  I am
    not sure how OGR joining compares to the built-in mapserver joins that
    work for shapefiles.

Basically, except for rare circumstances you are better off using the
built-in shapefile support instead of accessing through OGR.

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 MapServer-users mailing list