Skip to main content

Lightweight Python bindings for the TG geometry library

Reason this release was yanked:

Unstable?

Project description

ToGo

Python bindings for TG (Geometry library for C - Fast point-in-polygon)

ToGo is a high-performance Python library for computational geometry, providing a Cython wrapper around the above-mentioned C library.

The main goal is to offer a Pythonic, object-oriented, fast and memory-efficient library for geometric operations, including spatial predicates, format conversions, and spatial indexing.

While ToGo's API interfaces are still a work in progress, the underling C library is stable and well-tested.

Installation

pip install togo

Features

  • Fast and efficient geometric operations
  • Support for standard geometry types: Point, Line, Ring, Polygon, and their multi-variants
  • Geometric predicates: contains, intersects, covers, touches, etc.
  • Format conversion between WKT, GeoJSON, WKB, and HEX
  • Spatial indexing for accelerated queries
  • Memory-efficient C implementation with Python-friendly interface

Basic Usage

from togo import Geometry, Point, Ring, Poly

# Create a geometry from GeoJSON
geom = Geometry('{"type":"Point","coordinates":[1.0,2.0]}')

# Create a point
point = Point(1.0, 2.0)

# Create a polygon
ring = Ring([(0,0), (10,0), (10,10), (0,10), (0,0)])
polygon = Poly(ring)

# Convert to various formats
wkt = polygon.as_geometry().to_wkt()
geojson = polygon.as_geometry().to_geojson()

# Perform spatial predicates
point_geom = point.as_geometry()
contains = polygon.as_geometry().contains(point_geom)

Core Classes

Geometry

The base class that wraps tg_geom structures and provides core operations:

# Create from various formats
g1 = Geometry('POINT(1 2)', fmt='wkt')
g2 = Geometry('{"type":"Point","coordinates":[1,2]}', fmt='geojson')

# Geometric predicates
g1.intersects(g2)
g1.contains(g2)
g1.within(g2)

# Format conversion
g1.to_wkt()
g1.to_geojson()

Point, Line, Ring, Poly

Building blocks for constructing geometries:

# Create a point
p = Point(1.0, 2.0)

# Create a line
line = Line([(0,0), (1,1), (2,2)])

# Create a ring (closed line)
ring = Ring([(0,0), (10,0), (10,10), (0,10), (0,0)])

# Create a polygon with holes
exterior = Ring([(0,0), (10,0), (10,10), (0,10), (0,0)])
hole = Ring([(2,2), (8,2), (8,8), (2,8), (2,2)])
poly = Poly(exterior, [hole])

MultiGeometries

Creating collections of geometries:

# Create a MultiPoint
multi_point = Geometry.from_multipoint([(0,0), (1,1), Point(2,2)])

# Create a MultiLineString
multi_line = Geometry.from_multilinestring([
    [(0,0), (1,1)],
    Line([(2,2), (3,3)])
])

# Create a MultiPolygon
poly1 = Poly(Ring([(0,0), (1,0), (1,1), (0,1), (0,0)]))
poly2 = Poly(Ring([(2,2), (3,2), (3,3), (2,3), (2,2)]))
multi_poly = Geometry.from_multipolygon([poly1, poly2])

Polygon Indexing

Togo supports different polygon indexing strategies for optimized spatial operations:

from togo import TGIndex, set_polygon_indexing_mode

# Set the indexing mode
set_polygon_indexing_mode(TGIndex.NATURAL)  # or NONE, YSTRIPES

Performance Considerations

  • Togo is optimized for speed and memory efficiency
  • For large datasets, proper indexing can significantly improve performance
  • Creating geometries with the appropriate format avoids unnecessary conversions

Soon there will be a full API documentation, for now please refer to the test suite for more usage examples.

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

togo-0.1.1.tar.gz (247.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

togo-0.1.1-cp314-cp314t-musllinux_1_2_x86_64.whl (906.9 kB view details)

Uploaded CPython 3.14tmusllinux: musl 1.2+ x86-64

togo-0.1.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (936.0 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

togo-0.1.1-cp314-cp314-musllinux_1_2_x86_64.whl (923.4 kB view details)

Uploaded CPython 3.14musllinux: musl 1.2+ x86-64

togo-0.1.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (943.0 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

togo-0.1.1-cp313-cp313-musllinux_1_2_x86_64.whl (927.6 kB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

togo-0.1.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (949.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

togo-0.1.1-cp312-cp312-musllinux_1_2_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

togo-0.1.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (940.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

togo-0.1.1-cp311-cp311-musllinux_1_2_x86_64.whl (916.4 kB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

togo-0.1.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (940.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

togo-0.1.1-cp310-cp310-musllinux_1_2_x86_64.whl (887.3 kB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

togo-0.1.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (909.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

togo-0.1.1-cp39-cp39-musllinux_1_2_x86_64.whl (885.0 kB view details)

Uploaded CPython 3.9musllinux: musl 1.2+ x86-64

togo-0.1.1-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (907.5 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

togo-0.1.1-cp38-cp38-musllinux_1_2_x86_64.whl (912.4 kB view details)

Uploaded CPython 3.8musllinux: musl 1.2+ x86-64

togo-0.1.1-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (934.4 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

File details

Details for the file togo-0.1.1.tar.gz.

File metadata

  • Download URL: togo-0.1.1.tar.gz
  • Upload date:
  • Size: 247.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for togo-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5d05861d9e6c88c4a17f3d1138a9f371de0ce236dca71790eae450790f757b22
MD5 13a5c64dfdcc406d85d3c1af31c1bb3b
BLAKE2b-256 f8413bc2deff3a62507647f3db6b4624705ab7c15d9ad0b97ae977db1cb4a921

See more details on using hashes here.

Provenance

The following attestation bundles were made for togo-0.1.1.tar.gz:

Publisher: build-wheels.yml on mindflayer/togo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file togo-0.1.1-cp314-cp314t-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for togo-0.1.1-cp314-cp314t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ca3cdd327f60697b35a983b460416e11d70127a3afc8c9c0e5f85d887a56fe6d
MD5 de72fbd44cfc89b9b40f1dcaa65d69e5
BLAKE2b-256 a322ab434f21b46889bbab244c297b84ec2801c8d18683b97fbdf05ab1a5447e

See more details on using hashes here.

Provenance

The following attestation bundles were made for togo-0.1.1-cp314-cp314t-musllinux_1_2_x86_64.whl:

Publisher: build-wheels.yml on mindflayer/togo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file togo-0.1.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for togo-0.1.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8896e7e2ad3791cee1a7bd1246cb6577f03ddac047b02598184d449fba886729
MD5 bd13895ec52db40219e97bb84f126302
BLAKE2b-256 3dcdae1ec30cf70b2d7737b42cb8f675268fe8ab60556254343adb1349172d4c

See more details on using hashes here.

Provenance

The following attestation bundles were made for togo-0.1.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build-wheels.yml on mindflayer/togo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file togo-0.1.1-cp314-cp314-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for togo-0.1.1-cp314-cp314-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 4362447e7e6e3a253977a7b6a7fbbad9cc9dcf3bbdd6c5a65b8ad8b61770f9fb
MD5 00ab0bfaac1474a8b9931038d6b4a033
BLAKE2b-256 cd20f73ac33dbf370306c4b23bc5fc819d23976616877563b9814a088d9522bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for togo-0.1.1-cp314-cp314-musllinux_1_2_x86_64.whl:

Publisher: build-wheels.yml on mindflayer/togo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file togo-0.1.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for togo-0.1.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e2b61b5df96851e8b2bbe193b2d0f1c59768306759f7aaa0e12cedfbb3008ff8
MD5 ca0563a6e970642aa5c8e5b349eafc6a
BLAKE2b-256 2ccb4e2e1216b7ddc85a6d561ffa0a65ec81581652272b9528da330f5652c4ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for togo-0.1.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build-wheels.yml on mindflayer/togo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file togo-0.1.1-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for togo-0.1.1-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 25abc44a962bf30ee9dce6d5a2bb3e15516a58424ef47125a578dc6e9b075c10
MD5 126047ffd2d1cc93cb1cf05b6bd42898
BLAKE2b-256 c3fbc78015c245536457d1e01fc6c1d650962dc195de05acde43ff7878df0fa2

See more details on using hashes here.

Provenance

The following attestation bundles were made for togo-0.1.1-cp313-cp313-musllinux_1_2_x86_64.whl:

Publisher: build-wheels.yml on mindflayer/togo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file togo-0.1.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for togo-0.1.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bf958c688204a0d265d067eab9cbf759c89afeda107497c14a3a3ba01ca1917b
MD5 514ebade631c89e9eab168ffd7ec967d
BLAKE2b-256 d904f1f5839574ac90b7c42747756662b71fbedc935671f080cceed18916895f

See more details on using hashes here.

Provenance

The following attestation bundles were made for togo-0.1.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build-wheels.yml on mindflayer/togo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file togo-0.1.1-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for togo-0.1.1-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d6fedd68c56087d2f91325d17d56965b78a00d3553288aba608de07a2025dc40
MD5 83687c59a2bff34b364d71bf9e787d23
BLAKE2b-256 3c08662a8db95b04c9c6f36fdf723a5d589a64a7c4cc8896f2be702475e4c62a

See more details on using hashes here.

Provenance

The following attestation bundles were made for togo-0.1.1-cp312-cp312-musllinux_1_2_x86_64.whl:

Publisher: build-wheels.yml on mindflayer/togo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file togo-0.1.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for togo-0.1.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e151b81044f104c211b8c26ef985249a1cf83405317a0035c6f4c23312982ff3
MD5 d1e97a642c32ad93af89f5af00329fcb
BLAKE2b-256 9220b188154315975ff54e9d68f0eed6d06251252fe6bb4febe8bead5e1031f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for togo-0.1.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build-wheels.yml on mindflayer/togo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file togo-0.1.1-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for togo-0.1.1-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 665605e62b9e7c25e5b9a4d1804a58a30bd3dff780aae8839ce2bf7217ab4669
MD5 ba06ee8287526149d54ffbc541b877c6
BLAKE2b-256 1e0d4a6e6b00db1407156720697adbf54fb91a21d3650a4c4fd8fb706d4d0e68

See more details on using hashes here.

Provenance

The following attestation bundles were made for togo-0.1.1-cp311-cp311-musllinux_1_2_x86_64.whl:

Publisher: build-wheels.yml on mindflayer/togo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file togo-0.1.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for togo-0.1.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 21de10d7794f54de5ba699b37b5d96612fc1929ab82928e76e8155b26b45e0cb
MD5 0b95426ec52c75072759d5a0a2480104
BLAKE2b-256 bcf95c00a418e1ce126603d3e324f03104097226c9e9a6ecdddd87f14d6ca9d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for togo-0.1.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build-wheels.yml on mindflayer/togo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file togo-0.1.1-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for togo-0.1.1-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 54db23ee7ce5c843b950f79c9a7200a169a336d7258e3b179ad6ba080d1dbf78
MD5 21490a96910d77d035bad6c492cde776
BLAKE2b-256 01f6bcd0e05f5c55095f214d22c938541820d735ecee045a067e44ffea87b418

See more details on using hashes here.

Provenance

The following attestation bundles were made for togo-0.1.1-cp310-cp310-musllinux_1_2_x86_64.whl:

Publisher: build-wheels.yml on mindflayer/togo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file togo-0.1.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for togo-0.1.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9c3b3add3b420d7347df2518f5156f837002f1c8f002006ce78fdbacae2eb2b0
MD5 3d61536b41503b3a794451e373e876ca
BLAKE2b-256 23fdbad1f17692691d11f2c37e2739d8a647e5696e8aa6b8e1024051664949eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for togo-0.1.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build-wheels.yml on mindflayer/togo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file togo-0.1.1-cp39-cp39-musllinux_1_2_x86_64.whl.

File metadata

  • Download URL: togo-0.1.1-cp39-cp39-musllinux_1_2_x86_64.whl
  • Upload date:
  • Size: 885.0 kB
  • Tags: CPython 3.9, musllinux: musl 1.2+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for togo-0.1.1-cp39-cp39-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 dad0ecce1b6ee9f90246393cae8dcaac8036acaa904b9e3ae7b93ff0796932ff
MD5 db2a3d0eea946ce04604be560b44b68c
BLAKE2b-256 f972eacae1490bfc84befe8a02bbc54ca8bac829ec13143fa538969d162b17d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for togo-0.1.1-cp39-cp39-musllinux_1_2_x86_64.whl:

Publisher: build-wheels.yml on mindflayer/togo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file togo-0.1.1-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for togo-0.1.1-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f1fd65842e1a28d329f04d10ac44e1a1de9c3b28ac60a2cce23c053cefa2e754
MD5 cbb30f8565e017fe4eaf8e4c35d2071b
BLAKE2b-256 f7113b8ad1fac54f781f516b836c293833d93cd9d5cfd379d3cec1cbe82ceeec

See more details on using hashes here.

Provenance

The following attestation bundles were made for togo-0.1.1-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build-wheels.yml on mindflayer/togo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file togo-0.1.1-cp38-cp38-musllinux_1_2_x86_64.whl.

File metadata

  • Download URL: togo-0.1.1-cp38-cp38-musllinux_1_2_x86_64.whl
  • Upload date:
  • Size: 912.4 kB
  • Tags: CPython 3.8, musllinux: musl 1.2+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for togo-0.1.1-cp38-cp38-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 92f037dad4ab9240966996967451598eca22c5e3b70ed243075877f89bb1db8b
MD5 a9ee434ce2cd690ac6d0eb3afe97d5f6
BLAKE2b-256 6e21a962b1cd499a2d85707a5203c6230c0e056e44dc95e99a2539985e9aba2d

See more details on using hashes here.

Provenance

The following attestation bundles were made for togo-0.1.1-cp38-cp38-musllinux_1_2_x86_64.whl:

Publisher: build-wheels.yml on mindflayer/togo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file togo-0.1.1-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for togo-0.1.1-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 938f0d117076db83ad54ad215c9da171ada5e25492319548f85b77ed8765baa9
MD5 e488bbd847487afd21c7f6b8d3b76e2e
BLAKE2b-256 4c5480540e5e36a97356a196edfa719d649b94af0fe0ea74839a8912770ddec8

See more details on using hashes here.

Provenance

The following attestation bundles were made for togo-0.1.1-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build-wheels.yml on mindflayer/togo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page