[GIS] What’s difference between `ol.js` and `ol-debug.js` files in OpenLayers-3

openlayers

I run the sample code at here: http://jsfiddle.net/1a948faa/2/.

When I add the ol-debug.js to sample, it run successfully. But when I add ol.js file to sample, it does not work properly. What's the problem?

what's difference between ol.debug.js and ol.js files?

Best Answer

In simple terms, ol.debug.js is a verbose form of the ol.js file. ol.js should just be a minified version, so there should be no substantive difference in the execution of the code. I have used both and found them to work equally well so I suspect there is a problem in your code or your reference to the ol.js file. One thing to check in your case is that you taged this post for both ol3 and ol2. The api is different between ol3 and ol2 and so ol2 code will not work with the ol3 ol.js file and vice versa.

The point of the minified ol.js is to reduce bandwidth as all comments are removed, variables are reduced to single letters and whitespace is stripped from the file. The downside is that this makes it very hard to debug, hence the availability of the debug version.