javascript - Remove Polylines on a map from mapbox -
javascript - Remove Polylines on a map from mapbox -
does know how can remove polylines have on map. hve tried many things remove lines taht drawn up. not dissapear. code used draw lines :
var geojson = [ { "type": "feature", "geometry": { "type": "linestring", "coordinates": [ [10.39799, 63.43074], [10.3987, 63.431] ] }, "properties": { "stroke": "#fc4353", "stroke-width": 5 } },{ "type": "feature", "geometry": { "type": "linestring", "coordinates": [ [10.397958755, 63.431], [10.39868, 63.43073] ] }, "properties": { "stroke": "#fc4353", "stroke-width": 5 } } ]; l.geojson(geojson, { style: l.mapbox.simplestyle.style }).addto(map);
store reference of added thing variable. utilize map.removelayer
.
var layer = l.geojson(geojson, { style: l.mapbox.simplestyle.style }).addto(map); map.removelayer(layer);
https://www.mapbox.com/mapbox.js/api/v2.1.4/l-map-class/#map-stuff-methods
javascript mapbox geojson
Comments
Post a Comment