How to get all places (or specific type of place such as a restaurant) in a city or country with Google Places API?
Date : March 29 2020, 07:55 AM
help you fix your problem Unfortunately you can't get more than 60 results from the Google Places API; at least not without breaking the terms of service:
|
Google Places componentrestrictions Country for iOS
Date : March 29 2020, 07:55 AM
This might help you Do you have the latest version (1.11.0) of the Google Places API for iOS? This was added in that release (see the release notes). With 1.11.0 this is done by setting the country property on GMSAutocompleteFilter.
|
Get country code from PlaceAutocompleteFragment android (Google Places API)
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further With the Place object retrieved, you can get the Locale object associated : Locale locale = place.getLocale();
locale.getCountry();
locale.getDisplayCountry();
LatLng coordinates = place.getLatLng(); // Get the coordinates from your place
Geocoder geocoder = new Geocoder(this, Locale.getDefault());
List<Address> addresses = geocoder.getFromLocation(
coordinates.latitude,
coordinates.longitude,
1); // Only retrieve 1 address
Address address = addresses.get(0);
address.getCountryCode();
address.getCountryName();
|
retrieve points of interests (attractions/tourist places) of a place/country using google places api
Tag : json , By : Schmidt
Date : March 29 2020, 07:55 AM
hope this fix your issue Try this google places API url. You will get the point of interest/Attraction/Tourists places in (For Eg:) New York City. You have to use the CITY NAME with the keyword Point Of Interest https://maps.googleapis.com/maps/api/place/textsearch/json?query=new+york+city+point+of+interest&language=en&key=API_KEY
|
Google Maps places API - How to get Country, Postal-code, Number, Website URL with Google map search box on multiple res
Date : March 29 2020, 07:55 AM
This might help you Google Maps places gives you a reference, and an ID. You can use that id to request extra details. I added this to your code: // make sure this variable is accesible where you need it (scope)
var service = new google.maps.places.PlacesService(map);
// request details
service.getDetails(place, function(result, status) {
if (status !== google.maps.places.PlacesServiceStatus.OK) {
console.error(status);
return;
}
$('#website').html('<a target="_blank" href="'+ result.website +'">'+ result.website +'</a>');
});
places.forEach(function (place) {
...
<span id="website"></span>
...
}
<script>
// This example adds a search box to a map, using the Google Place Autocomplete
// feature. People can enter geographical searches. The search box will return a
// pick list containing a mix of places and predicted search terms.
function initAutocomplete() {
var map = new google.maps.Map(document.getElementById('map'), {
center: {
lat: -33.8688,
lng: 151.2195
},
zoom: 13,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
// Create the search box and link it to the UI element.
var input = document.getElementById('searchInput');
var searchBox = new google.maps.places.SearchBox(input);
map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
// Bias the SearchBox results towards current map's viewport.
map.addListener('bounds_changed', function () {
searchBox.setBounds(map.getBounds());
});
var markers = [];
// srvice for PLACE details
var service = new google.maps.places.PlacesService(map);
// [START region_getplaces]
// Listen for the event fired when the user selects a prediction and retrieve
// more details for that place.
searchBox.addListener('places_changed', function () {
$('#mapContent').html("");
var places = searchBox.getPlaces();
if (places.length == 0) {
return;
}
// Clear out the old markers.
markers.forEach(function (marker) {
marker.setMap(null);
});
markers = [];
// For each place, get the icon, name and location.
var bounds = new google.maps.LatLngBounds();
places.forEach(function (place) {
var icon = {
url: place.icon,
size: new google.maps.Size(71, 71),
origin: new google.maps.Point(0, 0),
anchor: new google.maps.Point(17, 34),
scaledSize: new google.maps.Size(25, 25)
};
// Create a marker for each place.
var marker = new google.maps.Marker({
map: map,
icon: icon,
title: place.name,
position: place.geometry.location
});
google.maps.event.addListener(marker, 'click', function (evt) {
//document.getElementById('coordinates').value = marker.getPosition().toUrlValue(6);
alert(this.placeId)
});
markers.push(marker);
if (place.geometry.viewport) {
// Only geocodes have viewport.
bounds.union(place.geometry.viewport);
} else {
bounds.extend(place.geometry.location);
}
$('#mapContent').append('<ul id="geoData">' +
'<li>Full Address: <span id="location">'+ place.formatted_address +'</span></li>'+
'<li>Postal Code: <span id="postal_code"></span></li>'+
'<li>Country: <span id="country">'+ +'</span></li>'+
'<li>Latitude: <span id="lat">'+ place.geometry.location.lat() +'</span></li>'+
'<li>Longitude: <span id="lon">'+ place.geometry.location.lng() +'</span></li>'+
'<li>Website: <span id="website"></span></li>'+
'<li>Contact Number: <span id="number"></span></li>'+
'<li>Rating: <span id="rating"></span></li>'+
'</ul>');
// request details
service.getDetails(place, function(result, status) {
if (status !== google.maps.places.PlacesServiceStatus.OK) {
console.error(status);
return;
}
$('#website').html('<a target="_blank" href="'+ result.website +'">'+ result.website +'</a>');
});
});
map.fitBounds(bounds);
});
// [END region_getplaces]
}
</script>
|