I'm on a Symfony Project where I have to assign an address to a user. Then I have to show their position on a map.
I use Ivory Google Maps Bundle. Markers work with coordonates.
So the I think the best way to do it is to use Google Places and get
the coordonates.
And then assign it to the markers.
The problem is: How to get coordinates from Google Places API and store them with doctrine?
Your bundle can query The Google Maps Geocoding API which gives you informations about a place with cordinates.
// Requests the ivory google map geocoder service
$geocoder = $this->get('ivory_google_map.geocoder');
// Geocode an address
$response = $geocoder->geocode('YOUR_ADDRESS_HERE');
// Get the result corresponding to your address
foreach($response->getResults() as $result) {
var_dump($result->getGeometry()->getLocation());
}
Here's the full doc !
Related
I need road name in marker infowindow while displaying route in google maps.
I found the following options,
1. Geocoder service in Google Maps Javascript API - which will give address for the given GPS coordinate.
2. Google Maps Roads API - which will return placeIds of the path and again I need to fire another request to get the address of placeId
What will be optimal solution to retrieve the road name for a given route (array of gps coordinates)?
The Geocoding API is the appropriate API to use for converting lat/lng coordinates into textual addresses and vice-versa. It's what it's meant to be used for.
The following is an example of a reverse geocoding request:
https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&key=YOUR_API_KEY
Hope this helps!
google map pricing is highly complex. Can someone tell whether the follow will be considered as three map accesses counted for charging. I am using Javascript APIs and render maps on a mobile web app.
showing a map in the client
Geocode an address
Add a marker on the map for the given location
Reference: https://developers.google.com/maps/billing/understanding-cost-of-use
showing a map in the client using the Google Maps Javascript API v3 is a "Dynamic Maps" load (requires loading the API)
Geocode an address is a "Geocoding" access
Add a marker on the map for the given location doesn't use any additional quota
I have to implement a restaurant location service by using the google places api like this:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=43.7666321,11.2546258&rankby=distance&type=restaurant&key=[API_KEY]
but the result are very different from the near by search using google maps:
https://www.google.it/maps/search/Ristoranti/#43.7666321,11.2546258,15z/data=!4m8!2m7!3m6!1sRistoranti!2sPlaza+Hotel+Lucchesi,+Lungarno+della+Zecca+Vecchia,+38,+50122+Firenze!3s0x132a53f8014b2cd1:0xe324c61f3f21ebce!4m2!1d11.2633806!2d43.7666092?hl=it
I've also tried the Radar Search Request but it doesn't work either.
You can use google map PlacesService.
service = new google.maps.places.PlacesService(map);
service.nearbySearch(request, callback);
For more details on parameter and how to use it,
Check: https://developers.google.com/maps/documentation/javascript/places
I am using google maps version 3 API.
I am using a google map with marker; this marker can be moved freely as the user wishes; however, i want it to generate alert when the user places it on a place not a valid car reachable, which we can drive to.
how can i query for such information from google maps API?
Thanks
I have country and address. How can I retrieve latitude and longitude from Google Maps V3?
I will use this to load the map.
EDIT
This is my actual code, but seems that Google API return this error : W[B].bindTo=function(a,b,c,d){var c=c|...R[p](this,wf,a);this.Pb&&this.Pb(a)};
SOLUTION
remove center: location,
You can retreive this with Geocoding Requests.
You can see my last project that I used this here. See function AddMarker in gmaps3.js for a working real world example. Basically I fetch addresses from database (using AJAX) and then convert them to lat/lon to make markers on the map.
You can use their ReST-API.
http://maps.google.com/maps/api/geocode/json?address=Berlin+Germany&sensor=false
The documentation is in The Google Geocoding API. You will have to do a http request e.g. $.get in jQuery to perform the query and then parse the JSON. Other output formats include XML. There's a JavaScript geocoder on their site as well.
You need to access geocoding.
http://code.google.com/apis/maps/documentation/javascript/services.html#Geocoding
http://code.google.com/apis/maps/documentation/geocoding/index.html