search tool

Michael Smith msmith at SANANGELOMPO.ORG
Thu May 26 10:48:45 EDT 2005


I am just using mapserver.  I do have php installed.  Would I just create a
page using your script or insert it inside of my map html file?

-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On
Behalf Of Kristjan Annus
Sent: Thursday, May 26, 2005 9:27 AM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-USERS] search tool

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