SignalK / maptracker

A web page that tracks targets based on data from a SignalK server
Apache License 2.0
1 stars 2 forks source link

Cannot read property 'lat' of undefined #12

Closed citrusweb closed 7 years ago

citrusweb commented 7 years ago

Hi,

The vessel is visible on the map with an up to date location, but when i use the 'locate' button we get this error in the Chrome console:

Uncaught TypeError: Cannot read property 'lat' of undefined at Object.project (map.js:16990) at Object.latLngToPoint (map.js:17013) at e.project (map.js:17284) at e.latLngToLayerPoint (map.js:17295) at e._getCenterOffset (map.js:17488) at e._tryAnimatedPan (map.js:21157) at e.setView (map.js:21121) at e.panTo (map.js:17127) at e. ((index):111) at State.onClick (map.js:16236) at e. (easy-button.js:185) at HTMLButtonElement.i [as _leaflet_click23] (map.js:19826)

What can be the problem?

Best regards, Jaron

tkurki commented 7 years ago

How do you get the data you are using? I assume it is neither the sample n2k data nor the sample nmea data.

I suspect the delta updates that your server is sending do not use the same self id as your server's configuration and maptracker can not tell which position is the one for self.

I updated maptracker with more fresh dependencies, fixed a few unrelated bugs and made it show an alert with the press of the locate button if there is not self position. The alert shows what maptracker thinks your self id is.

Please update maptracker and let me know if you can get the problem fixed.

citrusweb commented 7 years ago

Thanks a lot! Everything works fine after your update and the console give no more errors.