[mapserver-users] Inconsistency between 5.4 and 5.2.1concerningWhichShapes()?

Steve Lime Steve.Lime at dnr.state.mn.us
Tue Apr 28 08:59:43 EDT 2009


Stupid error on my part. I was worried about getting the right set of shapes out
and spaced the correct item list part. Ugh...

I'm not sure that removing the cleanup is the answer. Users could switch shapefile
sources between layer open/close or change items used to label or classify features
and you could leak memory. I'll look at that closer though.

I have this fixed in a sandbox for 6.0 where msLayerWhichItems() was totally 
re-written, so I just need a band-aid for 5.4. Will re-open #2689...

Steve

>>> Jim Strevinas <voas_acc at hotmail.com> 04/28/09 3:05 AM >>>

Steve, you are absolutely right, according to #2689 i tried commenting
out the msLayerWhichItems (layer.i) prior to msLayerWhichShapes in
the 5.4 release. The item setup is thus maintained. 
While i'm afraid to mess with maplayer.c and maybe this will sound silly
,i observed that within maplayer.c in function msLayerWhichItems()
at line 402, a cleanup of the previous item selections is performed:

msLayerFreeItemInfo(layer);
if(layer->items) {
    msFreeCharArray(layer->items, layer->numitems);
    layer->items = NULL;
    layer->numitems = 0;
}

I commented out the whole cleanup and observed that in the whole code
below whenever needed (eg if classify is true) the elements subject to a
cleanup are just safely overwritten. Moreover, commenting out the cleanup 
fixes the problem in my humble opinion. 


> >>> Steve.Lime at dnr.state.mn.us wrote:
> 
> What does your layer definition look like? Probably stems from the fix
> put in
> place for ticket #2689 (http://trac.osgeo.org/mapserver/ticket/2689).
> That fix
> may need more work as I imagine the msLayerWhichItems() is clobbering
> the
> item setup done when the layer is opened.
> 
> Hmmm, how to fix...
> 
> Steve
> 
> >>> Jim Strevinas <voas_acc at hotmail.com> 04/27/09 8:27 PM >>>
> 
> > Hello list, I recently migrated to 5.4. I observed the following
> > inconsistency 
> > and I would be grateful if someone can duplicate the problem too.
> > In my (mapscript python) code i manually grab layer features using:
> 
> > layer.open()
> > status = layer.whichShapes(map.extent)
> > while (1):
> >        shape = layer.nextShape()
>        > if shape==None: 
>                 > break
> >        print shape.numvalues
> 
> > The last print returns the number of non-spatial attributes. 
> >  In mapserver 5.2.1 it is returned correctly but in 5.4 is always 0
> > just like all the non spatial values are all null. 



_________________________________________________________________
Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us


More information about the mapserver-users mailing list