I was wondering if it is possible to limit the Google Places API to search only for 'x' near 'landmark' where landmark is limited to landmarks only.
For example:
Not desired: coffee shop near Walmart
Desired: coffee shop near Eiffel Tower
Using javascript API.
Cheers in advance.
As found at https://developers.google.com/maps/documentation/javascript/places#place_search_requests
A Places Nearby search is initiated with a call to the PlacesService's nearbySearch() method, which will return an array of PlaceResult objects.
service = new google.maps.places.PlacesService(map); service.nearbySearch(request, callback);
You must also pass a callback method to nearbySearch(), to handle the results object and google.maps.places.PlacesServiceStatus response.
var map; var service; var infowindow; function initialize() { var pyrmont = new google.maps.LatLng(-33.8665433,151.1956316); map = new google.maps.Map(document.getElementById('map'), { center: pyrmont, zoom: 15 }); var request = { location: pyrmont, radius: '500', types: ['store'] }; service = new google.maps.places.PlacesService(map); service.nearbySearch(request, callback); } function callback(results, status) { if (status == google.maps.places.PlacesServiceStatus.OK) { for (var i = 0; i < results.length; i++) { var place = results[i]; createMarker(results[i]); } } }
You'd change the LatLng of pyrmont
to change the location, in your case, The Eiffeltower. You could also change all occurrences of pyrmont
to your own variable. shop
could also be changed.
How can I get native javascript AJAX to return response in JSON rather than 'text over HTML'? Description: In jquery, the following AJAX function returns JSON data, which is what we needed. JQUERY ...
How can I get native javascript AJAX to return response in JSON rather than 'text over HTML'? Description: In jquery, the following AJAX function returns JSON data, which is what we needed. JQUERY ...
I'm trying to find a simple, elegant way to create a "delete" button for a user's comments on a site I'm working on. Ideally, I'd like to register an event handler for a class called something like "...
I'm trying to find a simple, elegant way to create a "delete" button for a user's comments on a site I'm working on. Ideally, I'd like to register an event handler for a class called something like "...
I have created two functions that run a similar set of IF statements, one shows the cost of a game, the other its name. I have used "onclick" to display both values in my form. It all works but ...
I have created two functions that run a similar set of IF statements, one shows the cost of a game, the other its name. I have used "onclick" to display both values in my form. It all works but ...
I'm new to Mocha and I'm trying to run the tests on this code: "use strict"; process.env.NODE_ENV = 'test'; var assert = require('assert'), Browser = require('zombie'), xapp = require('../...
I'm new to Mocha and I'm trying to run the tests on this code: "use strict"; process.env.NODE_ENV = 'test'; var assert = require('assert'), Browser = require('zombie'), xapp = require('../...