More

BoundingBox of Layer seems to be unnaturally large

BoundingBox of Layer seems to be unnaturally large


I retrieve the bbox of my main Layer viaGetCapabilities.

Now, if I instantiate my map like this, I would expect to have the map centered within the bbox.

map = new OpenLayers.Map({ div : "map", projection : new OpenLayers.Projection("EPSG:31466"); units : "m", maxResolution : 2, maxExtent : new OpenLayers.Bounds(bbox) });

However, when I do it like this, the map is displayed in the upper right corner. Even stranger, when I put markers on the edges of the bounding box, the upper right corner is very far away and the lower left is not visible at all. (See picture, the red markers are the markers on the edge of a hard-coded bounding box that I use and that I want to replace by a Server-generated Version, the green marker is the upper right of my layers bounding box according toGetCapabilities).

EDIT:

The bounding box that getCapabilties sends: [360000, 5770215.8928236235, 365000, 5770804.068148668]

The bounding box that is hard-coded (red markers): [363060,5770362,363496,5771118]


Something seems to be wrong with your coordinates or the assigned EPSG-Code. EPSG 31466 is the "Gauß Krüger Zone 2"-CRS. The first number of the x-Values is the number of the (Gauß-Krüger-)zone, which means that your x-values would have to beginn with a 2. The central median is at 2.500.000,000 plus/minus 3 degrees. Your x-value should also have 7 numbers and not only 6. for further information please have a look at http://wiki.openstreetmap.org/wiki/DE:Gau%C3%9F-Kr%C3%BCger#Format (only available in german) https://en.wikipedia.org/wiki/Gauss%E2%80%93Kr%C3%BCger_coordinate_system

I guess that these coordinates are EPSG 25832-coordinates (ETRS89 UTM 32N). If so you would just have to assign the correct EPSG in Geoserver and adapt your javasript.