[Mapserver-dev] layer queryByShape and SDE

Howard Butler hobu at iastate.edu
Thu Jan 15 17:42:26 EST 2004

Dear List,

I am having some problems querying an SDE layer using mapscript and the 
layer.queryByShape method.  I have two SDE layers, counties, and state, and 
I can query for a state and get it returned into a shapeObj without much 
trouble.  When I try to use that shape to query against the counties layer, 
I run into trouble.  Both layers have a TEMPLATE defined in the mapfile.

def return_results(amap, statename):
     import sys
     cnty_layer = amap.getLayerByName("counties")
     state_layer = amap.getLayerByName("state")
     state_layer.filteritem = 'STATENAME'
     qstring = "UPPER(STATENAME) = '%s'" % statename.upper()
     qryresult = state_layer.queryByAttributes(amap, 'STATENAME', qstring, 
     resultmember = state_layer.getResult(0)
     index = int(resultmember.shapeindex)
     myShape = shapeObj(MS_SHAPE_POLYGON)
     statename= myShape.getValue(1) #the field named "STATENAME"
     sys.stderr.write('Statename %s\n'%statename) #prints correct name
     cnty_result = cnty_layer.queryByShape(amap, myShape) # <-- crashes here

The mapscript is in Python.  Running it through gdb shows that it is 
crashing here:
msAddLine (p=0xbffff180, new_line=0xbffff028) at mapprimitive.c:126
126         extended_line[c]= p->line[c];

At the moment, I am stumped.  Any ideas, pointers, or requests for more 
information would be greatly appreciated.



More information about the mapserver-dev mailing list