[OpenLayers-Users] Error when adding OpenLayers.Control.OverviewMap

Alexandre Dubé adube at mapgears.com
Mon Jul 8 10:52:03 PDT 2013


Hi Robert,

   Looking at the OverviewMap source code, in the draw method it checks 
if this.map.baseLayer is defined and won't actually draw the control, 
nor create the map, unless the baseLayer is set.  I'm not sure what's 
going on here, but it could be related to something else.

   You could try adding your control after initializing your main map 
view (extent / center) and see if it works.  You could also try to put a 
breakpoint on this line using firebug and look at the call stack to see 
when this gets called and why.  The line you refer is inside the map 
zoomToExtent method.  See what calls it and why.

HTH,

Alexandre


On 13-07-08 01:11 PM, Rob Hyx wrote:
> All,
>
> I am getting an error when trying to add an overview map to my current 
> map. This is how I am adding the object:
>
> var overviewMap = new OpenLayers.Control.OverviewMap();
> map.addControl(overviewMap);
>
> The error:
>
> TypeError: this.baseLayer is null (OpenLayers.debug.js line 9808)
> if (this.baseLayer.wrapDateLine) {
>
> I've tried adding a check before the line OL errors on and then adding 
> in the baseLayer from the layers property, and that works, but I don't 
> want to be adding in lines of code to OL. Is there something I can 
> pass into the OverviewMap constructor to fix this?
>
> The actual map renders fine and it does have a baseLayer so I would 
> expect the overview to just inherit that.
>
> Using OL 2.12 and Firefox 17.0.6
>
> Thanks in advance!
>
> -- 
> *HYX*
> http://hyx-music.com
>
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users


-- 
Alexandre Dubé
Mapgears
www.mapgears.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130708/3a269b2a/attachment-0001.html>


More information about the Users mailing list