individual8
individual8

Reputation: 441

Embed params in new Google Maps

The embed urls produced by the new version of google maps look like this:

https://www.google.com/maps/embed?pb=!1m5!3m3!1m2!1s0x47b161837e1813b9%3A0x4263df27bd63aa0!2sHamburg%2C+Germany!5e0!3m2!1sen!2s!4v1385644179838

How can I construct such a url programmatically given an address or latitude and longitude?

Upvotes: 21

Views: 21705

Answers (3)

Ahmed Fayaz
Ahmed Fayaz

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

kjdion84
kjdion84

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

Junho Ryu
Junho Ryu

Reputation: 21

I wonder if this is the new version or not: https://developers.google.com/maps/documentation/embed/guide

  1. Address: Add a value following "q=" parameter (The Google Maps Embed API supports both + and %20 when escaping spaces.)

  2. 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

Related Questions