Giter VIP home page Giter VIP logo

Comments (9)

matonga avatar matonga commented on July 26, 2024 1

Changing:

if (layer instanceof L.Marker) {

To:

if (layer instanceof L.Marker || layer instanceof L.CircleMarker) {

Would actually make it for the CircleMarker case.

from leaflet-lasso.

ajhalls avatar ajhalls commented on July 26, 2024

I am also hoping to be able to do this with either Circle or CircleMarker, it seems to be an issue with the getSelectedLayers() function. Within there there is a check to see if the layer is a "Marker" and if so calls

var r = e.toGeoJSON().geometry;
which in turn calls getLatLng().

Simply changing the o.Marker to o.Circle will get it to try the circles, but it fails to convert the layer. I didn't see what was different in the data structure for the Marker vs the Circle that it shouldn't have worked, but it doesn't.

from leaflet-lasso.

zakjan avatar zakjan commented on July 26, 2024

The issue could be that GeoJSON doesn't have an official Circle geometry. There is a draft https://github.com/geojson/geojson-spec/wiki/Proposal---Circles-and-Ellipses-Geoms, never implemented yet.

In order to use turf's capabilities, we can convert Leaflet Circle to GeoJSON Polygon using @turf/circle.

from leaflet-lasso.

zakjan avatar zakjan commented on July 26, 2024

It would work only for the center point, the plan here is to support also intersecting with the outer circle

from leaflet-lasso.

matonga avatar matonga commented on July 26, 2024

That's right for Circle layers. But what about CircleMarker layers? Those have radius in pixels, which in my opinion would be equivalent to trying to match the Marker's image silohuette.

from leaflet-lasso.

zakjan avatar zakjan commented on July 26, 2024

Unfortunately, Marker image silouhette is also not matched currently. Only real geocoordinates

from leaflet-lasso.

answerquest avatar answerquest commented on July 26, 2024

@matonga is there an unminified version of the js that I can do your edit in, to make it select CircleMarker?

from leaflet-lasso.

answerquest avatar answerquest commented on July 26, 2024

@matonga no worries I got it to work with the minified js: towards the end of the file:

(function(e){if(e instanceof o.Marker )

becomes:

(function(e){if(e instanceof o.Marker || e instanceof o.CircleMarker )

from leaflet-lasso.

zakjan avatar zakjan commented on July 26, 2024

Implemented in 2.0.0

from leaflet-lasso.

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.