Iterating layer features in mapscript effectively

Tamas Szekeres szekeres.tamas at FREEMAIL.HU
Fri Oct 7 07:16:44 EDT 2005

I have posted a report in


On Thu, 6 Oct 2005 16:02:17 -0500, Steve Lime <steve.lime at DNR.STATE.MN.US>

>I bumped my head on this one too recently and relied on the query option
as a
>work around. The second pass is a big deal for some sources but can be
>a great deal by doing some indexing. That's another bug though...
>If you file a bug we can expose the msLayerWhichShapes and
>functions as layer methods. I can take care of the SWIG end of things and
>pass the bug on to the PHP folks.
>>>> Frank Warmerdam <warmerdam at POBOX.COM> 09/28/05 7:40 PM >>>
>On 9/28/05, Tamas Szekeres <szekeres.tamas at> wrote:
>> Hi list,
>> I would like to iterate the features of the layers with mapscript in
>> to represent the attributes (of the features drawn) in table format for
>> the user. I think the most effective way of this work would be
>> the proper functions could be mapped to msLayerWhichShapes and
>> msLayerNextShape similar to msDrawLayer accesses features. The only way
>> could find is to call layeobj.getFeature which calls msLayerGetShape to
>> provide random access to features, however there is no interface to find
>> out the range of valid record numbers.
>> Performing querying by rect would be an other way, but it involves much
>> overhead by copying all of the features into the result cache.
>To the best of my knowledge the various queries just copy the set of
>matching feature ids into the results cache, not the whole features
>Of course, as I have indicated before, I think there are significant
>performance issues with the current two pass query approach since
>fetches by feature id are expensive from some backend data providers.
>So it would indeed be desirable to have the direct access to features
>that the drawing functions have accessable to mapscript.
>Best regards,
>I set the clouds in motion - turn up   | Frank Warmerdam,
warmerdam at
>light and sound - activate the windows |
>and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the mapserver-dev mailing list