Giter Club home page Giter Club logo

django-geotag's Introduction

Django Geotag

A tagging application in the spirit of 'django-tagging'. It allows to tag any django model with any number of Geodjango geometry fields such as PointField, PolygonField, etc...

Installation

For now, just place the 'geotag' directory into your django project directory.

Configuration and Usage

Add 'geotag' to your INSTALLED_APPS.

Register your models with the geotag app to add any number of geometric field types to your models.

Example:

import geotag

class Building(models.Model):
    ...
geotag.register(Building)

class Antenna(models.Model):
    type = models.CharField(max_length=50)
geotag.register(Antenna, name='site')
geotag.register(Antenna, type='poly', name='service_area')

The only required argument for the 'geotag.register' function is the django model class.

The other arguments are 'type' and 'name'.

'type' can be any of the following, defaults to 'point':

  • 'point' for a PointField
  • 'multi_point' for a MultiPointField
  • 'poly' for a PolygonField
  • 'multi_poly for a MultiPolygonField

'name' will become the name of the attribute for the geometry field. Defaults to 'location'

Then in the django shell

>>>from django.contrib.gis.geos import Point, Polygon
>>>from models import Building, Antenna
>>>building = Building.objects.create()
>>>building.location

>>>building.location = Point(0,0)
<PointLocation: SRID=4326;POINT (0.0000000000000000 0.0000000000000000)>
>>>antenna = Antenna.objects.create()
>>>antenna.site = Point(0,0)
<PointLocation: SRID=4326;POINT (0.0000000000000000 0.0000000000000000)>
>>>antenna.service_area = Polygon(((0,0),(0,10),(10,10),(0,10),(0,0)))
<PolyLocation: SRID=4326;POLYGON ((0.0000000000000000 0.0000000000000000, 0.0000000000000000 10.0000000000000000, 10.0000000000000000 10.0000000000000000, 0.0000000000000000 10.0000000000000000, 0.0000000000000000 0.0000000000000000))>

To Do

  • TESTS!
  • Admin interface
  • setuptools packaging

django-geotag's People

Contributors

juancferrer avatar

Stargazers

 avatar Roman Mindlin avatar  avatar Colin Powell avatar David Paccoud avatar Matías Agustín Méndez avatar Christian Salamea avatar

Watchers

 avatar

django-geotag's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.