Coder Social home page Coder Social logo

waypoint name about leaflet.filelayer HOT 8 OPEN

makinacorpus avatar makinacorpus commented on August 26, 2024
waypoint name

from leaflet.filelayer.

Comments (8)

leplatrem avatar leplatrem commented on August 26, 2024

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.

1stgongsin avatar 1stgongsin commented on August 26, 2024

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.

johnd0e avatar johnd0e commented on August 26, 2024

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.

1stgongsin avatar 1stgongsin commented on August 26, 2024

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.

johnd0e avatar johnd0e commented on August 26, 2024

There is mistype: change onEachFeature = to onEachFeature:

from leaflet.filelayer.

1stgongsin avatar 1stgongsin commented on August 26, 2024

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.

johnd0e avatar johnd0e commented on August 26, 2024
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.

geo903 avatar geo903 commented on August 26, 2024
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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.