Skip to main content

SpatialTypes functions for extend PyPika with GIS

Project description

pypika-gis

SpatialTypes functions for extend PyPika with GIS.

Install

pip install pypika-gis

Example

from pypika import Query
from pypika_gis import spatialtypes as st

query = Query.from_('field').select('id', st.AsGeoJSON('geom'))
print(str(query))
# SELECT "id",ST_AsGeoJSON('geom') FROM "field"

query = Query.from_('crop').select('id').where(st.Intersects('geom', st.SRID(st.MakePoint(10, 5), 4326)))
print(str(query))
# SELECT "id" FROM "crop" WHERE ST_Intersects('geom',ST_SRID(ST_MakePoint(10,5),4326))

Available functions

  • Envelope(ST_Envelope)
  • Extent(ST_Extent)
  • GeomFromGeoJSON(ST_GeomFromGeoJSON)
  • GeoHash(ST_GeoHash)
  • Intersection(ST_Intersection)
  • Intersects(ST_Intersects)
  • IsEmpty(ST_IsEmpty)
  • IsValid(ST_IsValid)
  • MakePoint(ST_MakePoint)
  • SetSRID(ST_SetSRID)
  • Within(ST_Within)
  • X(ST_X)
  • Y(ST_Y)
  • Z(ST_Z)

Development

Dependencies

Setup

poetry install

Tests

Full tests and coverage

poetry run pytest

Publish

poetry build
poetry publish

Credits

pypika-gis is based on PyPika. Check their page for further query buider instructions, examples and more details about PyPika core.

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

pypika-gis-1.2.1.tar.gz (8.6 kB view hashes)

Uploaded Source

Built Distribution

pypika_gis-1.2.1-py2.py3-none-any.whl (9.7 kB view hashes)

Uploaded Python 2 Python 3

Supported by

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