Assign special dbf to shapefile

Holger Floerke floerke at DOCTRONIC.DE
Sat Jan 8 08:11:37 EST 2005


Hi Stephen,

> The only way that I know of to do runtime joins in mapserver is to use
> PostGIS.
MMh, maybe I can you PostGIS, but I have to put all the shapes into the
database, too.

> Basically, it would be very slow because for each object in
> the shapefile, you would have to scan the whole DBF file, because there
> are no indexes support for DBF files,
If you use PHP-Mapscript you can produce joined dbf-files very easily. If
you have enough memory, you can extract all additional data from the
external database and build a map from the Join-Value of this query to the
whole data row. Then you will be able to iterate through the shape-dbf,
looking for the data row by using the main memory index and write the
complete row (shape-data and query-data) to a new dbf.

Thanks for your suggestion, I think it would be the only way to join the
external data sources without copying the shape files. But I will have a
look at the mapscript sources. Maybe I can do a "Layer->setDBF(filename)" or
something like that.

HolgeR


Stephen Woodbridge schrieb:

> The only way that I know of to do runtime joins in mapserver is to use
> PostGIS. You might be able to do something with gdal, but I think it is
> very slow.  I have requested support for runtime shapefile joins to
> either DBF or MySQL multiple times and nothing has happened in that
> direction. Basically, it would be very slow because for each object in
> the shapefile, you would have to scan the whole DBF file, because there
> are no indexes support for DBF files, or the developers would have to
> build DBF indexing support into mapserver. For Mysql, you could index
> the columns, but you would still need to make a separate query for every
> object in the shapefile.
>
> In PostGIS, since you have all the data in the database to start with
> you can make one query for the layer and do the join in that query, then
> you only have to fetch back the objects to render.
>
> -Steve W.
>
> Holger Floerke wrote:
>
>> Hi Jacob,
>>
>>
>>> Why would you not want to join them?
>>



More information about the mapserver-users mailing list