Skip to main content

A simple django library that generates SLD documents from geographic models.

Project description

django-sld

A django library that generates SLD documents from geographic models.

Requirements

  • django Required for models and spatial fields.

  • python-sld Required for reading and generating SLD XML files.

  • pysal Required for classification algorithms.

To install these requirements, you may use pip to install these packages (except for django) with this command:

> sudo pip install -r requirements.txt

Installation

> easy_install django-sld

OR

> pip install django-sld

Usage

This library implements a single module named “generator” that contains all the methods of interacting with the classification algorithms. Assuming that you have a geographic model in geodjango, you may classify your distribution with by constructing a queryset, and feeding it to the generator.

Assuming you have a spatial model named MySpatialModel, with a data field of population, you can classify all your data into 10 quantile classes with:

from djsld import generator

qs = MySpatialModel.objects.all() sld = generator.as_quantiles(qs, ‘population’, 10)

You may also any queryset to generate classes, such as a filtered queryset:

qs = MySpatialModel.objects.filter(owner__name = ‘David’) sld = generator.as_quantiles(qs, ‘population’, 10)

If your spatial model has a different geometry column name other than ‘geom’, you may specify that field as the geofield keyword:

sld = generator.as_quantiles(qs, ‘population’, 10, geofield=’state’)

The data field may also be distantly related to the queryset in question. For this example, assume that MySpatialModel has a foreign key to a model named Route, and that the data value you would like to classify is a field of the Route model:

sld = generater.as_quantiles(qs, ‘route__traffic’, 10)

Support

If you have any problems, questions, or comments, please visit the django-sld project on github: https://github.com/azavea/django-sld/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-sld-1.0.4.tar.gz (8.4 kB view details)

Uploaded Source

Built Distributions

django_sld-1.0.4-py2.7.egg (21.6 kB view details)

Uploaded Egg

django_sld-1.0.4-py2.6.egg (21.6 kB view details)

Uploaded Egg

File details

Details for the file django-sld-1.0.4.tar.gz.

File metadata

  • Download URL: django-sld-1.0.4.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for django-sld-1.0.4.tar.gz
Algorithm Hash digest
SHA256 356f75d463f3fff299f8924c45b5794ee4771e6d19cf95f8ec8740b9def87189
MD5 8a73dab9e42c108491ce066bc6e7cb8b
BLAKE2b-256 e8ef2611a58ede5d20183b73b6191e14c815bea55d2fc1c99fd44f02529441d1

See more details on using hashes here.

File details

Details for the file django_sld-1.0.4-py2.7.egg.

File metadata

File hashes

Hashes for django_sld-1.0.4-py2.7.egg
Algorithm Hash digest
SHA256 cbdd4f6f668da7598cfd8a33f6844526d8f2f488bb6b23cc3b8f623e7e767083
MD5 6af27c9c5dfb0a832060910ee5f9c4a4
BLAKE2b-256 cc7fc6aa95a8f93bba37e92a7c201d648c7144684f830bccc7ac7a2d89b6518d

See more details on using hashes here.

File details

Details for the file django_sld-1.0.4-py2.6.egg.

File metadata

File hashes

Hashes for django_sld-1.0.4-py2.6.egg
Algorithm Hash digest
SHA256 a49028ebf96b6e7ae460e63a7b1bbeb0633d2dc82a4504c8a5e7d1603bd63ec5
MD5 c389f0b9c002eda5ebb1a1c3a0af98fc
BLAKE2b-256 18619f39d44959f9b2d106a8e1f4509d48400185d5409d4f6c98bca5d2ce36f6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page