[mapserver-users] RE: Mapserver getExtent

Puneet Kishor pkishor at GeoAnalytics.com
Mon Nov 12 18:37:33 EST 2001


Erwin,

One errata in what I just wrote you...


> 4. .dbf files are really primitive. They have an absolute 
> sort order that is hard-coded in the way the file is written. 
> You have to somehow query the .dbf file for City eq "Delft" 
> and get the row number of the that record. You can use the 
> Xbase module in PHP to do that. I have not done that. 
> Instead, I imported the .dbf file into a MySQL table and 
> created a new field called row_id. I populated the row_id 
> with the corresponding row number in the .dbf file. Keep in 
> mind, the .dbf file is indexed from 0, however, the first row 
> contains the row headers (the field names). Now I simply 
> query the MySQL table for City eq "Delft" and get its row_id.


Actually, what I meant to say was that the Shapes are indexed from 0 while
the .dbf file is indexed from 1. Since the first row of the .dbf file is the
fieldnames, it is the second row in the .dbf file that corresponds to the
first shape in the shapefile. This first shape is shape[0]. Hence, when I
populate the MySQL table with the .dbf data, I calculate the row_id field
with a sequence starting from 0. That way, when I retrieve row_id from any
record, I automatically get the correct index for the corresponding shape.

Hth,

pk/ 



More information about the mapserver-users mailing list