Created
February 16, 2014 23:56
-
-
Save popkinj/9042402 to your computer and use it in GitHub Desktop.
A slightly more complex BC Geocoder example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>BC Geocoder Test Page</title> | |
<meta charset="utf-8"/>> | |
</head> | |
<body> | |
<div class="container"> | |
<h1 class="title"><span class="kinda">kinda</span>Simple Geocoder</h1> | |
<!-- | |
- All geocoder variables can be specified through data attributes. | |
- I've only added a couple options here. | |
--> | |
<input | |
type="text" | |
class="bc-geocoder typeahead" | |
data-output-S-R-S=3005 | |
data-template="accuracy" | |
data-max-results=5 | |
data-callback="showCoords" | |
autocomplete="off" | |
placeholder="Find a place" | |
x-webkit-speech/> | |
<div id="output"></div> | |
</div> | |
<script type="text/javascript" src="jquery.min.js"></script> | |
<script type="text/javascript" src="bc-geocoder.js"></script> | |
<script type="text/javascript"> | |
function showCoords (data) { | |
var html = "<p class='coords'>Albers Longitude: "+data.lon+", Latitude: "+data.lat+"</p>"+ | |
"<p class='meta'>Locality type is "+data.localityType+"</p>"+ | |
"<p class='meta'>Location descriptor is "+data.locationDescriptor+"</p>"+ | |
"<p class='meta'>Positional Accuracy is "+data.locationPositionalAccuracy+"</p>"; | |
$("#output").fadeOut(function () { | |
$(this). | |
html(html). | |
fadeIn(); | |
}); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment