[Mapserver-users] Getting attributes of tiled shapefile data

Sean Gillies sgillies at frii.com
Tue Oct 7 22:09:30 EDT 2003


Steve,

Thanks for the tip!  There's also a 'values' attribute for the
SWIGged shapeObj, but it's not as useful since it returns a
SWIG pointer rather than a hash.  You did point me in the right
direction.

Best I could come up with uses Python's list comprehensions.

     res = layerobj.getResult(j)
     shp = layerobj.getShape(res.tileindex, res.shapeindex)
     items = [layerobj.getItem(i) for i in range(layerobj.numitems)]
     values = [s.getValue(i) for i in range(layerobj.numitems)]
     cfcc = values[items.index('CFCC')]

Not as nice as PHP ... yet one more thing to catch up with.

thanks again,
Sean

On Tuesday, October 7, 2003, at 07:39  PM, Stephen Woodbridge wrote:

> Sean,
>
> In PHP mapscript, I do it like this:
>
> $res = $layer->getResult($j);
> $shp = $layer->getShape($res->tileindex, $res->shapeindex);
> $cfcc = $shp->values['CFCC'];
>
> where CFCC is the field name.
>
> -Steve W.
>
> On 7 Oct 2003 at 19:03, Sean Gillies wrote:
>
>> I'm using a layer with tiled shapefile data in a MapScript app.  When
>> using the query* methods I get set of results and each result has
>> tileindex and shapeindex attributes so that I can get get the
>> appropriate shape from the shapefile.
>>
>> However, how about the shape attributes?  With untiled data in one
>> shapefile, I'd just get the appropriate record from the single dbf
>> file using dbflib (Python) or XBase (Perl).  But now that the
>> attributes are spread across N dbf files, I'm at a loss on which dbf
>> file and which record given the pair of tileindex and shapeindex.
>>
>> Perhaps it's possible to access the result.tileindex (or tileindex-1)
>> record of the layer's tileindex dbf file to find the appropriate
>> shapefile and then get the result.shapeindex record from that
>> shapefile's dbf?  I'd be grateful to hear about a less convoluted way!
>>
>> cheers,
>> Sean
>>
>> --
>> Sean Gillies
>> sgillies at frii dot com
>> http://www.frii.com/~sgillies
>>
>> _______________________________________________
>> Mapserver-users mailing list
>> Mapserver-users at lists.gis.umn.edu
>> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>>
>
>




More information about the mapserver-users mailing list