Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Commit

Permalink
Adds support for result limiting within a given country.
Browse files Browse the repository at this point in the history
  • Loading branch information
Blake Simpson committed May 24, 2012
1 parent 125cb25 commit e3dc63b
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 70 deletions.
46 changes: 46 additions & 0 deletions examples/country_limit.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html>
<head>
<title>$.geocomplete()</title>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="styles.css" />
</head>
<body>

<form>
<input id="geocomplete" type="text" placeholder="Type in an address" size="90" />
<input id="find" type="button" value="find" />
</form>

<div class="map_canvas"></div>

<p>Try searching for somewhere. All results should be within Germany. <br />
For further details on result limiting via country: <a href="http://code.google.com/apis/maps/documentation/javascript/places.html#adding_autocomplete">http://code.google.com/apis/maps/documentation/javascript/places.html#adding_autocomplete</a> and read about '<em>componentRestrictions</em>'. <br />
The Geocoder can also be limited by region: <a href="https://developers.google.com/maps/documentation/javascript/reference#GeocoderRequest">https://developers.google.com/maps/documentation/javascript/reference#GeocoderRequest</a>
</p>


<script src="http://maps.googleapis.com/maps/api/js?sensor=false&amp;libraries=places"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

<script src="../jquery.geocomplete.js"></script>
<script src="logger.js"></script>

<script>
$(function(){
var center = new google.maps.LatLng(51.165691,10.451526);

$("#geocomplete").geocomplete({
map: ".map_canvas",
types: ['establishment'],
country: 'de'
});

var map = $("#geocomplete").geocomplete("map")

map.setCenter(center);
map.setZoom(6);
});
</script>
</body>
</html>
Loading

0 comments on commit e3dc63b

Please sign in to comment.