2016-04-02 11 views
0

Bir Google harita URL'sini iframe'e gömmek, böylece html'ye gösterebilmem için dönüştürmek istiyorum.Google Maps url iFrame'e Dönüştürme

<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d13007260.396144057!2d-104.66829755128677!3d37.257180679921!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x54eab584e432360b%3A0x1c3bb99243deb742!2sUnited+States!5e0!3m2!1sen!2s!4v1459600802389" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe> 

Benim Sorgu nasıl:

https://www.google.com/maps/place/United+States/@37.2571807,-104.6682976,5z/data=!3m1!4b1!4m2!3m1!1s0x54eab584e432360b:0x1c3bb99243deb742?hl=en

bu url gidin ve "Paylaş" Google size böyle iframe'de harita yerleştirin url verir: Örneğin bu url almak url "https://www.google.com/maps/place/United+States/@37.2571807,-104.6682976,5z/data=!3m1!4b1!4m2!3m1!1s0x54eab584e432360b:0x1c3bb99243deb742?hl=en" ayrıştırmak ve iframe birine dönüştürmek için?

cevap

0

bu numaralı URL'yi bu iframe paylaşımını almak için yapamazsınız. Eğer ikisini karşılaştırırsanız, veriler FARKLI'dır. @(-?\d*[.]?\d*,-?\d*[.]?\d*),(\d)z:

Try the API.

Daha sonra bu normal ifadeler kullanabilirsiniz.

URL, $1 ve $2 regex'ten gelen https://www.google.com/maps/embed/v1/view ?key=YOUR_API_KEY &center=$1 &zoom=$2 &maptype=satellite olacaktır.