<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> <<a href="mailto:mhwang4@uiuc.edu">mhwang4@uiuc.edu</a>> 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> # get query layer<br> qlayer = map.getLayerByName
('blockgroup')<br> qlayer.template = 'query_result.html'<br> qlayer.tolerance = 1000 # Unit is meter<br> # query the query layer<br> qlayer.queryByPoint(map, qpoint, ms.MS_MULTIPLE, 1000)<br> numResults = qlayer.getNumResults
()<br> results = qlayer.getResults()<br> # retrieve shape index for selected features<br> if (numResults > 0):<br> featAtts = []<br> qlayer.open()<br> for i in range(numResults):<br> att = []
<br> query_result = results.getResult(i)<br> afeat = qlayer.getFeature(query_result.shapeindex, query_result.tileindex)<br> if afeat:<br> for j in range(qlayer.numitems):<br>
att.append(afeat.getValue(j))<br> featAtts.append(att)<br> qlayer.close()<br> return featAtts<br></blockquote></div><br><br clear="all"><br>-- <br>"Everything under the sun is in tune
<br>But the sun is eclipsed by the moon"