Giter Club home page Giter Club logo

Comments (6)

snkashis avatar snkashis commented on June 15, 2024

if you calculate a centroid for polygons then I think it would be fairly simple to implement a showLabel for polygons.

from leaflet.label.

jacobtoye avatar jacobtoye commented on June 15, 2024

Currently vectors do not support static labels. Like @snkashis points out we could calculate the centroid of the polygon and place the label there. However that would not work for polylines and and multipolygons.

from leaflet.label.

patrickarlt avatar patrickarlt commented on June 15, 2024

For polylines I think simple start, end, center parameter would cover a lot of use cases. For multipolygons the label could be applied to each polygon.

from leaflet.label.

giacomocolle avatar giacomocolle commented on June 15, 2024

Also a simple parameter where specify a couple of WGS coordinates would be fine.
Thank you for the plugin.

from leaflet.label.

jacobtoye avatar jacobtoye commented on June 15, 2024

Still want to do this when we have the time.

from leaflet.label.

snkashis avatar snkashis commented on June 15, 2024

@jacobtoye , shall I prep a PR using the builtin centroid functionality now?Or were you thinking of one of the more configurable approaches mentioned above.
https://github.com/Leaflet/Leaflet/blob/a628e724a1b665b6c8139722931749e9515cee44/src/layer/vector/Polyline.js#L72
https://github.com/Leaflet/Leaflet/blob/a628e724a1b665b6c8139722931749e9515cee44/src/layer/vector/Polygon.js#L11

from leaflet.label.

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.