diff --git a/src/ol/geom/geometry.js b/src/ol/geom/geometry.js index 70fac46257..46f69d9115 100644 --- a/src/ol/geom/geometry.js +++ b/src/ol/geom/geometry.js @@ -2,10 +2,12 @@ goog.provide('ol.geom.Geometry'); goog.provide('ol.geom.GeometryLayout'); goog.provide('ol.geom.GeometryType'); +goog.require('goog.asserts'); goog.require('goog.functions'); goog.require('ol.Object'); goog.require('ol.extent'); goog.require('ol.proj'); +goog.require('ol.proj.Units'); /** @@ -250,6 +252,9 @@ ol.geom.Geometry.prototype.translate = goog.abstractMethod; * @api stable */ ol.geom.Geometry.prototype.transform = function(source, destination) { + goog.asserts.assert( + ol.proj.get(source).getUnits() !== ol.proj.Units.TILE_PIXELS, + 'cannot transform geometries with TILE_PIXELS units'); this.applyTransform(ol.proj.getTransform(source, destination)); return this; }; diff --git a/src/ol/proj/proj.js b/src/ol/proj/proj.js index cfb7c9faa9..193bc838d3 100644 --- a/src/ol/proj/proj.js +++ b/src/ol/proj/proj.js @@ -23,7 +23,8 @@ ol.proj.ProjectionLike; /** - * Projection units: `'degrees'`, `'ft'`, `'m'`, `'pixels'`, or `'us-ft'`. + * Projection units: `'degrees'`, `'ft'`, `'m'`, `'pixels'`, `'tile-pixels'` or + * `'us-ft'`. * @enum {string} * @api stable */ @@ -32,6 +33,7 @@ ol.proj.Units = { FEET: 'ft', METERS: 'm', PIXELS: 'pixels', + TILE_PIXELS: 'tile-pixels', USFEET: 'us-ft' };