nreese/enhanced_tilemap

POI Lat Long Error

Closed this issue · 2 comments

I was playing with the POI layers and continued to get a strange error regarding lat not being defined. This caused a hard crash within kibana that made it a bit challenging to debug / show much information. I realized there is an edge case where the extractLatLng function (POIs.js) will return a null. I'm not sure if this is because invalid data is being passed to leaflet but I know it causes a hard error.

I fixed the error by wrapping the return statement with a ternary value:

point = L.latLng(lat, lon);
return (point == null) ? L.latLng(0, 0) : point;

I'd really like to help improve this tile map if you are open to collaborate. Are there any good resources you could direct me towards to help get a more robust testing environment created?

Collaboration is great. Please submit any pull requests for issues discovered.

What file is the above code from? Do you have a data set that produces the error?

I started to work on some tests using mocha. Checkout the test branch to play around with the conversion between elasticsearch geo_point data structures and L.latLng objects. Be warned that the test dependencies stomp on the lodash version needed for kibana so running the plugin in Kibana with the node_modules folder will cause issues until the dependency clash can be resolved.

The conversion code now handles the case of receiving a geo_point string with the value ","