FrancisG-Massey / Capstone2016

4 stars 0 forks source link

"View Map" throws error #198

Closed FrancisG-Massey closed 8 years ago

FrancisG-Massey commented 8 years ago

When pressing "view map" on the trap-admin page, the following error gets logged:

TypeError: Cannot read property 'coord_lat' of undefined
    at Scope.$scope.showMap (controllers.js:62)
    at Object.get (angular.js:10773)
    at Scope.$digest (angular.js:12439)
    at Scope.$apply (angular.js:12712)
    at done (angular.js:8315)
    at completeRequest (angular.js:8527)
    at XMLHttpRequest.xhr.onreadystatechange (angular.js:8466)

As a result, only the top-left map tile gets loaded & the trap icons don't properly fill the screen (as they did previously): image

MrMJLee commented 8 years ago

what browser are you using?

FrancisG-Massey commented 8 years ago

Chrome

sam-hunt commented 8 years ago

You may want to check what the behaviour is when coord_lat and coord_long have unrealistic values, e.g. way too high or low, off the map, off the world

If one trap is "located" on the other side of the world, will it try to display it on the map? Will it try to load every map tile on the earth?

MrMJLee commented 8 years ago

I was using first trap's existing lat and lang coords to set the view as default. I am creating the map view to take the center it around the max / min long / lat values at the moment.

sam-hunt commented 8 years ago

Hmm well you map want to dump the coordinates to console right before the map is loaded, even just to check that they'll all consistent and what the map API expects:

Cannot read property 'coord_lat' of undefined.

possibly coord_lat has a bad value, or the object which stores it could be null pointering?