Skip to main content

GeoJSON ToolKit

Project description

gjtk is a library for working with GeoJSON. It aims to be as compliant with the specification (soon standard, hopefully) as possible.

Build Status PyPI Version

Installation

gjtk is available on PyPI.

pip install gjtk

Usage

import gjtk

Modules

gjtk.extract

Method

Description

positions_of(geojson)

returns all the Positions in a valid GeoJSON object

features_of(geojson)

returns all the Features in a valid GeoJSON object

geometries_of(geojson)

returns all the Geometries in a valid GeoJSON object

gjtk.generate

Method

Description

point(position)

returns a valid Point

multi_point(coordinates)

returns a valid MultiPoint

line_string(coordinates)

returns a valid LineString

multi_line_string(coordinates)

returns a valid MultiLineString

polygon(coordinates)

returns a valid Polygon

multi_polygon(coordinates)

returns a valid MultiPolygon

geometry_collection(geometries)

returns a valid GeometryCollection

feature(geometry, properties)

returns a valid Feature

feature_collection(features)

returns a valid FeatureCollection

gjtk.random

Method

Description

position(max_numbers=3, min_numbers=2)

returns a random Position

point_coordinates()

returns random Point coordinates

multi_point_coordinates(max_positions=6, min_positions=0)

returns random MultiPoint coordinates

line_string_coordinates(max_positions=6, min_positions=2)

returns random LineString coordinates

linear_ring_coordinates()

returns random LinearRing coordinates

multi_line_string_coordinates(max_line_strings=6, min_line_strings=1)

returns random MultiLineString coordinates

polygon_coordinates()

returns random Polygon coordinates

multi_polygon_coordinates(max_polygons=6, min_polygons=1)

returns random MultiPolygon coordinates

geometry()

returns a random Geometry

point()

returns a random Point

multi_point()

returns a random MultiPoint

line_string()

returns a random LineString

multi_line_string()

returns a random MultiLineString

polygon()

returns a random Polygon

multi_polygon()

returns a random MultiPolygon

geometry_collection(max_geometries=3, min_geometries=0)

returns a random GeometryCollection

feature()

returns a random Feature

feature_collection(max_features=3, min_features=0)

returns a random FeatureCollection

crs()

returns a random CRS

link()

returns a random Link

bbox(max_dimensions=4, min_dimensions=2)

returns a random Bbox

gjtk.validate

Method

Description

is_geojson(anything)

returns True when passed a valid GeoJSON object, otherwise False

is_geometry(anything)

returns True when passed a valid Geometry, otherwise False

is_position(anything)

returns True when passed a valid Position, otherwise False

is_point_coordinates(anything)

returns True when passed valid Point coordinates, otherwise False

is_multi_point_coordinates(anything)

returns True when passed valid MultiPoint coordinates, otherwise False

is_line_string_coordinates(anything)

returns True when passed valid LineString coordinates, otherwise False

is_linear_ring_coordinates(anything)

returns True when passed valid LinearRing coordinates, otherwise False

is_multi_line_string_coordinates(anything)

returns True when passed valid MultiLineString coordinates, otherwise False

is_polygon_coordinates(anything)

returns True when passed valid Polygon coordinates, otherwise False

is_multi_polygon_coordinates(anything)

returns True when passed valid MultiPolygon coordinates, otherwise False

is_point(anything)

returns True when passed a valid Point, otherwise False

is_multi_point(anything)

returns True when passed a valid MultiPoint, otherwise False

is_line_string(anything)

returns True when passed a valid LineString, otherwise False

is_multi_line_string(anything)

returns True when passed a valid MultiLineString, otherwise False

is_polygon(anything)

returns True when passed a valid Polygon, otherwise False

is_multi_polygon(anything)

returns True when passed a valid MultiPolygon, otherwise False

is_geometry_collection(anything)

returns True when passed a valid GeometryCollection, otherwise False

is_feature(anything)

returns True when passed a valid Feature, otherwise False

is_feature_collection(anything)

returns True when passed a valid Feature Collection, otherwise False

is_crs(anything)

returns True when passed a valid CRS, otherwise False

has_crs(anything)

returns True when passed a GeoJSON object that validly specifies a CRS, otherwise False

is_link(anything)

returns True when passed a valid Link, otherwise False

is_bbox(anything)

returns True when passed a valid Bbox, otherwise False

has_bbox(anything)

returns True when passed a GeoJSON object that validly specifies a Bbox, otherwise False

equal_positions(position1, position2)

returns True when all parameters are identical Positions, otherwise False

contained_polygon(innerLinearRing, outerLinearRing)

returns True when one LinearRing contains another, otherwise False

License

Copyright (C) 2016 David Tucker

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gjtk-3.0.0.tar.gz (23.7 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page