search tool

Kristjan Annus kristjan at TARKVARASTUUDIO.EE
Thu May 26 07:27:19 PDT 2005


Hi,

Are you using just mapserver or some scripting language ie. PHP as well?

Here is the PHP code witch I use to locate address names from shape and
deliver it to the user in a form of html - table, so that he can choose one
for output to the map.


                  $mySearchLayer = $map->getLayerByName("krundipiirid");
                  $mySearchLayer->set("status", 1);
                  $qstring = "('[Nimi]' =~ /".$otsiaadr.".*/)";
                  @$mySearchLayer->queryByAttributes("Nimi",$qstring
,MS_MULTIPLE);

                  if ($mySearchLayer->getNumResults()>0) {
                    $mySearchLayer->open();
                  for ($i=0; $i<$mySearchLayer->getNumResults(); $i++) {
                    $myResult = $mySearchLayer->getResult($i);
                    $myShape =
$mySearchLayer->getShape($myResult->tileindex,$myResult->shapeindex);
                    $myShapeExtent = $myShape->bounds;
                    echo '<tr><td bgcolor=#BBBBBB><a href="#"
onclick="window.document.kaardivorm.objekt.value=\''.$myResult->tileindex.';'.$myResult->shapeindex.'\';window.document.kaardivorm.submit();return
false;">';
                    echo $myShape->values['NIMI'];
                    echo '</a></td></tr>';
                  }
                  } else {
                    print 'no objects';
                  }


Kristjan

>Hi List,
>
>I am working a implementing mapserver in our local govt.  I have it up and
>running.  Can anyone provide a template or example of how to search for a
>street and have mapserver zoom to that area?  Thanks.
>
>Mike
>
>



More information about the MapServer-users mailing list