search tool
Kristjan Annus
kristjan at TARKVARASTUUDIO.EE
Tue Feb 22 04:21:46 PST 2005
Hi Wouter
I'll send you this PHP code. But since it is from a larger application
I deleted the lines wich are not about the subject.
1.In first call user submits a search string and gets
a list of matching addresses as links.
$dbase_identifier = dbase_open( '/mapserv/data/tartu_region.dbf', 0);
$db_records = dbase_numrecords( $dbase_identifier);
$jj = 0;
for ($ii=1;$ii<=$db_records;$ii++) {
$kirje = dbase_get_record_with_names( $dbase_identifier, $ii);
if ( !(strpos( strtoupper ( $kirje['ADDRESS']),strtoupper (
$_GET["SEARCH_STR"]))===false) ) {
$jj = $jj + 1;
print ' <a
href="map.phtml?lk=1&rc='.$ii.'&title='.trim($kirje['ADDRESS']).'">
$kirje['ADDRESS']</a>';
}
}
dbase_close( $dbase_identifier);
2.When user clicks on the address the new call is made to the mapping
program with an
record number of the address in DBF as a parameter. Then the
corresponding shape is
filtered out and map extents are set to show this address. I have to
note that in my case
the address means the boundary of the land parcel with corresponding name.
$shpfileobj = ms_newShapefileObj( '/mapserv/data/tartu_region.shp', -1);
$shapeObj = $shpfileobj->getShape( $_GET["rc"]-1 );
$map->extent->setextent(
$shapeObj->bounds->minx,$shapeObj->bounds->miny,$shapeObj->bounds->maxx,$shapeObj->bounds->maxy);
I hope it helps you somehow.
Kristjan
Wouter Schaubroeck wrote:
> Hi Kristjan,
>
> I'm doing a paper about mapserver, and I'm working with data in a dbf
> file, without a corresponding shp. I have to do a search of dates, and
> i was wondering, should i convert the dbf into a mysql table, or is it
> better to leave it in dbf? And is it possible that i could see an
> example of your (php)code?
>
> thx
> Wouter Schaubroeck
> Student Ghent University
>
> Kristjan Annus wrote:
>
>> I do the address searching using PHPMapscript and PHP-s DBase functions.
>>
>> Kristjan
>>
>>> Hi Mike,
>>>
>>> I've got the same problem for the moment, and i've linked my dbf
>>> file to
>>> a mysql db and via php and a form i've got the same effect. It's a
>>> rather difficult, i think it will work.
>>>
>>> grtz
>>> Wouter Schaubroeck
>>>
>>> Michael Smith wrote:
>>>
>>>> Hi list,
>>>>
>>>> I have mapserver up and running on IIS 6 using CGI mode, maps looks
>>>> and
>>>> diplay fine. Can anyone on this list point me in the right
>>>> direction or
>>>> provide any advice on searching my maps.
>>>>
>>>> Basically what I would like for my users to be able to do is go to my
>>>> site,
>>>> type in a street name or address, hit enter, and pull up a map window
>>>> zoomed
>>>> to that particular street. Can this be done in CGI mode or do I need
>>>> something else to do this? Thanks for any help on this I have been
>>>> stuck on
>>>> this for a while.
>>>>
>>>> Mike Smith
>>>>
>>>>
>>>>
>>
More information about the MapServer-users
mailing list