Last active
August 29, 2015 13:56
-
-
Save popkinj/9042279 to your computer and use it in GitHub Desktop.
A simple example of using the BC Government Geocoder.
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">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-outputSRS=4326 | |
data-template="simple" | |
data-maxResults=8 | |
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) { | |
$("#output").fadeOut(function () { | |
$(this). | |
html("Longitude: "+data.lon+", Latitude: "+data.lat). | |
fadeIn(); | |
}); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment