[GIS] How to debug third party JavaScript libraries such as openlayers

debuggingdjangoopenlayersweb

I am able to work with web development tools like firebug and dev tools and solve bugs in my javascript files. But when it comes to bugs that produce errors such as "typeError: e is null" which prompts me to the third party js library I am using, how am I supposed to debug that issue?

I am creating a django app to integrate with a bigger django project. I am using openlayers as simple as possible and even though I am not getting any errors, apart from a css warning, my map division is not loading any maps…How am I supposed to work around this and of course any future similar problems?

Any advice or link would be much appreciated.

Best Answer

In general, debugging JavaScript code is not as easy as debugging your python code although firebug has made the problem much simpler already.

When it comes to js libraries like OpenLayers, first make sure you have the uncompressed version for development. When some error occurs, you can find the source file and the code line the defect originates in Firebug's console with a link to script provided. Find the code that causes the error and set break point where appropriate and repeat the process just as how you debug in other programming language.

Personally I find the firebug official documentation(faq & wiki) is quite useful, and especially this javascript debugging page.

Related Question