Merge pull request #9747 from ahocevar/format-setprojection-tilepixels-only

Set world projection only for tile-pixels units
This commit is contained in:
Andreas Hocevar
2019-07-03 08:25:25 +02:00
committed by GitHub

View File

@@ -4,6 +4,7 @@
import {assign} from '../obj.js'; import {assign} from '../obj.js';
import {abstract} from '../util.js'; import {abstract} from '../util.js';
import {get as getProjection, equivalent as equivalentProjection, transformExtent} from '../proj.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; let options;
if (opt_options) { if (opt_options) {
let dataProjection = opt_options.dataProjection ? let dataProjection = opt_options.dataProjection ?
opt_options.dataProjection : this.readProjection(source); getProjection(opt_options.dataProjection) : this.readProjection(source);
if (opt_options.extent) { if (opt_options.extent &&
dataProjection && dataProjection.getUnits() === Units.TILE_PIXELS) {
dataProjection = getProjection(dataProjection); dataProjection = getProjection(dataProjection);
dataProjection.setWorldExtent(opt_options.extent); dataProjection.setWorldExtent(opt_options.extent);
} }