<div dir="ltr"><div>hi</div>
<div> </div>
<div>Can someone here guide me on this issue please.<br></div>
<div>My Objective is to get attribute values for any selected street (Line).<br>My client application is based on KaMap.<br>I have a similar solution for Polygons which works perfectly. </div>
<div class="gmail_quote">
<div lang="EN-US" link="blue" vlink="purple">
<div>
<p><br>I am trying to query a street layer which gives me the following error. </p>
<p>Warning: [MapServer Error]: msQueryByPoint(): No matching record(s) found in C:\... on line 84<br>Warning: [MapServer Error]: msShapefileOpen(): (/ms4w/maps/./city/./city/streets) in c:\... on line 84</p>
<p><br>MAPFILE<br>**********************<br> LAYER<br> NAME 'streets_Query'<br> GROUP 'streets_Query'<br> DATA './city/streets'<br> TYPE line<br> MAXSCALE 3001<br> STATUS ON</p>
<p> TOLERANCE 5<br> TEMPLATE './_templates/Streets_Identify.html'<br> METADATA<br> "queryable" "true"<br> searchfield "ANAME"<br> fields "ZIP_CODE"<br>
END<br> END #end layer</p>
<p> </p>
<p>PHP MAPSCRIPT<br>**********************<br>//------- Get Input Parameters.<br>if (isset($_REQUEST['map'])) {$szMap = $_REQUEST['map'];} else {echo "map not defined"; die;}<br>if (isset($_REQUEST['coords'])) {$coords = explode(',',$_REQUEST['coords']);} else {echo "coordinate not defined"; die;}</p>
<p><br>//------- Load Mapscript Module.<br>$szPHPMapScriptModule = 'php_mapscript.'.PHP_SHLIB_SUFFIX;<br>if (!extension_loaded('MapScript')) {<br> dl($szPHPMapScriptModule);<br>}</p>
<p>//------- Load Current Map file.<br>$szMapFile=str_replace('<<Map>>',$szMap,'/ms4w/maps/<<Map>>.map');<br>$oMap = ms_newMapObj($szMapFile);</p>
<p><br>//------- SETTING MAP EXTENT to query extent.. <br>$mapExtent = $oMap->extent;<br>$oMap->setExtent($coords[0],$coords[1], $coords[0]+0.000001,$coords[1]+0.000001);</p>
<p>//------- SETTING QUERY POINT<br>$point = ms_newPointObj();<br>$point->setXY($coords[0], $coords[1]);</p>
<p>//------- Initialize map query.<br>$oMap->preparequery();</p>
<p>//------- LOOP ON LAYERS and get identify results.<br>$tot = $oMap->numlayers;<br>for ($i = 0; $i < $tot; $i++) {<br> //------- get map layer.<br> $oLayer = $oMap->getLayer($i);</p>
<p> //------- Verify Layer type<br> if ($oLayer->name != 'streets_Query') continue;</p>
<p> //------- Validate if query succeeds.<br> $check_query = $oLayer->queryByPoint($point, MS_SINGLE, 0); <br> if ($check_query != MS_SUCCESS) {continue;}</p>
<p> //------- Open layer for data input. <br> $oLayer->open();</p>
<p> //------- Get the record values corresponding to a result tileindex.<br> $oResultCache = $oLayer->getResult(0);<br> $oShape = $oLayer->getShape($oResultCache->tileindex, $oResultCache->shapeindex);<br>
$aValues = $oShape->values;</p>
<p> //------- Get the field value.<br> echo $aValues['ZIP_CODE']; echo ";";<br> <br> //------- FREE SHAPE <br> $oShape->free();<br> $oLayer->close();<br> break; <br>} // for i</p>
<p><br>Best regards,<br>Mir Hashmi<span style="FONT-SIZE: 8pt; COLOR: #606060"></span></p>
<p> </p></div><br>
<hr>
<font face="Arial" color="gray" size="1">This message may contain confidential and/or privileged information. If you have received this message in error,please notify us immediately by responding to this e-mail and delete it from your system. Thanks for your cooperation.<br>
</font></div></div><br></div>