From 534afae345edcfbb4c121d11f31626a54de9c958 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Tue, 2 Jul 2019 22:59:18 +0200 Subject: [PATCH] Set world projection only for tile-pixels units --- src/ol/format/Feature.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ol/format/Feature.js b/src/ol/format/Feature.js index 08dc0e66a9..ec462816bd 100644 --- a/src/ol/format/Feature.js +++ b/src/ol/format/Feature.js @@ -4,6 +4,7 @@ import {assign} from '../obj.js'; import {abstract} from '../util.js'; import {get as getProjection, equivalent as equivalentProjection, transformExtent} from '../proj.js'; +import Units from '../proj/Units.js'; /** @@ -89,8 +90,9 @@ class FeatureFormat { let options; if (opt_options) { let dataProjection = opt_options.dataProjection ? - opt_options.dataProjection : this.readProjection(source); - if (opt_options.extent) { + getProjection(opt_options.dataProjection) : this.readProjection(source); + if (opt_options.extent && + dataProjection && dataProjection.getUnits() === Units.TILE_PIXELS) { dataProjection = getProjection(dataProjection); dataProjection.setWorldExtent(opt_options.extent); }