From cc90d59cac63ed21421af90aef2b55c6e366541b Mon Sep 17 00:00:00 2001 From: Paul Spencer Date: Tue, 11 Mar 2014 07:46:58 -0400 Subject: [PATCH] Add documentation for the GeoJSON format. --- src/ol/format/geojsonformat.js | 59 +++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/src/ol/format/geojsonformat.js b/src/ol/format/geojsonformat.js index 903affd392..a9e53bc413 100644 --- a/src/ol/format/geojsonformat.js +++ b/src/ol/format/geojsonformat.js @@ -21,6 +21,8 @@ goog.require('ol.proj'); /** + * Provide access to features stored in the GeoJSON format. + * * @constructor * @extends {ol.format.JSONFeature} * @param {olx.format.GeoJSONOptions=} opt_options Options. @@ -313,6 +315,28 @@ ol.format.GeoJSON.prototype.getExtensions = function() { }; +/** + * Read a feature from a GeoJSON Feature source. This method will throw + * an error if used with a FeatureCollection source. + * + * @function + * @param {ArrayBuffer|Document|Node|Object|string} source Source. + * @return {ol.Feature} Feature. + */ +ol.format.GeoJSON.prototype.readFeature; + + +/** + * Read all features from a GeoJSON source. Works with both Feature and + * FeatureCollection sources. + * + * @function + * @param {ArrayBuffer|Document|Node|Object|string} source Source. + * @return {Array.} Features. + */ +ol.format.GeoJSON.prototype.readFeatures; + + /** * @inheritDoc */ @@ -356,6 +380,16 @@ ol.format.GeoJSON.prototype.readFeaturesFromObject = function(object) { }; +/** + * Read a geometry from a GeoJSON source. + * + * @function + * @param {ArrayBuffer|Document|Node|Object|string} source Source. + * @return {ol.geom.Geometry} Geometry. + */ +ol.format.GeoJSON.prototype.readGeometry; + + /** * @inheritDoc */ @@ -366,7 +400,10 @@ ol.format.GeoJSON.prototype.readGeometryFromObject = function(object) { /** - * @inheritDoc + * Read the projection from the GeoJSON source file. + * + * @param {ArrayBuffer|Document|Node|Object|string} object Source. + * @return {ol.proj.Projection} Projection. */ ol.format.GeoJSON.prototype.readProjection = function(object) { var geoJSONObject = /** @type {GeoJSONObject} */ (object); @@ -390,6 +427,16 @@ ol.format.GeoJSON.prototype.readProjection = function(object) { }; +/** + * Encode a feature as a GeoJSON Feature object. + * + * @function + * @param {ol.Feature} feature Feature. + * @return {ArrayBuffer|Node|Object|string} Result. + */ +ol.format.GeoJSON.prototype.writeFeature; + + /** * @inheritDoc */ @@ -415,6 +462,16 @@ ol.format.GeoJSON.prototype.writeFeatureObject = function(feature) { }; +/** + * Encode an array of features as GeoJSON. + * + * @function + * @param {Array.} features Features. + * @return {ArrayBuffer|Node|Object|string} Result. + */ +ol.format.GeoJSON.prototype.writeFeatures; + + /** * @inheritDoc */