A Django app to facilitate the manipulation of Geolocation objects in a GeoDjango app without using a spatial database.
Detailed documentation is in the "docs" directory.
Stable version: django-geolocation-fields==0.1.8
Documentation: django-geolocation-fields
Licence: MIT
The PolygonField is not working yet, so beware
$ pip install django-geolocation-fields
The project is still in development
Here is an example that uses it https://github.com/syk1k/django-geolocation
-
Add "geolocation_fields" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [ #... 'geolocation_fields', ]
-
Add a PointField to a model:
from geolocation_fields.models import fields from django.db import models class MyModels(models.Model): # Some fields field_name = fields.PointField(verbose_name='field_name') # Some fields
-
Configurations To have more control over the package, you can canfigure it yourself
By default the PointField's widget only display the map, you can also chose to display the editable input field in the settings
GEOLOCATION_FIELDS = { 'display_input': True, # Display the input field. False to remove }
This version of the package integrate leaflet only. Here is the default configuration for the fields (PointField for the moment). The configurations uses leaflet Map options. Check the leafletJS doc here
GEOLOCATION_FIELDS = { "provider": "leaflet", # Two provider: Leaflet, Mapbox "center" : [0,0], "zoom": 12, 'display_input': False, }
- With the input field displayed
- Without input field