Read and write GeoJSON. Create a new parser with the ALKMaps.Format.GeoJSON constructor.
ALKMaps. | Read and write GeoJSON. |
Properties | |
ignoreExtraDims | {Boolean} Ignore dimensions higher than 2 when reading geometry coordinates. |
Constructor | |
ALKMaps. | Create a new parser for GeoJSON. |
Functions | |
read | Deserialize a GeoJSON string. |
isValidType | Check if a GeoJSON object is a valid representative of the given type. |
parseFeature | Convert a feature object from GeoJSON into an ALKMaps.Feature.Vector. |
parseGeometry | Convert a geometry object from GeoJSON into an ALKMaps.Geometry. |
Properties | |
parseCoords | Object with properties corresponding to the GeoJSON geometry types. |
Functions | |
parseCoords. | Convert a coordinate array from GeoJSON into an ALKMaps.Geometry. |
parseCoords. | Convert a coordinate array from GeoJSON into an ALKMaps.Geometry. |
parseCoords. | Convert a coordinate array from GeoJSON into an ALKMaps.Geometry. |
parseCoords. | Convert a coordinate array from GeoJSON into an ALKMaps.Geometry. |
parseCoords. | Convert a coordinate array from GeoJSON into an ALKMaps.Geometry. |
parseCoords. | Convert a coordinate array from GeoJSON into an ALKMaps.Geometry. |
parseCoords.box | Convert a coordinate array from GeoJSON into an ALKMaps.Geometry. |
write | Serialize a feature, geometry, array of features into a GeoJSON string. |
createCRSObject | Create the CRS object for an object. |
Properties | |
extract | Object with properties corresponding to the GeoJSON types. |
Functions | |
extract. | Return a partial GeoJSON object representing a single feature. |
extract. | Return a GeoJSON object representing a single geometry. |
extract. | Return an array of coordinates from a point. |
extract. | Return an array of point coordinates from a multipoint. |
extract. | Return an array of coordinate arrays from a linestring. |
extract. | Return an array of linestring arrays from a linestring. |
extract. | Return an array of linear ring arrays from a polygon. |
extract. | Return an array of polygon arrays from a multipolygon. |
extract. | Return an array of geometries from a geometry collection. |
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 ALKMaps.Feature.Vector. If type is “Geometry”, the input json must represent a single geometry, and the return will be an ALKMaps.Geometry. If type is “Feature”, the input json must represent a single feature, and the return will be an ALKMaps.Feature.Vector.
parseFeature: function( obj )
Convert a feature object from GeoJSON into an ALKMaps.Feature.Vector.
obj | {Object} An object created from a GeoJSON object |
{ALKMaps.Feature.Vector} A feature.
parseGeometry: function( obj )
Convert a geometry object from GeoJSON into an ALKMaps.Geometry.
obj | {Object} An object created from a GeoJSON object |
{ALKMaps.Geometry} A geometry.
Convert a coordinate array from GeoJSON into an ALKMaps.Geometry.
array | {Object} The coordinates array from the GeoJSON fragment. |
{ALKMaps.Geometry} A geometry.
Convert a coordinate array from GeoJSON into an ALKMaps.Geometry.
array | {Object} The coordinates array from the GeoJSON fragment. |
{ALKMaps.Geometry} A geometry.
Convert a coordinate array from GeoJSON into an ALKMaps.Geometry.
array | {Object} The coordinates array from the GeoJSON fragment. |
{ALKMaps.Geometry} A geometry.
Convert a coordinate array from GeoJSON into an ALKMaps.Geometry.
array | {Object} The coordinates array from the GeoJSON fragment. |
{ALKMaps.Geometry} A geometry.
Convert a coordinate array from GeoJSON into an ALKMaps.Geometry.
{ALKMaps.Geometry} A geometry.
Convert a coordinate array from GeoJSON into an ALKMaps.Geometry.
array | {Object} The coordinates array from the GeoJSON fragment. |
{ALKMaps.Geometry} A geometry.
Convert a coordinate array from GeoJSON into an ALKMaps.Geometry.
array | {Object} The coordinates array from the GeoJSON fragment. |
{ALKMaps.Geometry} A geometry.
write: function( obj, pretty )
Serialize a feature, geometry, array of features into a GeoJSON string.
obj | {Object} An ALKMaps.Feature.Vector, ALKMaps.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.
createCRSObject: function( object )
Create the CRS object for an object.
object | {ALKMaps.Feature.Vector} |
{Object} An object which can be assigned to the crs property of a GeoJSON object.
Return a partial GeoJSON object representing a single feature.
feature | {ALKMaps.Feature.Vector} |
{Object} An object representing the point.
Return a GeoJSON object representing a single geometry.
geometry | {ALKMaps.Geometry} |
{Object} An object representing the geometry.
Return an array of coordinates from a point.
point | {ALKMaps.Geometry.Point} |
{Array} An array of coordinates representing the point.
Return an array of point coordinates from a multipoint.
multipoint | {ALKMaps.Geometry.MultiPoint} |
{Array} An array of point coordinate arrays representing the multipoint.
Return an array of coordinate arrays from a linestring.
linestring | {ALKMaps.Geometry.LineString} |
{Array} An array of coordinate arrays representing the linestring.
Return an array of linestring arrays from a linestring.
multilinestring | {ALKMaps.Geometry.MultiLineString} |
{Array} An array of linestring arrays representing the multilinestring.
Return an array of linear ring arrays from a polygon.
polygon | {ALKMaps.Geometry.Polygon} |
{Array} An array of linear ring arrays representing the polygon.
Return an array of polygon arrays from a multipolygon.
multipolygon | {ALKMaps.Geometry.MultiPolygon} |
{Array} An array of polygon arrays representing the multipolygon
Return an array of geometries from a geometry collection.
collection | {ALKMaps.Geometry.Collection} |
{Array} An array of geometry objects representing the geometry collection.
Deserialize a GeoJSON string.
read: function( json, type, filter )
Check if a GeoJSON object is a valid representative of the given type.
isValidType: function( obj, type )
Convert a feature object from GeoJSON into an ALKMaps.Feature.Vector.
parseFeature: function( obj )
Convert a geometry object from GeoJSON into an ALKMaps.Geometry.
parseGeometry: function( obj )
Serialize a feature, geometry, array of features into a GeoJSON string.
write: function( obj, pretty )
Create the CRS object for an object.
createCRSObject: function( object )