This project has moved and is read-only. For the latest updates, please go here.

How To locate a Polygon on the basis of attributes in the dbf file

Topics: Data Access, Algorithms, SharpMap v0.9 / v1.x, Web Controls
Dec 29, 2007 at 11:18 AM
I want to get to the location with the hepl of attributes that are there in the dbf file .
Example :
Suppose the dbf file is made up of columns like ID,Location
Now if I give the ID and location as input then i my map in ajax to zoom that particular location.
Please help me with the solution.
Dec 29, 2007 at 3:27 PM

I can give the general algorithm that you would need to follow if you know the record number in the .dbf.

  1. compute the record number in the .dbf - call it n
  2. retrieve the nth entry in the .shx index file - there are two parts: the location of the shape in the .shp and the size of the shape in the .shx
  3. depending on the type of shapes in the shapefile you may or may not have to read the whole shape into memory and then compute a bounding box or location in the case of points. From that you should be able to position your map accordingly.

You should probably review the shapefile format documents, the official one from ESRI and the wikipedia entry