Exposes Postgres geometry types into Django model's fields. This package doesn't need any extra PostgreSQL extensions to be installed, it uses just the built-in geometry types.
Install the package with:
pip install git+https://github.com/expobrain/django-postgres-geometry
This packages provides the following type of fields:
PointField
a single point in the planeSegmentField
a two-points segmentSegmentPathField
a path defined by two or more pointsPolygonField
a self closing polygon defined by two or more points; the first and last point must be equalBoxField
a box defined by te upper-right and lower-left corners ins this; the box can be defined by any pair of corners but on retrieve the box will be always re-calculated as upper-right and lower-left cornersCircleField
a circle defined by a center and a radius
All fields returns Point
instances except for CircleField
which return a
Circle
instance.
The fields acts like a common Django's field with the same set of arguments and keywords. See the Django's model field reference.
To run the unit tests you need a PostgreSQL instance up and running on your
localhost. Update the settings_tests.py
file to accomodate your needs. The
tests can be run with:
python manage.py test --settings=settings_test
- implement
get_prep_lookup()
functions - do not require a PostgreSQL instance to run the unit tests
- extend the support of geometry types to other backends as well (SQLite, MySQL, etc.)
- Do not fail if database has PostGIS extensions
- fixed validator on PolygonField: minimum number of points for a polygon is 3 not 4
- Fixed Polygon field validation: a polygon must have a minimum of 3 points and removed check of last point is equal to the first point
- First release with all the PostgreSQL geometrics types implemented except the SQL filtering support