[OpenLayers-Users] restricted extent option
Gerstner, Volker
v.gerstner at proPlant.de
Thu May 2 05:02:15 PDT 2013
Hi all,
we try to use the 'restricted extent' option, see code below.
But ist doesn't work (i.e.: there is no javascript error, but there is nothing shown in the area of the map).
What did we wrong?
We also try it with 'map.zoomToMaxExtent(();', but nothing changes.
Thanks for quick response, best regards
V. Gerstner
Code with the 'restricted extent' option:
...
var myMaxExtent = new OpenLayers.Bounds(5.7529273,47.008106,15.400018,54.651104);
var myRestrictedExtent = new OpenLayers.Bounds(5.7529273,47.008106,15.400018,54.651104);
...
function init()
{
...
OpenLayers.Util.onImageLoadError = function() {};
map = new OpenLayers.Map("themaMap", {
units: "m",
numZoomLevels: 5,
maxResolution: 156543.0339,
maxExtent: myMaxExtent
restrictedExtent: myRestrictedExtent
});
var baseOptions = {
minZoomLevel: 6,
maxZoomLevel: 11,
numZoomLevels: 11,
transitionEffect: 'resize',
tileOptions: {crossOriginKeyword: null}
};
var baseLayerWWW = new OpenLayers.Layer.OSM("Hintergrundkarte WWW", "<url to the map-images>", baseOptions);
var themaLayer = new OpenLayers.Layer.Vector("WinterInfekt", {
projection: map.displayProjection,
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
url: "<url to kml-File with the definition of the markers>",
format: new OpenLayers.Format.KML({
extractStyles: true,
extractAttributes: true
})
})
});
var borderlayer = new OpenLayers.Layer.Vector("Grenzen", {
displayInLayerSwitcher: false,
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
url: "<url to kml for additional infos like borders etc.>",
format: new OpenLayers.Format.KML({
extractStyles: true,
extractAttributes: true
})
}),
rendererOptions: { zIndexing: true }
});
map.addLayers([baseLayerWWW, borderlayer, themaLayer ]);
map.setCenter(new OpenLayers.LonLat(10.0, 51.2).transform(
new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
new OpenLayers.Projection("EPSG:900913") // to Spherical Mercator Projection
), 6
);
map.events.register('zoomend', this, function (event) {
var x = map.getZoom();
if( x < 6)
{
map.zoomTo(6);
}
});
select = new OpenLayers.Control.SelectFeature(themaLayer);
themaLayer.events.on({
"featureselected": onFeatureSelect,
"featureunselected": onFeatureUnselect
});
map.addControl(select);
select.activate();
}
---------------------------------------------------------------------------
Aktuelles auf www.proPlant.de
WeizenPro: Online-Schlagberatung in Kooperation mit top agrar
piaf-Newsletter mit Hardware-Angeboten
Wegweiser zu den expert. Produkten 2013
----------------------------------------------------------------------------
Volker Gerstner
proPlant GmbH Tel.: +49 (0)251 98797-56
Albrecht-Thaer-Straße 34 Fax. : +49 (0)251 98797-99
D-48147 Muenster v.gerstner at proPlant.de
Geschäftsführer: Thomas Volk
Amtsgericht Münster HRB 4706
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130502/c579609b/attachment.html>
More information about the Users
mailing list