yourcelf / olwidget

Javascript library to replace textareas that contain WKT data with editable OpenLayers maps, and a django app using it for django forms and admin.
Other
91 stars 43 forks source link

Uncaught TypeError: Cannot call method 'getLonLatFromLayerPx' of null #43

Closed skyl closed 13 years ago

skyl commented 13 years ago

I seem to be able to get myself into a situation where

Uncaught TypeError: Cannot call method 'getLonLatFromLayerPx' of null gets repeated over and over

Traceback::

Uncaught TypeError: Cannot call method 'getLonLatFromLayerPx' of null OpenLayers.Popup.Anchored.OpenLayers.Class.calculateRelativePositionOpenLayers.js:362 OpenLayers.Popup.Anchored.OpenLayers.Class.moveToOpenLayers.js:362 olwidget.Map.OpenLayers.Class.addPopup.popupMoveFuncolwidget.js:355 olwidget.Map.OpenLayers.Class.addPopupolwidget.js:359 olwidget.Map.OpenLayers.Class.createPopupolwidget.js:422 olwidget.Map.OpenLayers.Class.featureHighlightedolwidget.js:323 OpenLayers.Events.OpenLayers.Class.triggerEventOpenLayers.js:559 OpenLayers.Control.SelectFeature.OpenLayers.Class.highlightOpenLayers.js:1707 OpenLayers.Control.SelectFeature.OpenLayers.Class.selectOpenLayers.js:1707 OpenLayers.Control.SelectFeature.OpenLayers.Class.clickFeatureOpenLayers.js:1707 OpenLayers.Handler.OpenLayers.Class.callbackOpenLayers.js:803 OpenLayers.Handler.Feature.OpenLayers.Class.triggerCallbackOpenLayers.js:1074 OpenLayers.Handler.Feature.OpenLayers.Class.handleOpenLayers.js:1070 OpenLayers.Handler.Feature.OpenLayers.Class.clickOpenLayers.js:1065 OpenLayers.Events.OpenLayers.Class.triggerEventOpenLayers.js:559 OpenLayers.Events.OpenLayers.Class.handleBrowserEventOpenLayers.js:562 (anonymous function)OpenLayers.js:113 7 OpenLayers.js:362Uncaught TypeError: Cannot call method 'getLonLatFromLayerPx' of null 0.pngFailed to load resource: the server responded with a status of 404 (Not Found) 10323 OpenLayers.js:362Uncaught TypeError: Cannot call method 'getLonLatFromLayerPx' of null

Then, an event triggers the same problem with a different route over and over again:

Uncaught TypeError: Cannot call method 'getLonLatFromLayerPx' of null OpenLayers.Popup.Anchored.OpenLayers.Class.calculateRelativePositionOpenLayers.js:362 OpenLayers.Popup.Anchored.OpenLayers.Class.moveToOpenLayers.js:362 olwidget.Map.OpenLayers.Class.addPopup.popupMoveFuncolwidget.js:355 OpenLayers.Events.OpenLayers.Class.triggerEventOpenLayers.js:559 OpenLayers.Map.OpenLayers.Class.moveToOpenLayers.js:877 panTween.start.callbacks.eachStepOpenLayers.js:854 (anonymous function)OpenLayers.js:113 OpenLayers.Tween.OpenLayers.Class.playOpenLayers.js:447 (anonymous function)

it's probably what I'm doing after the setup that's causing this but do you know of a gutter-bumper I might be able to put on to avoid it? The popup comes up but the tracebacks start going without stop in the console and the popup will not go down. Strangely, if you click on another feature, you can bring it's popup up and down. The map will then not zoom or drag and gives slight variations on the above tracebacks.

http://d.pr/uhn

yourcelf commented 13 years ago

Don't suppose I could trouble you for some failing example code?

From the description and traceback, I'd guess that it has something to do with the "addPopup" method of olwidget.map; particularly the "popupMoveFunc" closure which is attached to move events.

Can't really tell much more without some code to play with.

skyl commented 13 years ago

If I drag the map a little first, it doesn't happen. (comment never posted from last night)

skyl commented 13 years ago

I will try to put a page up in public or create a smaller example. Thanks.

yourcelf commented 13 years ago

Gonna close this, it's been a while... reopen if you still have trouble.