Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eachActiveFeature fails with TypeError #948

Closed
mpayson opened this issue Apr 25, 2017 · 1 comment · Fixed by #950
Closed

eachActiveFeature fails with TypeError #948

mpayson opened this issue Apr 25, 2017 · 1 comment · Fixed by #950

Comments

@mpayson
Copy link

mpayson commented Apr 25, 2017

  • Browser and version: Chrome 57
  • Version of Leaflet (L.version): 1.0.3
  • Version of esri Leaflet (L.esri.VERSION): 2.0.8

When I call 'eachActiveFeature' on a feature layer, the following error is thrown:

Uncaught TypeError: this._layers[i].getBounds is not a function
at NewClass.eachActiveFeature ([email protected]:3852)
at NewClass.map.on (VM65 runner:12)
at NewClass.fire (leaflet-src.js:587)

See JSBin: https://jsbin.com/kavoqukace/edit?html,output

@mpayson mpayson changed the title eachActiveFeature fails with TypeError eachActiveFeature fails with TypeError Apr 25, 2017
@mpayson mpayson changed the title eachActiveFeature fails with TypeError eachActiveFeature fails with TypeError Apr 25, 2017
@jgravois
Copy link
Contributor

i'm 99% certain that we just need to implement a simpler check for point geometries to see whether they are inside the current map extent.

// https://github.com/Esri/esri-leaflet/blob/6606d8e1bd95e5997064765e0946ee714af07c41/src/Layers/FeatureLayer/FeatureLayer.js#L251
for (var i in this._layers) {    
    // bounds can only be fetched from polylines and polygons
    if (activeBounds.intersects(this._layers[i].getBounds()) && this._currentSnapshot.indexOf(this._layers[i].feature.id) !== -1) {
        fn.call(context, this._layers[i]);
    }
}

not sure how i missed that when i added the new method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants