GithubHelp home page GithubHelp logo

Comments (6)

patrickarlt avatar patrickarlt commented on September 26, 2024

@mcalmus Can you give me a more detailed reproduction case here? pointToLayer is called when so that users can transform the x,y coordinates from the service it something that inherits from L.Layer (L.Marker, L.CircleMarker, ect...). As far as I know feature services don't support multiline strings as a geometry type and if they did we could convert it to a L.Polyline and skip pointToLayer.

I'm guessing your doing something like trying to convert a bunch of points to a multiline string on the fly which isn't really what this was intended to do but I can try to help if you provide a more detailed use case.

from esri-leaflet.

mcalmus avatar mcalmus commented on September 26, 2024

We are using pointToLayer to set a custom icon

  const options = {
    url: <someUrl>,
    pointToLayer: (feature, latlng) => new L.Marker(latlng, { icon: myCustomIcon })
};
const layer = esri.featureLayer(options);

There are several sets of layers available for the user to select from what is effectively a third-party service. Some of these layers have roads that include MultiLineString items. Because I know which of these layers are exclusively roads, I can selectively not include the pointToLayer definition for those layers, but it's nicer to just always include it in the configuration.

When it's included for one of these items, _redraw hits on

if (layer && layer.setStyle && this.options.pointToLayer) {
which should not be relevant.

from esri-leaflet.

gavinr avatar gavinr commented on September 26, 2024

@mcalmus I'm having a hard time finding a public layer service that has those types of items - do you have the URL to a public service that we can use to create a replication case to see the issue? Thanks!

from esri-leaflet.

patrickarlt avatar patrickarlt commented on September 26, 2024

Because I know which of these layers are exclusively roads, I can selectively not include the pointToLayer definition for those layers, but it's nicer to just always include it in the configuration.

@mcalmus so you want to be able to do this:

const layerOptions = {
  pointToLayer: (feature, latlng) => new L.Marker(latlng, { icon: myCustomIcon })
  style: { /*line and polygon style */}
}

const pointLayer = esri.featureLayer({
  url: urlToPointLayer,
  ...layerOptions
});

const roadLayer = esri.featureLayer({
  url: urlToLineLayer,
  ...layerOptions
});

And have it work? So we ignore pointToLayer for non-point layers?

from esri-leaflet.

mcalmus avatar mcalmus commented on September 26, 2024

@patrickarlt

Yes. That's the idea.

And have it work? So we ignore pointToLayer for non-point layers?

I'm not suggesting it should "ignore" pointToLayer so much as it shouldn't be using its presence as the way to identify the type of layer.

from esri-leaflet.

mcalmus avatar mcalmus commented on September 26, 2024

@mcalmus I'm having a hard time finding a public layer service that has those types of items - do you have the URL to a public service that we can use to create a replication case to see the issue? Thanks!

@gavinr I don't have a public layer. I'll see if I can get the data I'm using posted.

from esri-leaflet.

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.