method to retrieve field types

Sean Gillies sgillies at FRII.COM
Mon Aug 16 12:17:21 PDT 2004


On Aug 16, 2004, at 12:39 PM, Mark Adams wrote:

> Hi all, is there a way with mapscript/mapserver to get the field types 
> for fields in a shape file? We can get the field names using PHP, and 
> if we were able to use PHP 5 we could get the types that way too, but 
> since we’re using mapscript we can’t use PHP 5. Any suggestions?
>

Mark,

Add a feature enhancement request to Bugzilla ... shouldn't be too 
difficult
to implement a method to return attribute types in a way that's similar 
to
getting attribute names and values.  Please cc me or assign the bug to 
me.

Meanwhile, all attribute values returned by shapeObj::getValue() are 
strings.
You could try to coerce them into ints and floats and check for 
exceptions
or errors?

Or take Ryan's suggestion and go through a PHP dbf module.

cheers,
Sean

--
Sean Gillies
sgillies at frii dot com
http://users.frii.com/sgillies


More information about the MapServer-users mailing list