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.1.tar.gz
(8.6 kB
view hashes)
Built Distribution
Close
Hashes for pypika_gis-1.2.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52cc4f5e1390187be8c6c4cbf26bf4dfecf2f06926b4efcf10d068262dbe9b0d |
|
MD5 | 11a3bfdef41e2f4db413c52204c5e5c1 |
|
BLAKE2b-256 | 4570c3772232b918faa9771b395113f5b8f4781d2dfa5047adff20a1b4c2eab8 |