diff --git a/WP-GPX-Maps.js b/WP-GPX-Maps.js index e97bd02..50edaef 100644 --- a/WP-GPX-Maps.js +++ b/WP-GPX-Maps.js @@ -46,7 +46,7 @@ function wpgpxmaps(targhetId,mapType,mapData,graphData) if (marker) { var point = getItemFromArray(mapData,r) - marker.setPosition(new google.maps.LatLng(point[0],point[1])); + marker.setPosition(new google.maps.LatLng(point[0],point[1])); marker.setTitle("Current Position"); } }); google.visualization.events.addListener(chart, 'onmouseout', function (e) { @@ -56,13 +56,12 @@ function wpgpxmaps(targhetId,mapType,mapData,graphData) { var r = chart.getSelection()[0]['row']; var point = getItemFromArray(mapData,r) - marker.setPosition(new google.maps.LatLng(point[0], point[1])); + marker.setPosition(new google.maps.LatLng(point[0], point[1])); marker.setTitle("Graph Selection"); } } }); - } - if (mapData != '') - { + } else { el_chart.style.display='none'; } + if (mapData != '') { var points = []; var bounds = new google.maps.LatLngBounds(); for(var i in mapData) @@ -83,10 +82,10 @@ function wpgpxmaps(targhetId,mapType,mapData,graphData) var first = getItemFromArray(mapData,0) var marker = new google.maps.Marker({ position: new google.maps.LatLng(first[0], first[1]), - title:"Hello World!" + title:"Start" }); marker.setMap(map); - } + } } function getItemFromArray(arr,index) { diff --git a/readme.txt b/readme.txt index ea05a48..ba02df2 100644 --- a/readme.txt +++ b/readme.txt @@ -4,35 +4,60 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=basti Tags: maps, gpx, gps, graph, google maps, google chart Requires at least: 2.0.0 Tested up to: 3.3 -Stable tag: 1.0.3 +Stable tag: 1.0.4 License: GPLv2 or later Draws a gpx track with altitude graph == Description == -This plugin has, as input, the GPX file with the track you've made. As output it shows the map of the track, fixed with an altitude graph. +This plugin has, as input, the GPX file with the track you've made. As output it shows the map of the track, fixed with an altitude graph (where aviable). + - iphone/ipad/ipod Compatible + Try this plugin on http://www.pedemontanadelgrappa.it/category/mappe/ + Thanks to: www.securcube.net, www.darwinner.it, www.pedemontanadelgrappa.it, -Bugs, problems, thanks and anything else here! + + +Bugs, problems, thanks and anything else here! + +Supported gpx namespace are: + +1. http://www.topografix.com/GPX/1/0 + +1. http://www.topografix.com/GPX/1/1 + +1. http://www.garmin.com/xmlschemas/GpxExtensions/v3 == Installation == + 1. Use the classic wordpress plugin installer or copy the plugins folder to the `/wp-content/plugins/` directory + 1. Activate the plugin through the 'Plugins' menu in WordPress + 1. Add the shortcode [sgpx gpx=">relative path to your gpx<"] == Frequently Asked Questions == + = what are all available shortcode attributes? = + The attributes are: + 1. gpx: relative path to gpx + 1. width: width in pixels + 1. mheight: map height + 1. gheight: graph height + 1. mtype: map aviable types are: HYBRID, ROADMAP, SATELLITE, TERRAIN + shortcode with all the attributes : [sgpx gpx=">relative path to your gpx<" width=100% mheight=300px gheight=200px mtype=SATELLITE] = What happening if I've a very large gpx? = This plugin will print a small amout of points to to speedup javascript and pageload. + = Is it free? = Yes! @@ -41,6 +66,9 @@ Yes! 2. Screenshot Admin area == Changelog == += 1.0.4 = +* Fixed Upload file error +* Added support for Garmin gpx (http://www.garmin.com/xmlschemas/GpxExtensions/v3 namespace) = 1.0.3 = * Added Settings link on plugins list * Added attributes width, mheight, gheight, mtype on shortcode. @@ -52,6 +80,7 @@ Yes! * Initial release. == Upgrade Notice == += 1.0.4 = = 1.0.3 = = 1.0.2 = = 1.0.1 = diff --git a/wp-gpx-maps.php b/wp-gpx-maps.php index 39da042..f207a6d 100644 --- a/wp-gpx-maps.php +++ b/wp-gpx-maps.php @@ -3,7 +3,7 @@ Plugin Name: WP-GPX-Maps Plugin URI: http://www.darwinner.it/ Description: Draws a gpx track with altitude graph -Version: 1.0.3 +Version: 1.0.4 Author: Bastianon Massimo Author URI: http://www.pedemontanadelgrappa.it/ License: GPL @@ -90,13 +90,11 @@ function handle_WP_GPX_Maps_Shortcodes($attr, $content='') foreach ($points as $p) { $points_maps .= "[".(float)$p[0].",".(float)$p[1]."],"; $points_graph .= "[".(float)$p[3].",".(float)$p[2]."],"; - } + } //all the points are [0,0] $points_graph = preg_replace("/^(\[0,0\],)+$/", "", $points_graph); $p="/,$/"; $points_maps = preg_replace($p, "", $points_maps); - $points_graph = preg_replace($p, "", $points_graph); - - echo - ' + $points_graph = preg_replace($p, "", $points_graph); if (preg_match("/^(\[0,0\],?)+$/", $points_graph)) { $points_graph = ""; } + echo '