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
Release history Release notifications | RSS feed
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.2.tar.gz
(8.6 kB
view hashes)
Built Distribution
Close
Hashes for pypika_gis-1.2.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef35eb925444333ad61fcb952b32b788552c6bda201231277ca48a622c5751bf |
|
MD5 | 9ee26a98bd005eb3caa0ebc5263621e6 |
|
BLAKE2b-256 | dba5792e543e084fb83a19e89e62edf0db683060bf8bfcf64ad139e3ad72463d |