Reputation: 441
The embed urls produced by the new version of google maps look like this:
How can I construct such a url programmatically given an address or latitude and longitude?
Upvotes: 21
Views: 21705
Reputation: 13
As suggested by kjdion84, the following works perfectly:
<iframe src="http://maps.google.com/maps?q='.$geolat.','.$geolng.'&t=k&z=16&output=embed" width="100%" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>
Upvotes: 0
Reputation: 10064
<iframe src="http://maps.google.com/maps?q=pizza+pizza+oshawa&z=10&output=embed" width="100%" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>
The magic here is &output=embed
.
This is an example using 2 parameters. Replace pizza+pizza+oshawa
with an url-encoded address and 10
with zoom level you want.
Upvotes: 1
Reputation: 21
I wonder if this is the new version or not: https://developers.google.com/maps/documentation/embed/guide
Address: Add a value following "q=" parameter (The Google Maps Embed API supports both + and %20 when escaping spaces.)
Latitude and longitude: "center=" parameter is for latitude and longitude, but you would also want to set "zoom=" level in order to present in the way how you want it to be displayed to users
Upvotes: 2