diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index d4ac12b859..5b01f40a5e 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -479,11 +479,14 @@ /** * @typedef {Object} ol.source.GeoJSONOptions * @property {Array.|undefined} attributions Attributions. + * @property {ol.proj.ProjectionLike} defaultProjection Default projection. + * @property {ol.Extent|undefined} extent Extent. * @property {string|undefined} logo Logo. - * @property {GeoJSONObject|undefined} geoJSON Object. + * @property {GeoJSONObject|undefined} object Object. * @property {ol.proj.ProjectionLike} projection Projection. - * @property {string|undefined} string String. - * @proprtty {string|undefined} url URL. + * @property {ol.proj.ProjectionLike} reprojectTo Re-project to. + * @property {string|undefined} text Text. + * @property {string|undefined} url URL. */ /** diff --git a/src/ol/source/geojsonsource.exports b/src/ol/source/geojsonsource.exports new file mode 100644 index 0000000000..abf4c9f35e --- /dev/null +++ b/src/ol/source/geojsonsource.exports @@ -0,0 +1 @@ +@exportClass ol.source.GeoJSON ol.source.GeoJSONOptions diff --git a/src/ol/source/geojsonsource.js b/src/ol/source/geojsonsource.js new file mode 100644 index 0000000000..5e0613faa3 --- /dev/null +++ b/src/ol/source/geojsonsource.js @@ -0,0 +1,32 @@ +goog.provide('ol.source.GeoJSON'); + +goog.require('ol.format.GeoJSON'); +goog.require('ol.source.VectorFile'); + + + +/** + * @constructor + * @extends {ol.source.VectorFile} + * @param {ol.source.GeoJSONOptions=} opt_options Options. + */ +ol.source.GeoJSON = function(opt_options) { + + var options = goog.isDef(opt_options) ? opt_options : {}; + + goog.base(this, { + attributions: options.attributions, + extent: options.extent, + format: new ol.format.GeoJSON({ + defaultProjection: options.defaultProjection + }), + logo: options.logo, + object: options.object, + projection: options.projection, + reprojectTo: options.reprojectTo, + text: options.text, + url: options.url + }); + +}; +goog.inherits(ol.source.GeoJSON, ol.source.VectorFile);