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/
Release files for django-sld 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-sld-1.0.4.tar.gz | 8.4 kB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_sld-1.0.4-py2.7.egg | Legacy Egg format | - | - | Details |
| django_sld-1.0.4-py2.6.egg | Legacy Egg format | - | - | Details |
Total release size: 51.6 kB
Release files / django-sld-1.0.4.tar.gz
| Download URL | django-sld-1.0.4.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
356f75d463f3fff299f8924c45b5794ee4771e6d19cf95f8ec8740b9def87189
|
|
BLAKE2b-256 checksum How to use checksums |
e8ef2611a58ede5d20183b73b6191e14c815bea55d2fc1c99fd44f02529441d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / django_sld-1.0.4-py2.7.egg
| Download URL | django_sld-1.0.4-py2.7.egg |
|---|---|
| Size | 21.6 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
cbdd4f6f668da7598cfd8a33f6844526d8f2f488bb6b23cc3b8f623e7e767083
|
|
BLAKE2b-256 checksum How to use checksums |
cc7fc6aa95a8f93bba37e92a7c201d648c7144684f830bccc7ac7a2d89b6518d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / django_sld-1.0.4-py2.6.egg
| Download URL | django_sld-1.0.4-py2.6.egg |
|---|---|
| Size | 21.6 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
a49028ebf96b6e7ae460e63a7b1bbeb0633d2dc82a4504c8a5e7d1603bd63ec5
|
|
BLAKE2b-256 checksum How to use checksums |
18619f39d44959f9b2d106a8e1f4509d48400185d5409d4f6c98bca5d2ce36f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |