Google Maps API PlacesService suggestions showing out of bounds resultsIs there a link to the “latest” jQuery library on Google APIs?Google Maps API v3: How to remove all markers?Google Map API v3 — set bounds and centerHow to disable mouse scroll wheel scaling with Google Maps APIGoogle Maps JS API v3 - Simple Multiple Marker ExampleGoogle Places API: Are “place_id” or “id” unique to any city in the world?Google Maps API Autocomplete search without selecting from dropdownGoogle Maps & JavaFX: Display marker on the map after clicking JavaFX buttonValues for “components” in google autocomplete API requestPlaceId for subpremise
E: Sub-process /usr/bin/dpkg returned an error code (1) - but how do I find the meaningful error messages in APT's output?
Is there a commercial liquid with refractive index greater than n=2?
Has there ever been a truly bilingual country prior to the contemporary period?
How could Tony Stark wield the Infinity Nano Gauntlet - at all?
In xXx, is Xander Cage's 10th vehicle a specific reference to another franchise?
Stuffing in the middle
!I!n!s!e!r!t! !n!b!e!t!w!e!e!n!
Count the frequency of items in an array
How much code would a codegolf golf if a codegolf could golf code?
Are required indicators necessary for radio buttons?
How can I pack my food so it doesn't smell?
Designing a prison for a telekinetic race
Convert HTML color to OLE
Why would the President need briefings on UFOs?
RegionUnion works but RegionIntersection does not
How could China have extradited people for political reason under the extradition law it wanted to pass in Hong Kong?
How to dismiss intrusive questions from a colleague with whom I don't work?
90s(?) book series about two people transported to a parallel medieval world, she joins city watch, he becomes wizard
How to decide whether an eshop is safe or compromised
Does the Symbiotic Entity damage apply to a creature hit by the secondary damage of Green Flame Blade?
Land Registry Clause
Interaction between Ethereal Absolution versus Edgar Markov with Captivating Vampire
Why don't politicians push for fossil fuel reduction by pointing out their scarcity?
Why does my air conditioner still run, even when it is cooler outside than in?
Google Maps API PlacesService suggestions showing out of bounds results
Is there a link to the “latest” jQuery library on Google APIs?Google Maps API v3: How to remove all markers?Google Map API v3 — set bounds and centerHow to disable mouse scroll wheel scaling with Google Maps APIGoogle Maps JS API v3 - Simple Multiple Marker ExampleGoogle Places API: Are “place_id” or “id” unique to any city in the world?Google Maps API Autocomplete search without selecting from dropdownGoogle Maps & JavaFX: Display marker on the map after clicking JavaFX buttonValues for “components” in google autocomplete API requestPlaceId for subpremise
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm currently using PlacesService
library from Google Maps API. I want to render suggestions for New York City. I added strict_bounds
for this matter but I still get results way out of New York as shown in the image.
For the most part it works, but I get many out of bounds suggestions.
/** @private ?this._google.maps.Map The google map object. */
this._map = new this._google.maps.Map(this._mapEl,
zoom: 11,
center: this._mapPosition
);
/** @private this._google.maps.places.AutocompleteAutocomplete instance */
this._service = new this._google.maps.places.AutocompleteService();
/** @private this._google.maps.places.PlaceServicePlaceService instance */
this._placeService = new this._google.maps.places.PlacesService(this._map);
Here is the instance in the constructor.
// Attach handler for the autocomplete search box. This updates the map
// position and re-sorts locations around that position.
this._searchEl.addEventListener('keyup', (event) =>
if(event.target.value)
this._service.getPlacePredictions(
input: event.target.value,
offset: 3,
strictBounds: true,
types: ['geocode'],
bounds: this._map.getBounds()
, (predictions) =>
if(predictions)
let results = predictions.map(e => [e['description']]);
event.target.missplete = new MissPlete(
input: event.target,
options: results,
className: 'c-autocomplete'
)
event.target.missplete.select = () =>
let msplt = event.target.missplete;
if (msplt.highlightedIndex !== -1)
msplt.input.value = msplt
.scoredOptions[msplt.highlightedIndex].displayValue;
msplt.removeDropdown();
console.dir('we did it');
;
event.target.predictions = predictions;
console.log(event.target.predictions);
);
);
There is a method displayPlacesOnMap
that gets an array of Google place objects. Here we get the place_id
in order to make use of PlaceService
library.
displayPlacesOnMap(mapItems)
if(mapItems)
mapItems.forEach(place =>
let request =
placeId: place.place_id,
fields: ['name', 'formatted_address', 'place_id', 'geometry']
const officeMap = this;
this._placeService.getDetails(request, function(place, status)
if (status === 'OK')
officeMap._mapPosition = place.geometry.location;
officeMap._map.panTo(officeMap._mapPosition);
officeMap.sortByDistance().clearLocations().updateUrl().updateList()
.updateUrl();
$(officeMap._searchEl).blur();
)
)
;
javascript google-maps google-places-api
add a comment |
I'm currently using PlacesService
library from Google Maps API. I want to render suggestions for New York City. I added strict_bounds
for this matter but I still get results way out of New York as shown in the image.
For the most part it works, but I get many out of bounds suggestions.
/** @private ?this._google.maps.Map The google map object. */
this._map = new this._google.maps.Map(this._mapEl,
zoom: 11,
center: this._mapPosition
);
/** @private this._google.maps.places.AutocompleteAutocomplete instance */
this._service = new this._google.maps.places.AutocompleteService();
/** @private this._google.maps.places.PlaceServicePlaceService instance */
this._placeService = new this._google.maps.places.PlacesService(this._map);
Here is the instance in the constructor.
// Attach handler for the autocomplete search box. This updates the map
// position and re-sorts locations around that position.
this._searchEl.addEventListener('keyup', (event) =>
if(event.target.value)
this._service.getPlacePredictions(
input: event.target.value,
offset: 3,
strictBounds: true,
types: ['geocode'],
bounds: this._map.getBounds()
, (predictions) =>
if(predictions)
let results = predictions.map(e => [e['description']]);
event.target.missplete = new MissPlete(
input: event.target,
options: results,
className: 'c-autocomplete'
)
event.target.missplete.select = () =>
let msplt = event.target.missplete;
if (msplt.highlightedIndex !== -1)
msplt.input.value = msplt
.scoredOptions[msplt.highlightedIndex].displayValue;
msplt.removeDropdown();
console.dir('we did it');
;
event.target.predictions = predictions;
console.log(event.target.predictions);
);
);
There is a method displayPlacesOnMap
that gets an array of Google place objects. Here we get the place_id
in order to make use of PlaceService
library.
displayPlacesOnMap(mapItems)
if(mapItems)
mapItems.forEach(place =>
let request =
placeId: place.place_id,
fields: ['name', 'formatted_address', 'place_id', 'geometry']
const officeMap = this;
this._placeService.getDetails(request, function(place, status)
if (status === 'OK')
officeMap._mapPosition = place.geometry.location;
officeMap._map.panTo(officeMap._mapPosition);
officeMap.sortByDistance().clearLocations().updateUrl().updateList()
.updateUrl();
$(officeMap._searchEl).blur();
)
)
;
javascript google-maps google-places-api
I don't see those results in this fiddle from Google's example. Please provide a minimal reproducible example that demonstrates your issue.
– geocodezip
Mar 27 at 15:33
It seems the fiddle usesAutocomplete
and in this project im usingAutocompleteService
. It also seems thatAutocompleteService
does not have astrictBounds
parameter.
– Steven Aguilar
Mar 27 at 15:40
Perhaps in that case you could provide a minimal reproducible example that demonstrates your issue.
– geocodezip
Mar 27 at 17:44
add a comment |
I'm currently using PlacesService
library from Google Maps API. I want to render suggestions for New York City. I added strict_bounds
for this matter but I still get results way out of New York as shown in the image.
For the most part it works, but I get many out of bounds suggestions.
/** @private ?this._google.maps.Map The google map object. */
this._map = new this._google.maps.Map(this._mapEl,
zoom: 11,
center: this._mapPosition
);
/** @private this._google.maps.places.AutocompleteAutocomplete instance */
this._service = new this._google.maps.places.AutocompleteService();
/** @private this._google.maps.places.PlaceServicePlaceService instance */
this._placeService = new this._google.maps.places.PlacesService(this._map);
Here is the instance in the constructor.
// Attach handler for the autocomplete search box. This updates the map
// position and re-sorts locations around that position.
this._searchEl.addEventListener('keyup', (event) =>
if(event.target.value)
this._service.getPlacePredictions(
input: event.target.value,
offset: 3,
strictBounds: true,
types: ['geocode'],
bounds: this._map.getBounds()
, (predictions) =>
if(predictions)
let results = predictions.map(e => [e['description']]);
event.target.missplete = new MissPlete(
input: event.target,
options: results,
className: 'c-autocomplete'
)
event.target.missplete.select = () =>
let msplt = event.target.missplete;
if (msplt.highlightedIndex !== -1)
msplt.input.value = msplt
.scoredOptions[msplt.highlightedIndex].displayValue;
msplt.removeDropdown();
console.dir('we did it');
;
event.target.predictions = predictions;
console.log(event.target.predictions);
);
);
There is a method displayPlacesOnMap
that gets an array of Google place objects. Here we get the place_id
in order to make use of PlaceService
library.
displayPlacesOnMap(mapItems)
if(mapItems)
mapItems.forEach(place =>
let request =
placeId: place.place_id,
fields: ['name', 'formatted_address', 'place_id', 'geometry']
const officeMap = this;
this._placeService.getDetails(request, function(place, status)
if (status === 'OK')
officeMap._mapPosition = place.geometry.location;
officeMap._map.panTo(officeMap._mapPosition);
officeMap.sortByDistance().clearLocations().updateUrl().updateList()
.updateUrl();
$(officeMap._searchEl).blur();
)
)
;
javascript google-maps google-places-api
I'm currently using PlacesService
library from Google Maps API. I want to render suggestions for New York City. I added strict_bounds
for this matter but I still get results way out of New York as shown in the image.
For the most part it works, but I get many out of bounds suggestions.
/** @private ?this._google.maps.Map The google map object. */
this._map = new this._google.maps.Map(this._mapEl,
zoom: 11,
center: this._mapPosition
);
/** @private this._google.maps.places.AutocompleteAutocomplete instance */
this._service = new this._google.maps.places.AutocompleteService();
/** @private this._google.maps.places.PlaceServicePlaceService instance */
this._placeService = new this._google.maps.places.PlacesService(this._map);
Here is the instance in the constructor.
// Attach handler for the autocomplete search box. This updates the map
// position and re-sorts locations around that position.
this._searchEl.addEventListener('keyup', (event) =>
if(event.target.value)
this._service.getPlacePredictions(
input: event.target.value,
offset: 3,
strictBounds: true,
types: ['geocode'],
bounds: this._map.getBounds()
, (predictions) =>
if(predictions)
let results = predictions.map(e => [e['description']]);
event.target.missplete = new MissPlete(
input: event.target,
options: results,
className: 'c-autocomplete'
)
event.target.missplete.select = () =>
let msplt = event.target.missplete;
if (msplt.highlightedIndex !== -1)
msplt.input.value = msplt
.scoredOptions[msplt.highlightedIndex].displayValue;
msplt.removeDropdown();
console.dir('we did it');
;
event.target.predictions = predictions;
console.log(event.target.predictions);
);
);
There is a method displayPlacesOnMap
that gets an array of Google place objects. Here we get the place_id
in order to make use of PlaceService
library.
displayPlacesOnMap(mapItems)
if(mapItems)
mapItems.forEach(place =>
let request =
placeId: place.place_id,
fields: ['name', 'formatted_address', 'place_id', 'geometry']
const officeMap = this;
this._placeService.getDetails(request, function(place, status)
if (status === 'OK')
officeMap._mapPosition = place.geometry.location;
officeMap._map.panTo(officeMap._mapPosition);
officeMap.sortByDistance().clearLocations().updateUrl().updateList()
.updateUrl();
$(officeMap._searchEl).blur();
)
)
;
javascript google-maps google-places-api
javascript google-maps google-places-api
edited Mar 27 at 14:58
Steven Aguilar
asked Mar 27 at 14:52
Steven AguilarSteven Aguilar
6877 silver badges32 bronze badges
6877 silver badges32 bronze badges
I don't see those results in this fiddle from Google's example. Please provide a minimal reproducible example that demonstrates your issue.
– geocodezip
Mar 27 at 15:33
It seems the fiddle usesAutocomplete
and in this project im usingAutocompleteService
. It also seems thatAutocompleteService
does not have astrictBounds
parameter.
– Steven Aguilar
Mar 27 at 15:40
Perhaps in that case you could provide a minimal reproducible example that demonstrates your issue.
– geocodezip
Mar 27 at 17:44
add a comment |
I don't see those results in this fiddle from Google's example. Please provide a minimal reproducible example that demonstrates your issue.
– geocodezip
Mar 27 at 15:33
It seems the fiddle usesAutocomplete
and in this project im usingAutocompleteService
. It also seems thatAutocompleteService
does not have astrictBounds
parameter.
– Steven Aguilar
Mar 27 at 15:40
Perhaps in that case you could provide a minimal reproducible example that demonstrates your issue.
– geocodezip
Mar 27 at 17:44
I don't see those results in this fiddle from Google's example. Please provide a minimal reproducible example that demonstrates your issue.
– geocodezip
Mar 27 at 15:33
I don't see those results in this fiddle from Google's example. Please provide a minimal reproducible example that demonstrates your issue.
– geocodezip
Mar 27 at 15:33
It seems the fiddle uses
Autocomplete
and in this project im using AutocompleteService
. It also seems that AutocompleteService
does not have a strictBounds
parameter.– Steven Aguilar
Mar 27 at 15:40
It seems the fiddle uses
Autocomplete
and in this project im using AutocompleteService
. It also seems that AutocompleteService
does not have a strictBounds
parameter.– Steven Aguilar
Mar 27 at 15:40
Perhaps in that case you could provide a minimal reproducible example that demonstrates your issue.
– geocodezip
Mar 27 at 17:44
Perhaps in that case you could provide a minimal reproducible example that demonstrates your issue.
– geocodezip
Mar 27 at 17:44
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55380201%2fgoogle-maps-api-placesservice-suggestions-showing-out-of-bounds-results%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55380201%2fgoogle-maps-api-placesservice-suggestions-showing-out-of-bounds-results%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I don't see those results in this fiddle from Google's example. Please provide a minimal reproducible example that demonstrates your issue.
– geocodezip
Mar 27 at 15:33
It seems the fiddle uses
Autocomplete
and in this project im usingAutocompleteService
. It also seems thatAutocompleteService
does not have astrictBounds
parameter.– Steven Aguilar
Mar 27 at 15:40
Perhaps in that case you could provide a minimal reproducible example that demonstrates your issue.
– geocodezip
Mar 27 at 17:44