diff --git a/resources/js/src/ol.mjs b/resources/js/src/ol.mjs index e5e52732fd..620f4da4d6 100644 --- a/resources/js/src/ol.mjs +++ b/resources/js/src/ol.mjs @@ -6,6 +6,7 @@ import { Tile, Vector as VectorLayer } from 'ol/layer.js'; import { OSM, Vector as VectorSource } from 'ol/source.js'; import { Circle, Fill, Stroke, Style, Text } from 'ol/style.js'; import { Feature, Map, View } from 'ol'; +import { get as getProjection } from 'ol/proj.js'; const ol = { control: { @@ -29,7 +30,7 @@ const ol = { style: { Circle, Fill, Stroke, Style, Text }, - Feature, Map, View + Feature, Map, View, getProjection }; export default ol; diff --git a/resources/js/src/table/gis_visualization.ts b/resources/js/src/table/gis_visualization.ts index 5b8bddedad..3530245920 100644 --- a/resources/js/src/table/gis_visualization.ts +++ b/resources/js/src/table/gis_visualization.ts @@ -527,10 +527,15 @@ function getFeaturesFromOpenLayersData (geometries: any[]): any[] { } if (geometry.geometry.srid !== 3857) { - olGeometry = olGeometry.transform( - 'EPSG:' + (geometry.geometry.srid !== 0 ? geometry.geometry.srid : 4326), - 'EPSG:3857' - ); + const source = 'EPSG:' + (geometry.geometry.srid !== 0 ? geometry.geometry.srid : 4326); + const sourceProj = window.ol.getProjection(source); + + if (sourceProj) { + olGeometry = olGeometry.transform( + source, + 'EPSG:3857' + ); + } } if (geometry.style.text) {