[OpenLayers-Users] problems with the overview map
Lars Schrader
lars.schrader at web.de
Fri Feb 16 04:55:09 EST 2007
Hallo Tim,
I think that I understand your answer, but it doesn´t work,
The complete code snippet at the end of these email works, but I have to
define the layer as a base layer:
overviewMap.addOptions({isBaseLayer: true});
Otherwise I don´t see the overview map. It´s also important that I define the
layer for the overview map in the following way:
, layers:[overviewMap]
What the fifferent between
layers:[overviewMap]
and
mapOptions: {layers:[overviewMap]} ?
The snippet with the mapOptions phrase doesn´t work. Why? In my example I
wanted to use:
mapOptions: {numZoomLevels: 1, layers:[overviewMap]}
Greetings, Lars
overviewMap = new OpenLayers.Layer.WMS.Untiled(
"Overview Map"
, "http://x.x.x.x/cgi-bin/mapserv?"
, {map:'/home/mapserver/mapserver/ni/fbfinder/fbfinder_lk_pg_wms.map'
, layers: 'LK-Layer', format:'image/png', 'transparent': 'true'}
, {maxExtent: new OpenLayers.Bounds(3340000,5685539,3680000,5970992)
, maxResolution: 'auto', projection:"EPSG:31467",ratio:'1'
} );
overviewMap.setVisibility(true);
overviewMap.addOptions({isBaseLayer: true});
/* map.addLayer(overviewMap); */
var optionsOverview = {div: $('overviewmap')
, projection: "EPSG:31467"
, units: 'm'
, maxExtent:new OpenLayers.Bounds(3340000,5685539,3680000,5970992)
, resolutions: [45,40,35,30,25,20,12,9,6,4,2,1]
, layers:[overviewMap]
, 'size': new OpenLayers.Size(200,200)
, mapOptions: {numZoomLevels: 1}
};
var ovControl = new OpenLayers.Control.OverviewMap(optionsOverview);
ovControl.isSuitableOverview = function() {
return true;
};
map.addControl(ovControl);
Am Donnerstag, 15. Februar 2007 17:11 schrieb Tim Schaub:
> Lars Schrader wrote:
> > One another problem: Is at right, that the layer for the overview map
> > must be a base layer?
>
> The map for the overview control is just the same as any other map - so
> you can add whatever layers you choose. Just construct the control with
> options like:
>
> var options = {mapOptions: {layers: [layer0, layer1, layer2]}};
>
> Note that these layers should be constructed specifically for the
> overview map (and not already added to the main map). You can clone
> layers already added to the main map before adding them to the overview
> map (this is done by default for the main map's base layer if you don't
> pass the overview map any layers at all).
>
> Also, if you want to do things with your overview map after you have
> added the control, just assign it to some variable that you can later
> access:
>
> var ov = new OpenLayers.Control.OverviewMap(options);
> // now you can get the control's map with ov.ovmap
>
> Tim
>
> > Greetings, Lars
> >
> > Am Mittwoch, 14. Februar 2007 18:25 schrieb Tim Schaub:
> >> Lars Schrader wrote:
> >>> What I want to have is a OverviewMap, which always shows the complete
> >>> area of interest (the complete WMS-Layer). No Zoom-In and no Zoom-Out.
> >>> Only the red rectangle should change his position.
> >>
> >> The numZoomLevels has to be set on the mapOptions property of the
> >> control's options.
> >>
> >> var options = {mapOptions: {numZoomLevels: 1}};
> >> map.addControl(new OpenLayers.Control.OverviewMap(options));
> >>
> >> This is also true of any other options that you want to set on the
> >> overview map control's map. For example, instead of setting maxExtent
> >> as a property of the control, it needs to be set as a property of the
> >> control's map - this is done with the mapOptions property of the
> >> control.
> >>
> >> This is a bit confusing without looking at an example. Take a look at
> >> the examples on the wiki page
> >> (http://trac.openlayers.org/wiki/Control/OverviewMap#Customprojectionsex
> >>ten tsetc.)
> >>
> >> Write back if you still have trouble.
> >>
> >> Tim
> >> _______________________________________________
> >> Users mailing list
> >> Users at openlayers.org
> >> http://openlayers.org/mailman/listinfo/users
> >
> > _______________________________________________
> > Users mailing list
> > Users at openlayers.org
> > http://openlayers.org/mailman/listinfo/users
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
More information about the Users
mailing list