[mapserver-users] unique class for each attribute

Hankley, Chip Chip.Hankley at GASAI.Com
Thu Jun 13 15:42:47 EDT 2002


Pushkar...

Check out the following PHP script:

<?
$db_id = dbase_open("C:\Inetpub\wwwroot\DePere\Data\parcels.dbf", 0);
$myDbArray = dbase_get_record_with_names($db_id, 1);
dbase_close($db_id);

$field_names = array_keys($myDbArray);

$num_fields = count($field_names);

foreach ($field_names as $i) {
  echo "$i<BR>\n";
}
?>

If you paste this into a blank PHP doc, AND supply the dbase_open line with
a valid path to a shapefile's DBF, the script will print a list of the DBASE
fields.

I would think you could use something like this to drive the MapScript part
of what you are talking about.

Chip

-----Original Message-----
From: Pushkar Pradhan [mailto:pushkar at ERC.MsState.Edu]
Sent: Thursday, June 13, 2002 12:39 PM
To: mapserver-users at lists.gis.umn.edu
Subject: [mapserver-users] unique class for each attribute


Is there a way to read the attribute fields in php/mapscript for a layer?
i.e. layer - landuse.shp has attribute: name
Is there a way to read each value of this field or more specifically -
create a different class for a common value of this field without having
to construct a class explicitly giving a name from the script or defining
a class in the .map file?
I hope I am not confusing anyone, thanks.

-Pushkar S. Pradhan



More information about the mapserver-users mailing list