Support GeoJSON as parsed object

With this change, we can programmatically create
GeoJSONFeatureCollection objects programmatically, without
reading a GeoJSON file.
This commit is contained in:
ahocevar
2013-03-08 16:25:23 +01:00
parent 7f62b26c80
commit 389b8d14d7
2 changed files with 17 additions and 0 deletions

View File

@@ -51,6 +51,19 @@ ol.parser.GeoJSON.prototype.readFeaturesFromString =
};
/**
* Parse a GeoJSON feature collection from decoded JSON.
* @param {GeoJSONFeatureCollection} object GeoJSON feature collection decoded
* from JSON.
* @param {ol.parser.ReadFeaturesOptions=} opt_options Reader options.
* @return {Array.<ol.Feature>} Array of features.
*/
ol.parser.GeoJSON.prototype.readFeaturesFromObject =
function(object, opt_options) {
return this.parseFeatureCollection_(object, opt_options);
};
/**
* @param {GeoJSONObject} json GeoJSON object.
* @return {ol.Feature|Array.<ol.Feature>|