django-geolocation-fields

A Django app to work with geolocation fields without a spatial database.


License
MIT
Install
pip install django-geolocation-fields==0.1.8

Documentation

django-geolocation-fields

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

Status

Build Status

Quick start

$ pip install django-geolocation-fields

The project is still in development

Here is an example that uses it https://github.com/syk1k/django-geolocation

  1. Add "geolocation_fields" to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        #...
        'geolocation_fields',
    ]
  2. Add a PointField to a model:

    from geolocation_fields.models import fields
    field_name = fields.PointField(verbose_name='field_name')
  3. 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,
    }
    
    

Screenshots

  1. With the input field displayed

with_input

  1. Without input field

without_input