Fixed can't access property getUnits, sourceProj is null (#19275)
* Fixed can't access property getUnits, sourceProj is null * Linted files * moved the third party dependencies Fixes the issue coming up upon entering an invalid SRID. Now the function would execute only if the sourceProj is a valid object. Fixes #19266 --------- Signed-off-by: Sachin Bahukhandi <sachinb0013@gmail.com>
This commit is contained in:
parent
38837dcf55
commit
b96cc3a1ad
@ -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;
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user