|
|
| daily menu » rate the banner | guess the city | one on one |
|
|
|
|
#1 |
|
BANNED
Join Date: Sep 2010
Location: Fortaleza, Brazil
Posts: 1,144
Likes (Received): 0
|
Embed Google Maps
Why not have a tag [googlemaps] [/googlemaps] to easily embed the interactive maps from Google Maps?
It should not be so difficult to create something like this... |
|
|
|
|
|
#2 |
|
BANNED
Join Date: Sep 2010
Location: Fortaleza, Brazil
Posts: 1,144
Likes (Received): 0
|
Here is a simple PHP code that can do the job.
The user inserts the direct link from Google Maps (the direct link, not the link for embedding), between the tags [googlemaps] and [/googlemaps]. The code bellow takes the direct link inserted between the tags, and extract the coordinates and zoom level from it, to use them in the prefabricated code for iframe embedding. PHP Code:
The code is free, you can use it if you want. Regards. Last edited by .for.ce.br; October 26th, 2010 at 03:38 PM. |
|
|
|
|
|
#3 |
|
Lurker
Join Date: Sep 2002
Location: Melbourne
Posts: 3,392
Likes (Received): 13
|
iframes would be a security risk and the correct way to embed maps is to register for the Google Maps API and use that, but the work required to do something like that would be more complex.
(note: this is my personal opinion and does not represent the viewpoint of site admins)
__________________
Opinions are like arseholes, everyone has one and everyone thinks that theirs is the only one that doesn't stink. |
|
|
|
|
|
#4 |
|
BANNED
Join Date: Sep 2010
Location: Fortaleza, Brazil
Posts: 1,144
Likes (Received): 0
|
I think iframes would not be a security risk if the "src" property is rigidly controlled. The PHP script gets the direct link, extracts the coordinates and zoom level from it, and insert them in the "src" property of the iframe. The user will not be allowed to determine what the src will be.
Using the Google Maps API would require in first place register to get an ID with Google. It also can be done, but is a little bit more complicated. In return, the API uses a DIV, not an IFRAME... |
|
|
|
|
|
#5 |
|
BANNED
Join Date: Sep 2010
Location: Fortaleza, Brazil
Posts: 1,144
Likes (Received): 0
|
Anyway, if the Google Maps API is used, the code I posted above can be used to obtain the $coordinates and $zoomlevel from the direct link between the tags, and then the variables are inserted into the API's function "map.setCenter".
PHP Code:
|
|
|
|
|
|
#6 |
|
BANNED
Join Date: Nov 2010
Posts: 1
Likes (Received): 0
|
I'm here just to clarify that, since I was unfairly banned from Skyscrapercity, I no longer will be offering this PHP code for free to this website. I withdraw the offer of the above PHP code. Skyscrapercity can not use the code created by me any time in the future.
I no longer have any interest about this website packed with arrogant, autoritarian and foolish moderators. Goodbye. |
|
|
|
|
|
#7 |
|
Lebensraum
Join Date: Apr 2008
Location: Praetoria | Centvrion
Posts: 8,118
Likes (Received): 336
|
I'm still gonna use your code though
__________________
The boys, the girls they all like Carmen She laughs like god, her mind's like a diamond |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|