Skip to main content

GeoJSON ToolKit

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

Metadata

Release files for gjtk 3.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gjtk 3.0.0
File Size Uploaded Provenance
gjtk-3.0.0.tar.gz 23.7 kB Without provenance Details

Release files / gjtk-3.0.0.tar.gz

Download URL gjtk-3.0.0.tar.gz
Size 23.7 kB
Tags Source
SHA-256 checksum
How to use checksums
89303ea23f31530cc6bc3ddbbb16c51f5f45cb0c3879ad8a0151e0515feb7251
BLAKE2b-256 checksum
How to use checksums
c5c0229ea90fea074de6e624e2f4801849b0a1596e72039a06d9a06fd18393a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for gjtk 3.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

3.0.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page