GeoSearch.Init Tutorial
Turning GeoSearch On
To turn GeoSearch on, you will modify the body element from the previous examples by adding an onload attribute. The onload tells the browser to perform a specific action when the page has finished loading.
In this case, we want to tell the browser to initialize GeoSearch. To do this, we call the function MetaCarta.GeoSearch.Init(), passing in the ids of the list and map divs. This function initializes the map, does a first search, and displays the results on the map and in the list.
Web Services |
GTS Appliance |
<body onload="MetaCarta.GeoSearch.Init({
'textDivId': 'list',
'mapDivId': 'map'
});">
|
Use applianceHost to specify the host at which users
can access the GTS Appliance
<body onload="MetaCarta.GeoSearch.Init({
'textDivId': 'list',
'mapDivId': 'map',
'applianceHost': 'metacarta.example.com'
});">
|
You can see an example of what this should look like.
Once you add this to the page, you have a fully functioning MetaCarta-powered search interface. Open the page, and take a look. Congratulations on creating your first GeoSearch interface!
Previous: Adding the GeoSearch Library | Next: Limiting Search Results