SiteWatch API Help

search

search

Previous topic Next topic  

search

Previous topic Next topic  

A method to search for addresses on the map.

 

Please note that the page has to be UTF-8 encoded for the server if using non-English characters.

 

Parameter

Value

searchString: string

Search string.

function: name

An asynchronous JavaScript function that implements the logic when the function call returns.

scope: name (optional)

Owner of the current object.

 

 

Example:

function sResult(map, res)

{

var txt = "";

 

var r = res.OK; //Search success (true) or failure (false).

 

for (var i = 0, c = res.data.length; i < c; i++)

{

//n = streetname, x = x-coordinate, y = y-coordinate.

txt = txt +

res.data[i].n + " point(" + res.data[i].p[0].x + ", " + res.data[i].p[0].y + ")";

 

//c = category (1 = address, 4 = city).

//var cat = res.data[i].c;

 

map.setCenter( {res.data[i].p[0].x, res.data[i].p[0].y}, 10);

}

 

//Do something with the txt object!

}

 

var text = 'Laugavegur 32';

 

map.search(text, sResult, this);