Better default when no transform available
Do not use identityTransform for EPSG:4326 transform unless units are degrees
This commit is contained in:
@@ -212,6 +212,10 @@ export function getPointResolution(projection, resolution, point, opt_units) {
|
||||
projection,
|
||||
get('EPSG:4326')
|
||||
);
|
||||
if (toEPSG4326 === identityTransform && units !== Units.DEGREES) {
|
||||
// no transform is available
|
||||
pointResolution = resolution * projection.getMetersPerUnit();
|
||||
} else {
|
||||
let vertices = [
|
||||
point[0] - resolution / 2,
|
||||
point[1],
|
||||
@@ -226,6 +230,7 @@ export function getPointResolution(projection, resolution, point, opt_units) {
|
||||
const width = getDistance(vertices.slice(0, 2), vertices.slice(2, 4));
|
||||
const height = getDistance(vertices.slice(4, 6), vertices.slice(6, 8));
|
||||
pointResolution = (width + height) / 2;
|
||||
}
|
||||
const metersPerUnit = opt_units
|
||||
? METERS_PER_UNIT[opt_units]
|
||||
: projection.getMetersPerUnit();
|
||||
|
||||
Reference in New Issue
Block a user