Assign special dbf to shapefile

Richard Greenwood richard.greenwood at GMAIL.COM
Sat Jan 8 09:58:48 EST 2005


On Fri, 7 Jan 2005 07:03:52 -0600, Holger Floerke <floerke at doctronic.de> wrote:
> Hi all,
>
> am I able to assign a special dbf-file to a shape file? For example
> rendering the 'airports.shp', but using data from 'airports_passengers.dbf'
> and not from 'airports.dbf' (ensuring the correct order for the
> shape-information-mapping). Or another example, render some area shapes on
> the one hand with popuplation data and on the other hand with unemployment
> data without integrating both data sets into the dbf of the shape file and
> without producing two different shape-files. I use php-mapscript and
> mapserver 4.4.
>
> HolgeR
>

Mapserver supports a limited join which allows you to display
attribute data from the joined table, but not use data in the joined
table for labels, queries of classification.

You should check out OGR joins:
    http://gdal.maptools.org/ogr/ogr_sql.html

The OGR join allows you to classify and label from the joined data,
but fields in the joined table can not be used in queries. Syntax
looks something like this:

   DATA "SELECT * FROM shapeFile LEFT JOIN 'dbfFile.dbf'.listing ON
shapeFile.id = dbfFile.id"

It is very slow without indexes, but OGR does support indexes, e.g.
   ogrinfo -ro dbfFile -sql "create index on listing using id"

Even with indexes, a large table may be to slow, so I would recommend
postgis for larger tables.

Regards,
--
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com



More information about the mapserver-users mailing list