Skip to content

FeatureLayer _redraw method throws error if defined for a multilinestring #1341

@mcalmus

Description

@mcalmus

Describe the bug

If a FeatureLayer is created with FeatureLayerOptions that contains a pointToLayer method when one or more of the items in the layer is of type multilinestring, the _redraw method will throw an error when it tries to construct a LatLng object using an array of arrays.

The problem, here, is that instead of checking types and values, the _redraw method relies on the presence or absence of methods being defined to perform operations and then blindly sends what could be an invalid value to other places.

Reproduction

Something like this:

const options = {
    url: <someUrl>,
    options.pointToLayer = () => void
};
const layer = esri.featureLayer(options);
...

If a multilinestring happens to be one of the elements returned. It blows up from here:

latLng(geojson.geometry.coordinates[1], geojson.geometry.coordinates[0])

Logs

No response

System Info

leaflet 1.8.0
esri-leaflet 3.0.8

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions