[OpenLayers-Users] Firebug and OL

Jay Douillard jay.douillard at ubc.ca
Wed Dec 10 18:52:21 EST 2008


Thanks Chris! I knew it was some ridiculously simple javascript concept I had missed! Time to spend more time actually LEARNING javascript!
jay
----- Original Message -----
From: "Christopher Schmidt" <crschmidt at metacarta.com>
To: "Jay Douillard" <jay.douillard at ubc.ca>
Cc: "OpenLayers Mailing List" <users at openlayers.org>
Sent: Wednesday, December 10, 2008 3:44:02 PM GMT -08:00 US/Canada Pacific
Subject: Re: [OpenLayers-Users] Firebug and OL

On Wed, Dec 10, 2008 at 03:30:47PM -0800, Jay Douillard wrote:
> I've been having trouble debug my openlayers code with firebug. I thought I was doing something fundamentally wrong, but then I checked the demo map on the openlayers homepage and the same code that did not work with my map worked just fine..
> for example 
> >>map.layers.length
> should = a number in this case 2
> All I get is :
> 
> ReferenceError: map is not defined
> 
> which references line 65 :     units: 'm',
> 
> 
> Any ideas why map is not defined? I'm sure it is a small javascript mistake on my part!

Scope.

'var' means 'make this a local variable. Unless you're at a breakpoint,
Firebug works in the global scope. Dropping 'var' in front of your 'map'
variable will let you interact with it in Firebug.

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list