[OpenLayers-Users] controls outside of the map viewport - first draw

Bart van den Eijnden (OSGIS) bartvde at osgis.nl
Thu Jan 4 04:06:07 EST 2007


There is a slight problem with the approach I used (call update on the
overviewmap at the onload event), when refreshing the page in IE using
CTRL+Refresh the javascript alert for different projections shows up. I
debugged and this.ovmap.getProjection() was still null for some reason. So I
added this check to updateRectToMap in the overviewmap control which seems
to work for me:

    updateRectToMap: function() {
        // The base layer for overview map needs to be in the same
projection
        // as the base layer for the main map.  This should be made more
robust.
        if(this.map.units != 'degrees') { if (!this.ovmap.getProjection())
return true;
            if(this.map.getProjection() != this.ovmap.getProjection()) {
                alert('The overview map only works when it is in the same
projection as the main map');
            }
        }
        var pxBounds =
this.getRectBoundsFromMapBounds(this.map.getExtent());
        this.setRectPxBounds(pxBounds);

Maybe another reason to let the control draw itself instead of the
application? What do people think?

Best regards,
Bart

--
Bart van den Eijnden
OSGIS, Open Source GIS
http://www.osgis.nl


--------- Oorspronkelijk bericht --------
Van: Bart van den Eijnden OSGIS <bartvde at osgis.nl>
Naar: users at openlayers.org <users at openlayers.org>
Onderwerp: [OpenLayers-Users] controls outside of the map viewport - first
draw
Datum: 04/01/07 06:19

> Hi list,
> 
> I have placed my overviewmap outside of the map viewport by following
Tim's
> suggestions. On the first draw of the web application page, the overview
map
> is not initalized, it shows as a blue rectangle, i.e. so no map.
> 
> Ofcourse I can fix this by calling overviewmap.update(); on the onload of
my
> page, but should the control not be responsible for this (ideally)?
> 
> Best regards,
> Bart
> 
> --
> Bart van den Eijnden
> OSGIS, Open Source GIS
> http://www.osgis.nl
> 
> 
> 
> 
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 






More information about the Users mailing list