Comments (8)
Can it be possible that 'waypoint name' appears?
Yes I think so, try to inspect the layer object you obtain from the loaded event:
var control = L.Control.fileLayerLoad();
control.loader.on('data:loaded', function (event) {
// event.layer gives you access to the layers you just uploaded!
// iterate each point of the layer
// add a popup or something with the layer properties
});
from leaflet.filelayer.
Thank you for reply, leplatrem.
Sadly, I don't know about javascript at all. so I can't change the original code.
</docs/index.js>
L.Control.FileLayerLoad.LABEL = '<img class="icon" src="folder.svg" alt="file icon"/>';
control = L.Control.fileLayerLoad({
fitBounds: true,
layerOptions: {
style: style,
pointToLayer: function (data, latlng) {
return L.circleMarker(
latlng,
{ style: style }
);
}
}
});
control.addTo(map);
control.loader.on('data:loaded', function (e) {
var layer = e.layer;
console.log(layer);
});
}
window.addEventListener('load', function () {
initMap();
});
}(window));
[L.circleMarker] shows waypoint as just red circle. I want waypoint name appear
Can you teach me what code should I add to the original index.js ?
from leaflet.filelayer.
Add this to layerOptions
:
layerOptions: {
onEachFeature: function (feature, layer) {
if (feature.properties.name) { layer.bindTooltip(feature.properties.name, { permanent: true }); }
},
// style: style,
from leaflet.filelayer.
Thank you for reply, johnd0e.
I changed code like below. but It's not working
control = L.Control.fileLayerLoad({
fitBounds: true,
layerOptions: {
onEachFeature = function (feature, layer) {
if (feature.properties.name) { layer.bindTooltip(feature.properties.name, { permanent: true });
},
// style: style,
pointToLayer: function (data, latlng) {
return L.circleMarker(
latlng,
{ style: style }
);
}
}
});
control.addTo(map);
from leaflet.filelayer.
There is mistype: change onEachFeature =
to onEachFeature:
from leaflet.filelayer.
It doesn't work either. sorry for bothering
syntax error -> Unexpected token ,
control = L.Control.fileLayerLoad({
fitBounds: true,
layerOptions: {
onEachFeature: function (feature, layer) {
if (feature.properties.name) { layer.bindTooltip(feature.properties.name, { permanent: true });
},
// style: style,
pointToLayer: function (data, latlng) {
return L.circleMarker(
latlng,
{ style: style }
);
}
}
});
from leaflet.filelayer.
control = L.Control.fileLayerLoad({
fitBounds: true,
layerOptions: {
onEachFeature: function (feature, layer) {
if (feature.properties.name) { layer.bindTooltip(feature.properties.name, { permanent: true }) };
},
// style: style,
pointToLayer: function (data, latlng) {
return L.circleMarker(latlng, {style: style});
}
}
});
from leaflet.filelayer.
control1 = L.Control.fileLayerLoad({
fitBounds: true,
layerOptions: {
onEachFeature: function (feature, layer) {
layer.bindTooltip(feature.properties.name, { permanent: true })
},
// style: style,
pointToLayer: function (feature, latlng) {
label = String(feature.properties.name); // .bindTooltip can't use straight 'feature.properties.attribute'
return new L.CircleMarker(latlng, {
weight: 0, fillOpacity:0
}).bindTooltip(label, {permanent: true, opacity: 1, direction: 'center',className: 'labelstyle'}).openTooltip();
}
}
});
from leaflet.filelayer.
Related Issues (20)
- Remove added layer HOT 1
- Existing polygon not remove if load a new one HOT 1
- fileLayerLoad() returns undefined property 'loader' HOT 3
- File size limit HOT 6
- Event supporting loading several files at once
- KML styling
- Option - show filename in tool tip
- Multi file loader and integrated solution .kmz HOT 3
- L.Control.fileLayerLoad is not a function HOT 3
- Permit Load RasterFiles
- pc only๏ผ
- Why can't I write like this? How should I revise it?
- React-leaflet
- Update and fix eslint
- Test with cypress
- Support Leaflet 1.7.x
- Change deprecated togeojson dependency HOT 1
- Load files from URL
- Ability to upload zipped shapefile HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leaflet.filelayer.