I have a map with some layers in Projection EPSG:25832. This works well with OpenLayers 5.3.3. But when I change to OpenLayers 6.4.3 (or all others down to 6.0.1) then there is an error in the Definition of my projection. I am using proj4js in the version 2.6.2 (also tried older versions).
Error thrown from Proj4js:
Uncaught TypeError: coordinates must be finite numbers .... proj4-2.6.2.js:1:4846
Sourcecode in Openlayers-5 and Openlayers-6
var oBoundsGesamt = [ 456700,5200500,773480,5835251 ];
proj4.defs(sEpsgNummer, "+proj=utm +zone=32 +ellps=GRS80 +units=m +no_defs ");
ol.proj.proj4.register(proj4);
var oOlProjection = ol.proj.get('EPSG:25832');
oOlProjection.setExtent( oBoundsGesamt );
var oMapObj = new ol.Map({
target: 'ebMapObj',
layers: [ ... ],
view: new ol.View({
projection : oOlProjection,
extent: oBoundsGesamt,
Can somebody help me with this? The error is thrown at the end when I try to zoom to an Extent:
ol.control.ZoomToExtent({ extent: oBoundsGesamt })
oroMapObj.getView().fit(oBoundsStart, oMapObj.getSize());
var oOlProjection = new ol.proj.Projection({ code: sEpsgNummer, units: 'm' });
then the map is white but no errors any more with Openlayers 6. When I scroll in after two steps the maps appears :-)var oOlProjection = new ol.proj.Projection({ code: sEpsgNummer, units: 'm', extent: oBoundsEtrs25832Ganz });
). After that the map shows up. The ol.View only has a projection, center, zoom level. It seems that the extent/Bounds were to small because OpenLayers startet with this extent but as the map asks for more (default: 1.0 ratio) the extent might have been to small and therefore the white map