Accept feature projection in GeoJSON constructor
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
goog.provide('ol.format.Feature');
|
||||
|
||||
goog.require('ol.geom.Geometry');
|
||||
goog.require('ol.obj');
|
||||
goog.require('ol.proj');
|
||||
|
||||
|
||||
@@ -24,6 +25,12 @@ ol.format.Feature = function() {
|
||||
*/
|
||||
this.defaultDataProjection = null;
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {ol.proj.Projection}
|
||||
*/
|
||||
this.defaultFeatureProjection = null;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -64,19 +71,10 @@ ol.format.Feature.prototype.getReadOptions = function(source, opt_options) {
|
||||
* Updated options.
|
||||
*/
|
||||
ol.format.Feature.prototype.adaptOptions = function(options) {
|
||||
var updatedOptions;
|
||||
if (options) {
|
||||
updatedOptions = {
|
||||
featureProjection: options.featureProjection,
|
||||
dataProjection: options.dataProjection ?
|
||||
options.dataProjection : this.defaultDataProjection,
|
||||
rightHanded: options.rightHanded
|
||||
};
|
||||
if (options.decimals) {
|
||||
updatedOptions.decimals = options.decimals;
|
||||
}
|
||||
}
|
||||
return updatedOptions;
|
||||
return ol.obj.assign({
|
||||
dataProjection: this.defaultDataProjection,
|
||||
featureProjection: this.defaultFeatureProjection
|
||||
}, options);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -42,6 +42,10 @@ ol.format.GeoJSON = function(opt_options) {
|
||||
options.defaultDataProjection : 'EPSG:4326');
|
||||
|
||||
|
||||
if (options.featureProjection) {
|
||||
this.defaultFeatureProjection = ol.proj.get(options.featureProjection);
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of the geometry attribute for features.
|
||||
* @type {string|undefined}
|
||||
|
||||
Reference in New Issue
Block a user