Read and write GeoJSON.
Inherits from
NAME | DESCRIPTION |
---|---|
ZOO.Format.GeoJSON | Create a new parser for GeoJSON. |
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 ZOO.Feature. |
parseGeometry | Convert a geometry object from GeoJSON into an ZOO.Geometry. |
NAME | DESCRIPTION |
---|---|
parseCoords | Object with properties corresponding to the GeoJSON geometry types. |
NAME | DESCRIPTION |
---|---|
parseCoords.point | Convert a coordinate array from GeoJSON into an ZOO.Geometry.Point. |
parseCoords.multipoint | Convert a coordinate array from GeoJSON into an ZOO.Geometry.MultiPoint. |
parseCoords.linestring | Convert a coordinate array from GeoJSON into an ZOO.Geometry.LineString. |
parseCoords.multilinestring | Convert a coordinate array from GeoJSON into an ZOO.Geometry.MultiLineString. |
parseCoords.polygon | Convert a coordinate array from GeoJSON into an ZOO.Geometry.Polygon. |
parseCoords.multipolygon | Convert a coordinate array from GeoJSON into an ZOO.Geometry.MultiPolygon. |
parseCoords.box | Convert a coordinate array from GeoJSON into an ZOO.Geometry.Polygon. |
write | Serialize a feature, geometry, array of features into a GeoJSON string. |
createCRSObject | Create the CRS object for an object. |
NAME | DESCRIPTION |
---|---|
extract | Object with properties corresponding to the GeoJSON types. |
NAME | DESCRIPTION |
---|---|
extract.feature | Return a partial GeoJSON object representing a single feature. |
extract.geometry | Return a GeoJSON object representing a single geometry. |
extract.point | Return an array of coordinates from a point. |
extract.multipoint | Return an array of coordinates from a multipoint. |
extract.linestring | Return an array of coordinate arrays from a linestring. |
extract.multilinestring | Return an array of linestring arrays from a linestring. |
extract.polygon | Return an array of linear ring arrays from a polygon. |
extract.multipolygon | Return an array of polygon arrays from a multipolygon. |
extract.collection | Return an array of geometries from a geometry collection. |
Functions
Create a new parser for GeoJSON.
Parameters
options {Object} An optional object whose properties will be set on this instance.
read: function(json,type,filter)
Deserialize a GeoJSON string.
Parameters
Returns
{Object} The return depends on the value of the type argument. If type is “FeatureCollection” (the default), the return will be an array of ZOO.Feature. If type is “Geometry”, the input json must represent a single geometry, and the return will be an ZOO.Geometry. If type is “Feature”, the input json must represent a single feature, and the return will be an ZOO.Feature.
isValidType: function(obj,type)
Check if a GeoJSON object is a valid representative of the given type.
Returns
{Boolean} The object is valid GeoJSON object of the given type.
parseFeature: function(obj)
Convert a feature object from GeoJSON into a ZOO.Feature.
Parameters
obj {Object} An object created from a GeoJSON object
Returns
{ZOO.Feature} A feature.
parseGeometry: function(obj)
Convert a geometry object from GeoJSON into a ZOO.Geometry.
Parameters
obj {Object} An object created from a GeoJSON object
Returns
{ZOO.Geometry} A geometry.
parseCoords Properties
parseCoords Functions
Convert a coordinate array from GeoJSON into a ZOO.Geometry.Point.
Parameters
array {Object} The coordinates array from the GeoJSON fragment.
Returns
{ZOO.Geometry.Point} A geometry.
Convert a coordinate array from GeoJSON into a ZOO.Geometry.MultiPoint.
Parameters
array {Object} The coordinates array from the GeoJSON fragment.
Returns
{ZOO.Geometry.MultiPoint} A geometry.
Convert a coordinate array from GeoJSON into a ZOO.Geometry.LineString.
Parameters
array {Object} The coordinates array from the GeoJSON fragment.
Returns
{ZOO.Geometry.LineString} A geometry.
Convert a coordinate array from GeoJSON into a ZOO.Geometry.MultiLineString.
Parameters
array {Object} The coordinates array from the GeoJSON fragment.
Returns
{ZOO.Geometry.MultiLineString} A geometry.
Convert a coordinate array from GeoJSON into a ZOO.Geometry.Polygon.
Parameters
array {Object} The coordinates array from the GeoJSON fragment.
Returns
{ZOO.Geometry.Polygon} A geometry.
Convert a coordinate array from GeoJSON into a ZOO.Geometry.MultiPolygon.
Parameters
array {Object} The coordinates array from the GeoJSON fragment.
Returns
{ZOO.Geometry.MultiPolygon} A geometry.
Convert a coordinate array from GeoJSON into a ZOO.Geometry.Polygon.
Parameters
array {Object} The coordinates array from the GeoJSON fragment.
Returns
{ZOO.Geometry.Polygon} A geometry.
write: function(obj,pretty)
Serialize a feature, geometry, array of features into a GeoJSON string.
Parameters
Returns
{String} The GeoJSON string representation of the input geometry, features, or array of features.
createCRSObject: function(object)
Create the CRS object for an object.
Parameters
object {ZOO.Feature}
Returns
{Object} An object which can be assigned to the crs property of a GeoJSON object.
extract Properties
extract Functions
Return a partial GeoJSON object representing a single feature.
Parameters
feature {ZOO.Feature}
Returns
{Object} An object representing the point.
Return a GeoJSON object representing a single geometry.
Parameters
geometry {ZOO.Geometry}
Returns
{Object} An object representing the geometry.
Return an array of coordinates from a point.
Parameters
point {ZOO.Geometry.Point}
Returns
{Array} An array of coordinates representing the point.
Return an array of coordinates from a multipoint.
Parameters
multipoint {ZOO.Geometry.MultiPoint}
Returns
{Array} An array of point coordinate arrays representing the multipoint.
Return an array of coordinate arrays from a linestring.
Parameters
linestring {ZOO.Geometry.LineString}
Returns
{Array} An array of coordinate arrays representing the linestring.
Return an array of linestring arrays from a linestring.
Parameters
multilinestring {ZOO.Geometry.MultiLineString}
Returns
{Array} An array of linestring arrays representing the multilinestring.
Return an array of linear ring arrays from a polygon.
Parameters
polygon {ZOO.Geometry.Polygon}
Returns
{Array} An array of linear ring arrays representing the polygon.
Return an array of polygon arrays from a multipolygon.
Parameters
multipolygon {ZOO.Geometry.MultiPolygon}
Returns
{Array} An array of polygon arrays representing the multipolygon
Return an array of geometries from a geometry collection.
Parameters
collection {ZOO.Geometry.Collection}
Returns
{Array} An array of geometry objects representing the geometry collection.