[mapserver-users] finding extent of a polygon

Puneet Kishor pkishor at GeoAnalytics.com
Thu Jul 26 05:54:42 PDT 2001


Hi all,

The following is proving to be inordinately difficult. I hope someone on 
the list can either guide me to the correct way, or confirm that it is 
not possible so I stop wasting my time.

For simplicity sake, say, I have a parcels layer with an attribute 
called parcel_id. Given a parcel_id I want that polygon (or polygons, if 
I have more than one parcel_id), get its extent, and zoom to it.

The closest I have gotten is trying to read in the parcel.shp file using 
ms_newShapeFileObj like so --

$shapeFile = ms_newShapefileObj( "data/parcel", -1 );

which, of course, doesn't work right there... gives me a "Fatal error: 
Failed to open shapefile data/parcel.

Even if I could get the shape file open, I really don't know quite what 
to do next. I can't really query the shape file with $parcel_id because 
$parcel_id is an attribute and is really stored in the parcel.dbf. 
However, parcel.dbf doesn't have any (visible) link between the 
attribute and the shape file... there must be one... some kind of shape 
index... what is it? where is it stored? how do I access it?

As I said above, at the very least I need to know whether the above is 
even possible or not. Then I have worry about why I can't open the shape 
file? then I have to find the link between the shape file and the dbf 
file for that layer.

Many tia,

pk/



More information about the MapServer-users mailing list