Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function addData(e) {
- var el = L.control.elevation();
- el.addData(e);
- map.addControl(el);
- }
- function onEachFeature(feature, layer) {
- layer.on ('click', function(e) {
- addData(feature)
- });
- }
- $.getJSON('data/routes/network=Nwn_Lines.json', function(e) {
- Nwn = L.geoJson(e, {
- style: function(feature, layer) {
- return {color:'#0000FF', weight:3, opacity: 0};
- }, onEachFeature: function(feature, layer) {
- layer.on('mouseover', function() {
- $('#Name').html("Name: "+'<strong>'+layer.feature.properties.name+'</strong>');
- layer.setStyle({color: '#FFFF00', opacity: 1});
- })
- layer.on('mouseout', function() {
- $('#Name').html("Name: ");
- layer.setStyle({opacity: 0});
- })
- }, onEachFeature: onEachFeature
- }).addTo(map);
- });
- var elevationDisplayed = false;
- var currFeature;
- var el = L.control.elevation();
- function showElevation(layer) {
- if (elevationDisplayed && (currFeature === layer.feature)) {
- map.removeControl(el);
- elevationDisplayed = false;
- }
- else {
- el.clear();
- if (!elevationDisplayed) el.addTo(map);
- el.addData(layer.feature);
- currFeature = layer.feature;
- elevationDisplayed = true;
- }
- };
- $.getJSON('data/routes/network=Nwn_Lines.json', function(e) {
- Nwn = L.geoJson(e, {
- style: function(feature, layer) {
- return {color:'#0000FF', weight:3, opacity: 0};
- }, onEachFeature: function(feature, layer) {
- layer.on('mouseover', function() {
- $('#Name').html("Name: "+'<strong>'+layer.feature.properties.name+'</strong>');
- layer.setStyle({color: '#FFFF00', opacity: 1});
- })
- layer.on('mouseout', function() {
- $('#Name').html("Name: ");
- layer.setStyle({opacity: 0});
- })
- layer.on ('click', function(e) {
- showElevation(e.target);
- });
- }
- }).addTo(map);
- });
- Error: <path> attribute d: Expected number, "M0,NaNL0.0295626108…".
Add Comment
Please, Sign In to add comment