A fork of expobrain/django-postgres-geometry where python requirements have been lowered to version 2.6
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/hugfimi/django-postgres-geometry
This packages provides the following type of fields:
PointFielda single point in the planeSegmentFielda two-points segmentSegmentPathFielda path defined by two or more pointsPolygonFielda self closing polygon defined by two or more points; the first and last point must be equalBoxFielda 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 cornersCircleFielda 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