VS: [mapserver-users] Mapserver search performance

Eichner, Andreas - SID-NLKM Andreas.Eichner at sid.sachsen.de
Thu May 5 04:16:03 EDT 2011


Have a look at http://www.gdal.org/ogr/ogr_sql.html and
http://www.gdal.org/ogr2ogr.html

If you have base.{shp,shx,dbf} and addon.dbf that look like

  $ ogrinfo -al -so base.shp 
  INFO: Open of `base.shp'
        using driver `ESRI Shapefile' successful.

  Layer name: base
  Geometry: Multi Point
  Feature Count: 1099
  Extent: (4636093.190318, 5632568.189608) - (4667726.042353,
5652933.942667)
  Layer SRS WKT:
  (unknown)
  OBJ_ID: String (10.0)
  OBJ_NAME: String (50.0)

and

  $ ogrinfo -al -so addon.dbf 
  INFO: Open of `addon.dbf'
        using driver `ESRI Shapefile' successful.

  Layer name: addon
  Geometry: None
  Feature Count: 1099
  Layer SRS WKT:
  (unknown)
  OBJ_ID: String (10.0)
  GN: String (45.0)
  KN: String (13.0)
  KN2: String (7.0)
  HHO: Integer (4.0)

you will end up in something like

  $ogr2ogr -f "ESRI Shapefile" -sql "SELECT OBJ_ID, OBJ_NAME, GN, KN,
KN2, HHO FROM base JOIN 'addon.dbf'.addon ON base.OBJ_ID = addon.OBJ_ID"
output base.shp

and lead to this

  $ ogrinfo -al -so output/base.shp 
  INFO: Open of `output/base.shp'
        using driver `ESRI Shapefile' successful.

  Layer name: base
  Geometry: Multi Point
  Feature Count: 1099
  Extent: (4636093.190318, 5632568.189608) - (4667726.042353,
5652933.942667)
  Layer SRS WKT:
  (unknown)
  OBJ_ID: String (10.0)
  OBJ_NAME: String (50.0)
  GN: String (45.0)
  KN: String (13.0)
  KN2: String (7.0)
  HHO: Integer (4.0)

Hope this helps :)


More information about the mapserver-users mailing list