[Mapserver-users] Shapefile attributes from mapscript::shapefileObj?
Sean Gillies
sgillies at frii.com
Mon Jun 14 08:10:12 PDT 2004
Ethan,
If you have defined a Layer that uses the shapefile as data, you can
use the getItem() method
for ($i=0; $i<$layer->{numitems}; $i++) {
$attr_name = $layer->getItem($i);
...
There is a corresponding getValue() method of shapeObj that gets
attribute values.
If you are trying to get the attribute names while outside of a Layer
context, follow Lowell's suggestion.
cheers,
Sean
On Jun 14, 2004, at 8:18 AM, Lowell Filak wrote:
> Remember that attributes are stored in the associatted DBF file and
> accessed through XBase.pm - need to run - hope that get's your started.
> There are some examples in the wiki that should also help.
> http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PerlMapScriptExamples35ex2
>
> Lowell
>
> The following message was sent by "Ethan Alpert"
> <ealpert at digitalglobe.com> on Wed, 9 Jun 2004 15:34:37 -0600.
>
>>
>>
>> Ok I give up how can I get attributes of shapes from a shapefile using
>> PERL mapscript?
>>
>> I need to extract the attributes to create labels and everything I've
>> tried gives me nothing. I have 33 points in a shapefile and each point
>> has a name and an elevation as attributes. I can see these in Arc
>> Explorer so I know they're there.
>>
>> Thanks,
>>
>> -e
>>
>> _______________________________________________
>> Mapserver-users mailing list
>> Mapserver-users at lists.gis.umn.edu
>> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>
>
--
Sean Gillies
sgillies at frii dot com
http://users.frii.com/sgillies
More information about the MapServer-users
mailing list