Iterating layer features in mapscript effectively

Steve Lime steve.lime at DNR.STATE.MN.US
Thu Oct 6 17:02:17 EDT 2005


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 mitigated
a great deal by doing some indexing. That's another bug though...

If you file a bug we can expose the msLayerWhichShapes and  msLayerNextShape 
functions as layer methods. I can take care of the SWIG end of things and then 
pass the bug on to the PHP folks.

Steve

>>> Frank Warmerdam <warmerdam at POBOX.COM> 09/28/05 7:40 PM >>>
On 9/28/05, Tamas Szekeres <szekeres.tamas at freemail.hu> wrote:
> Hi list,
>
> I would like to iterate the features of the layers with mapscript in order
> 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 supporting
> the proper functions could be mapped to msLayerWhichShapes and
> msLayerNextShape similar to msDrawLayer accesses features. The only way I
> 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 of
> overhead by copying all of the features into the result cache.

Tamas,

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
themselves.

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 pobox.com 
light and sound - activate the windows | http://pobox.com/~warmerdam 
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the mapserver-dev mailing list