Where 2.0 - Location on the Web 0
Now that Where 2.0 and WhereCamp are over, I wanted to get my code and slides posted.
You can download a zip of the source files, including the Store Locator demo, here
For demonstration, here is the source of the simple Loki demo:
<html>
<head>
<script type="text/javascript" src="http://loki.com/plugin/files/loki.js"></script>
<script type="text/javascript">
function init() {
// instantiate the LokiAPI object
var loki = new LokiAPI();
// setup your success handler. a location object is passed in
loki.onSuccess = function(location) {
document.getElementById('address').innerHTML = location.house_number+' '+location.street+'<br/>'+location.city+', '+location.region_code+' '+location.postal_code+'<br/>'+location.latitude+', '+location.longitude;
};
// setup your failure handler. error code and string message are passed in
loki.onFailure = function(error, msg){
alert('An error has been encountered ('+error+'). '+msg);
};
// swap in your own, domain-specific key. http://loki.com/how/register
loki.setKey('sarver.org');
// make the location request. Reverse geocoding is requested
loki.requestLocation(true,loki.FULL_STREET_ADDRESS_LOOKUP);
}
window.onload = init;
</script>
</head>
<body>
<div id="address"></div>
</body>
</html>