Python Mapscript QueryByPoint
Jon Saints
saintsjd at YAHOO.COM
Tue Mar 8 04:49:04 PST 2005
I am having trouble querying a flat shapefile using
python mapscript with the queryByPoint function.
My getResults always equals None. I believe my trouble
has something to do with: (from the swig
documentation) "A query will not set results for a
layer with a NULL 'template' attribute."
I have tried using both map and pixel coords for the
point object. Both point objects, I am sure intersect
a feature of layer 0 on my map.
I receive the error:
"'NoneType' object has no attribute 'numresults'"
My code:
------------------------------------------
#Map coords
#click = pointObj()
#click.x = 77.01
#click.y = 38.89
#pixel Coords
click = pointObj()
click.x = 300
click.y = 200
myMap.getLayer(0).queryByPoint( myMap, click,
MS_SINGLE, 10.0 )
results = myMap.getLayer(0).getResults()
output = results.numresults
-------------------------------------------
excerpt from My mapfile:
------------------------------------------
LAYER
NAME dcdem2000
TYPE POLYGON
STATUS ON
METADATA
desc "Census Blocks"
logo "test.jpg"
END
DATA "/home/jons/Data/DC/created/dcdem2000"
CLASS
NAME "Census Blocks 2000"
COLOR 225 225 225
OUTLINECOLOR 100 100 100
END
END
------------------------------------------
Thanks in advance
More information about the MapServer-users
mailing list