<span class="gmail_quote"><span class="gmail_sendername">Myunghwa,</span></span><br><br>try this...<br><br>qlayer.queryByPoint(map, qpoint, ms.MS_MULTIPLE, <span style="color: rgb(255, 0, 0);">-1</span>)<br><br>-1 allows to use the layer tolerance value
<br><br>Best regards,<br><br>Fred<br><br><div><span class="gmail_quote">On 4/23/06, <b class="gmail_sendername">Myunghwa Hwang</b> &lt;<a href="mailto:mhwang4@uiuc.edu">mhwang4@uiuc.edu</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I'm trying to retrieve attributed values for selected polygon.<br>By using python mapscript and postgis layer, I tried to get a feature by querybypoint.<br>In the following code, a feature by getFeature has no bounding box.
<br>The minimum x, y and the maximum x, y are all -1.<br>So any attribute was not retrieved.<br>Anybody has any idea of this problem?<br><br><br>def getNearFeat(qpoint, map):<br>&nbsp;&nbsp;&nbsp;&nbsp;# get query layer<br>&nbsp;&nbsp;&nbsp;&nbsp;qlayer = map.getLayerByName
('blockgroup')<br>&nbsp;&nbsp;&nbsp;&nbsp;qlayer.template = 'query_result.html'<br>&nbsp;&nbsp;&nbsp;&nbsp;qlayer.tolerance = 1000 # Unit is meter<br>&nbsp;&nbsp;&nbsp;&nbsp;# query the query layer<br>&nbsp;&nbsp;&nbsp;&nbsp;qlayer.queryByPoint(map, qpoint, ms.MS_MULTIPLE, 1000)<br>&nbsp;&nbsp;&nbsp;&nbsp;numResults = qlayer.getNumResults
()<br>&nbsp;&nbsp;&nbsp;&nbsp;results = qlayer.getResults()<br>&nbsp;&nbsp;&nbsp;&nbsp;# retrieve shape index for selected features<br>&nbsp;&nbsp;&nbsp;&nbsp;if (numResults &gt; 0):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;featAtts = []<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;qlayer.open()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for i in range(numResults):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;att = []
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;query_result = results.getResult(i)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;afeat = qlayer.getFeature(query_result.shapeindex, query_result.tileindex)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if afeat:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for j in range(qlayer.numitems):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;att.append(afeat.getValue(j))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;featAtts.append(att)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;qlayer.close()<br>&nbsp;&nbsp;&nbsp;&nbsp;return featAtts<br></blockquote></div><br><br clear="all"><br>-- <br>&quot;Everything under the sun is in tune
<br>But the sun is eclipsed by the moon&quot;