New plugin "GPX Viewer": Displays GPS tracks on map

Find help with FlatPress plugins, report a plugin bug, request or present new plugins.
User avatar
Arvid
FlatPress Coder
Posts: 250
Joined: Sat Jan 26, 2019 7:40 pm
Contact:

New plugin "GPX Viewer": Displays GPS tracks on map

Post by Arvid » Sun Nov 01, 2020 11:32 am

Hi,

I'm happy to introduce to you my latest FlatPress plugin: GPX Viewer!

It makes use of Jürgen Berkemeier's free JavaScript library GPX Viewer to display uploaded GPS-recorded tracks and routes (GPX format) on a OpenStreetMap map with a corresponding height profile.
It adds a BBCode tag “gpx” to include your uploaded GPX file into your blog entry or static page. It's really just as simple as that:

Code: Select all

[gpx="attachs/file.gpx"]
See the plugin in action on my personal bike touring blog: https://fahrrad.arvidzimmermann.de/2020 ... -mrkische/

Download and documentation on the wiki

Please let me know if you encounter any bugs or glitches.

All the best,
Arvid

dsteuer
Posts: 32
Joined: Sun May 24, 2020 11:21 am

Re: New plugin "GPX Viewer": Displays GPS tracks on map

Post by dsteuer » Sun Nov 01, 2020 2:14 pm

Congratulation! Cool plugin!

Detlef

miksmith
Posts: 19
Joined: Wed Jul 31, 2019 4:32 pm

Re: New plugin "GPX Viewer": Displays GPS tracks on map

Post by miksmith » Mon Nov 02, 2020 9:22 am

Brilliant job! This is great to have :D

Ive uploaded a test tracklog and the track seems to be offset. Having tried this on a couple of route planning sites, they seem to be correct. Is this ia bug in the underlying library?

cheers

mike

dsteuer
Posts: 32
Joined: Sun May 24, 2020 11:21 am

Re: New plugin "GPX Viewer": Displays GPS tracks on map

Post by dsteuer » Mon Nov 02, 2020 10:11 am

miksmith wrote: Mon Nov 02, 2020 9:22 am Brilliant job! This is great to have :D

Ive uploaded a test tracklog and the track seems to be offset. Having tried this on a couple of route planning sites, they seem to be correct. Is this ia bug in the underlying library?

cheers

mike
You could try it out here: https://www.j-berkemeier.de/ShowGPX.html That's the main page of the lib devel.

Detlef

miksmith
Posts: 19
Joined: Wed Jul 31, 2019 4:32 pm

Re: New plugin "GPX Viewer": Displays GPS tracks on map

Post by miksmith » Mon Nov 02, 2020 11:22 am

Ah, good idea! Yes, that works fine. Does that mean its likely a problem with the plugin?

User avatar
Arvid
FlatPress Coder
Posts: 250
Joined: Sat Jan 26, 2019 7:40 pm
Contact:

Re: New plugin "GPX Viewer": Displays GPS tracks on map

Post by Arvid » Wed Nov 11, 2020 11:23 am

Hi,

thanks for reporting. The FlatPress template around may set a margin to images which causes the offset.
Please add the follwoing to your fp-plugins/gpx/res/gpxplugin.css:

Code: Select all

div.leaflet-pane img {
	/* image margins given by the FP template have to be reset in order to avoid track offset */
	margin: 0px !important;
}
This should remove the offset, does it?

I will add this to the plugin package.

All the best,
Arvid

miksmith
Posts: 19
Joined: Wed Jul 31, 2019 4:32 pm

Re: New plugin "GPX Viewer": Displays GPS tracks on map

Post by miksmith » Wed Nov 11, 2020 2:14 pm

Yes, that fix works :D

miksmith
Posts: 19
Joined: Wed Jul 31, 2019 4:32 pm

Re: New plugin "GPX Viewer": Displays GPS tracks on map

Post by miksmith » Fri Nov 13, 2020 5:31 pm

Is there a way to change the default basemap?

User avatar
Arvid
FlatPress Coder
Posts: 250
Joined: Sat Jan 26, 2019 7:40 pm
Contact:

Re: New plugin "GPX Viewer": Displays GPS tracks on map

Post by Arvid » Sun Dec 27, 2020 11:25 am

In fact, there is.
The map DIV has the CSS class "gpxview:PATH_TO_GPX_FILE". Just append the type of map with a ":" to this.

For example, change line 50 of gpxplugin.class.php from
$mapDiv = '<div id="' . $divId . '" class="gpxmap gpxview:' . $filePathRel . '"><noscript><p>' . $noJsError . '</p></noscript></div>';
to
$mapDiv = '<div id="' . $divId . '" class="gpxmap gpxview:' . $filePathRel . ':OPENTOPO"><noscript><p>' . $noJsError . '</p></noscript></div>';

to set the default map to OpenTopo.

For the different map names, see the GPX Viewer documentation (English translation by Google).

All the best,
Arvid

miksmith
Posts: 19
Joined: Wed Jul 31, 2019 4:32 pm

Re: New plugin "GPX Viewer": Displays GPS tracks on map

Post by miksmith » Sun Dec 27, 2020 4:34 pm

Brilliant! The OpenTopo was the one I wanted and looks really good. THanks!!!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest