embedding gmap4

Use this forum to ask questions about how to use this website, or to make any general comments about how it works
Post Reply
User avatar
geographics
Posts: 963
Joined: August 5th, 2010, 2:11 pm

embedding gmap4

Post by geographics » October 12th, 2011, 12:36 pm

.
Last edited by geographics on February 23rd, 2012, 11:11 pm, edited 1 time in total.

Joseph Elfelt
Posts: 157
Joined: September 3rd, 2010, 10:24 am
Contact:

Re: embedding gmap4

Post by Joseph Elfelt » October 13th, 2011, 7:30 am

Great suggestion. :D

But keep in mind that a Gmap4 map is 'live' and therefore does things in response to most kinds of clicks. For example, a double click will center the map at that spot.

If ph.org does allow Gmap4 to run in an iframe, then anyone viewing that embedded map can always get a URL that (when pasted into a browser bar) will open the map full screen. Simply click Menu ==> Show Map URL. Copy that URL and paste it into a browser bar.

Here's an example of a Gmap4 map embedded in a forum post. Unfortunately, the MyTopo tile server is down this morning and so the map is blank. Just click MyTopo and select a different map view.

http://www.whitneyzone.com/wz/ubbthread ... ip_15_mile

User avatar
Martell
Posts: 2045
Joined: May 28th, 2008, 10:03 pm
Location: SW Portland

Re: embedding gmap4

Post by Martell » October 29th, 2011, 10:49 pm

OK To do this the code is

Code: Select all

[gmap]http://sites.google.com/site/gmap4files/p/helpfile/Johnson_Ridge.gpx[/gmap]
Just change the URL to the URL of your Gmap. It will look like this:

[gmap]http://sites.google.com/site/gmap4files ... e.gpx&t=t2[/gmap]
-Dan
Site Tech Helper

Joseph Elfelt
Posts: 157
Joined: September 3rd, 2010, 10:24 am
Contact:

Re: embedding gmap4

Post by Joseph Elfelt » October 30th, 2011, 5:05 am

Looks nice Dan. Thanks.

I tried adding the URL parameter &t=h to display the Google aerial but instead I still got the topo map in the preview pane.
[gmap]http://sites.google.com/site/gmap4files/p/helpfile/Johnson_Ridge.gpx&t=h[/gmap]

Gmap4 understands various URL parameters. In addition to the URL for a data file, is your code intended to also pass through any other URL parameters which the user has specified?

Also, consider the following URL. Note that the q parameter is empty. This URL starts Gmap4 and displays a symbol at Timberline Lodge. Think about threads where the topic is a certain spot. Often times much confusion can be eliminated if someone posts a map showing that spot. Is it possible for your code to accomodate maps of this sort?

http://www.mappingsupport.com/p/gmap4.php?q=&ll=45.331423,-121.711522&z=15&t=t2&symbol=pg

User avatar
geographics
Posts: 963
Joined: August 5th, 2010, 2:11 pm

Re: embedding gmap4

Post by geographics » October 31st, 2011, 2:37 pm

.
Last edited by geographics on February 23rd, 2012, 11:44 pm, edited 1 time in total.

Joseph Elfelt
Posts: 157
Joined: September 3rd, 2010, 10:24 am
Contact:

Re: embedding gmap4

Post by Joseph Elfelt » October 31st, 2011, 3:11 pm

The file name for the production code is always: gmap4.php
This URL should be written:

http://www.mappingsupport.com/p/gmap4.php?ll=48.008,-88.872&t=t2&z=11

User avatar
geographics
Posts: 963
Joined: August 5th, 2010, 2:11 pm

Re: embedding gmap4

Post by geographics » October 31st, 2011, 3:18 pm

.
Last edited by geographics on February 23rd, 2012, 11:40 pm, edited 1 time in total.

User avatar
geographics
Posts: 963
Joined: August 5th, 2010, 2:11 pm

Re: embedding gmap4

Post by geographics » October 31st, 2011, 3:20 pm

.
Last edited by geographics on February 23rd, 2012, 11:40 pm, edited 1 time in total.

User avatar
Martell
Posts: 2045
Joined: May 28th, 2008, 10:03 pm
Location: SW Portland

Re: embedding gmap4

Post by Martell » October 31st, 2011, 7:43 pm

I changed it to gmap4 now instead of gmap.

It will accept a query string. Before I was just overriding the "t" field, but I think it was accepting other fields. I took away the default "t" setting.

I guess I kind of misunderstood what the original poster wanted to do. Maybe the specific one I set it up for isn't very useful?

The "http://www.mappingsupport.com/p/gmap4.p ... &symbol=pg" example is kind of tricky.

It would be a security risk to allow people to put a full URL in the iframe (like starting with http://www.mappingsuport.com), and PHPBB doesn't really have a setting for just the query string (the more specific ones don't allow ampersands or = signs I don't believe, the URL one has to start with http://). I could do it as straight text, but again it's an XSS security risk, albeit a rather obscure one that probably wouldn't get exploited.

I could set up one that would take just the latitude and longitude separated by a comma, but I'm not sure if that is advanced enough to do what you want. Like this:

Code: Select all

[latlon]45.331423,-121.711522[/latlon]
To do this:


What do you think? Could you give me a good set of default options and we could run with that, or is not powerful enough?
-Dan
Site Tech Helper

Joseph Elfelt
Posts: 157
Joined: September 3rd, 2010, 10:24 am
Contact:

Re: embedding gmap4

Post by Joseph Elfelt » October 31st, 2011, 7:51 pm

Dan,

I think some other sites are editing the iframe entry against a white list of domain names. Only domain names on the white list are allowed to use iframes. Is that approach possible and would it satisfy your XSS concerns?

Gmap4 itself is hardened against XSS and the next update will screw things down even tighter.

Post Reply