Skip to content

Commit

Permalink
Limit autocomplete results by country, try to limit to city
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernardo authored and Bernardo committed Apr 10, 2018
1 parent 3715b19 commit 874f269
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/configs/MainConfigs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
export default {
city_center: {lat: -23.550406, lon: -46.633994},
city_bbox_w: -46.826251587155276,
city_bbox_s: -24.008125453472775,
city_bbox_e: -46.365099600379388,
city_bbox_n: -23.356585227755030,
city_state: "São Paulo, SP",
buffer_distance: 2.2, // the initial buffer distance for calculating school proximity
distance_units: "kilometers",
Expand Down
9 changes: 8 additions & 1 deletion src/containers/AddressInput/AddressForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,14 @@ export class AddressForm extends React.Component {
const placesAutocompleteOptions = {
location: new google.maps.LatLng(GLOBALS.city_center.lat, GLOBALS.city_center.lon),
radius: 20000,
types: ['address']
types: ['address'],
componentRestrictions: {country: "br"},
// FIXME: bounds and strictBounds still not working
bounds: new google.maps.LatLngBounds(
new google.maps.LatLng(GLOBALS.city_bbox_s, GLOBALS.city_bbox_w),
new google.maps.LatLng(GLOBALS.city_bbox_n, GLOBALS.city_bbox_e)
),
strictBounds: true
};
const cssClasses = {
input: 'autocomplete-input'
Expand Down

0 comments on commit 874f269

Please sign in to comment.