May well be a tolerance issue. By default it's in pixels and based on the extent you're setting (I don't know what the map SIZE is set to) it's probably a super tiny value. Have you tried setting a tolerance in map units? E.g.
TOLERANCE 5 TOLERANCEUNITS meters # or whatever Just an idea... Steve >>> On 7/8/2009 at 12:20 PM, in message <[email protected]>, Hussain Hashmi <[email protected]> wrote: > hi > > Can someone here guide me on this issue please. > My Objective is to get attribute values for any selected street (Line). > My client application is based on KaMap. > I have a similar solution for Polygons which works perfectly. > > > I am trying to query a street layer which gives me the following error. > > Warning: [MapServer Error]: msQueryByPoint(): No matching record(s) found in > C:\... on line 84 > Warning: [MapServer Error]: msShapefileOpen(): > (/ms4w/maps/./city/./city/streets) in c:\... on line 84 > > > MAPFILE > ********************** > LAYER > NAME 'streets_Query' > GROUP 'streets_Query' > DATA './city/streets' > TYPE line > MAXSCALE 3001 > STATUS ON > > TOLERANCE 5 > TEMPLATE './_templates/Streets_Identify.html' > METADATA > "queryable" "true" > searchfield "ANAME" > fields "ZIP_CODE" > END > END #end layer > > > > PHP MAPSCRIPT > ********************** > //------- Get Input Parameters. > if (isset($_REQUEST['map'])) {$szMap = $_REQUEST['map'];} else {echo "map > not defined"; die;} > if (isset($_REQUEST['coords'])) {$coords = > explode(',',$_REQUEST['coords']);} else {echo "coordinate not defined"; > die;} > > > //------- Load Mapscript Module. > $szPHPMapScriptModule = 'php_mapscript.'.PHP_SHLIB_SUFFIX; > if (!extension_loaded('MapScript')) { > dl($szPHPMapScriptModule); > } > > //------- Load Current Map file. > $szMapFile=str_replace('<<Map>>',$szMap,'/ms4w/maps/<<Map>>.map'); > $oMap = ms_newMapObj($szMapFile); > > > //------- SETTING MAP EXTENT to query extent.. > $mapExtent = $oMap->extent; > $oMap->setExtent($coords[0],$coords[1], > $coords[0]+0.000001,$coords[1]+0.000001); > > //------- SETTING QUERY POINT > $point = ms_newPointObj(); > $point->setXY($coords[0], $coords[1]); > > //------- Initialize map query. > $oMap->preparequery(); > > //------- LOOP ON LAYERS and get identify results. > $tot = $oMap->numlayers; > for ($i = 0; $i < $tot; $i++) { > //------- get map layer. > $oLayer = $oMap->getLayer($i); > > //------- Verify Layer type > if ($oLayer->name != 'streets_Query') continue; > > //------- Validate if query succeeds. > $check_query = $oLayer->queryByPoint($point, MS_SINGLE, 0); > if ($check_query != MS_SUCCESS) {continue;} > > //------- Open layer for data input. > $oLayer->open(); > > //------- Get the record values corresponding to a result tileindex. > $oResultCache = $oLayer->getResult(0); > $oShape = $oLayer->getShape($oResultCache->tileindex, > $oResultCache->shapeindex); > $aValues = $oShape->values; > > //------- Get the field value. > echo $aValues['ZIP_CODE']; echo ";"; > > //------- FREE SHAPE > $oShape->free(); > $oLayer->close(); > break; > } // for i > > > Best regards, > Mir Hashmi > > > > ------------------------------ > 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. _______________________________________________ mapserver-users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/mapserver-users
