Read and write GeoJSON. Create a new parser with the OpenLayers.Format.GeoJSON constructor.
OpenLayers.
|
Read and write GeoJSON. |
Properties | |
ignoreExtraDims | {Boolean} Ignore dimensions higher than 2 when reading geometry coordinates. |
Constructor | |
OpenLayers.
|
Create a new parser for GeoJSON. |
Functions | |
read | Deserialize a GeoJSON string. |
write | Serialize a feature, geometry, array of features into a GeoJSON string. |
read: function( json, type, filter )
Deserialize a GeoJSON string.
json | {String} A GeoJSON string |
type | {String} Optional string that determines the structure of the output. Supported values are “Geometry”, “Feature”, and “FeatureCollection”. If absent or null, a default of “FeatureCollection” is assumed. |
filter | {Function} A function which will be called for every key and value at every level of the final result. Each value will be replaced by the result of the filter function. This can be used to reform generic objects into instances of classes, or to transform date strings into Date objects. |
{Object} The return depends on the value of the type argument. If type is “FeatureCollection” (the default), the return will be an array of OpenLayers.Feature.Vector. If type is “Geometry”, the input json must represent a single geometry, and the return will be an OpenLayers.Geometry. If type is “Feature”, the input json must represent a single feature, and the return will be an OpenLayers.Feature.Vector.
write: function( obj, pretty )
Serialize a feature, geometry, array of features into a GeoJSON string.
obj | {Object} An OpenLayers.Feature.Vector, OpenLayers.Geometry, or an array of features. |
pretty | {Boolean} Structure the output with newlines and indentation. Default is false. |
{String} The GeoJSON string representation of the input geometry, features, or array of features.
Deserialize a GeoJSON string.
read: function( json, type, filter )
Serialize a feature, geometry, array of features into a GeoJSON string.
write: function( obj, pretty )