NAME
Geo::JSON - Perl OO interface for geojson
VERSION
version 0.002
SYNOPSIS
use Geo::JSON;
my $obj = Geo::JSON->from_json( $json );
DESCRIPTION
Convert to and from geojson using Perl objects. GeoJSON objects represent various geographical positions - points, lines, polygons, etc.
Currently in development - feedback welcome.
Currently supports 2 or 3 dimensions (longitude, latitude, altitude). Further dimensions in positions are ignored for calculations and comparisons, but will be read-from and writen-to.
GEOJSON SPECIFICATION
See: http://www.geojson.org/geojson-spec.html
GEOJSON MEMBERS (ATTRIBUTES)
See the specification for the full details, but the basics are as follows:
type
Determines the object the json will be turned into
position
Not explicitly named in the json, but an array of at least two numbers representing a location in x, y, z order. (Either Easting, Northing, Altitude or Longitude, Latitude, Altitude as appropriate).
Additional numbers may be present but ignored by this package for calculations.
coordinates
Defined in geometry objects (Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon). Will consist of a single position (Point), an array of positions (MultiPoint, LineString), an array of arrays of positions (MultiLineString, Polygon) or an array of arrays of arrays of positions (MultiPolygon). The positions within a single object should all have the same number of axes and be in the same axis order.
bbox
Optional, defining a bounding box that the position(s) are contained by. FIXME define bbox
crs
Optional, defining the Co-ordinates Reference System the object is using. See Geo::JSON::CRS for more details.
OBJECTS
-
A single position
-
An array of positions, representing multiple points
-
An array of 2 or more positions, represening a connected line
-
An array of lines
-
An array of lines, defining a polygon. The first line represents the outside of the polygon, subsequent lines define any 'holes'. The lines must be 'linear rings' - 4 or more points, with the first and last points being equivalent.
-
An array of polygons
-
An array of any of the above Geometry objects (as attribute
geometries
) -
Any of the above objects (as attribute
feature
), together with a data structure (as attruibuteproperties
) -
An array of Feature objects (as attribute
features
)
METHODS
from_json
my $obj = Geo::JSON->from_json( $json );
Takes a geojson string, returns the object it represents.
SUPPORT
Bugs / Feature Requests
Please report any bugs or feature requests through the issue tracker at https://github.com/mjemmeson/geo-json/issues. You will be notified automatically of any progress on your issue.
Source Code
This is open source software. The code repository is available for public review and contribution under the terms of the license.
https://github.com/mjemmeson/geo-json
git clone git://github.com/mjemmeson/geo-json.git
AUTHOR
Michael Jemmeson <mjemmeson@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Michael Jemmeson <mjemmeson@cpan.org>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.