Skip to content

syk1k/django-geolocation-fields

Repository files navigation

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

Important note

The PolygonField is not working yet, so beware

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
    from django.db import models
    
    class MyModels(models.Model):
        # Some fields  
        field_name = fields.PointField(verbose_name='field_name')
        # Some fields
  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

About

A django package to manipulate Geo data without a Geo-Spatial Database. Example https://github.com/syk1k/django-geolocation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages