Skip to content

Instantly share code, notes, and snippets.

@popkinj
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save popkinj/9042279 to your computer and use it in GitHub Desktop.
Save popkinj/9042279 to your computer and use it in GitHub Desktop.
A simple example of using the BC Government Geocoder.
<!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