• ResolvedPlugin Contributor hupe13

    (@hupe13)


    I have a gpx file with one track and some pois (markers). Is it possible to hide the pois and show only the track?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author bozdoz

    (@bozdoz)

    It’s probably not easy; you might be able to iterate the gpx features and delete them with some custom javascript. Something like in this example here: https://github.com/bozdoz/wp-plugin-leaflet-map#how-can-i-add-another-leaflet-plugin

    Plugin Contributor hupe13

    (@hupe13)

    Once you know the solution, it’s very simple. It took me some time to find it.

    (function() {
    	function main() {
    		if (!window.WPLeafletMapPlugin) {
    			console.log("no plugin found!");
    			return;
    		}
    
    		var maps = window.WPLeafletMapPlugin.maps;
    		
    		for (var i = 0, mapslen = maps.length; i < mapslen; i++) {
    			var map = maps[i];
    			map.eachLayer(function(layer) {
    				if (layer.options.type == "gpx" ) {
    					layer.options.pointToLayer = function (feature, latlng) {
          					return L.circleMarker(latlng, 
              					{"radius": 0 }
              				);
        				};
    				}
    			});
    		} 
    	}
    
    window.addEventListener("load", main);
    })();
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Hide pois’ is closed to new replies.