Hello folks. First of all good work.
I'm trying to use a tile layer, without success.
First of all, this is my model:
@python_2_unicode_compatible
class UF(models.Model):
"""
Unidades Federativas (Estados) do Brasil
"""
id_ibge = models.IntegerField(primary_key=True)
uf = models.CharField(max_length=2)
nome = models.CharField(max_length=20)
regiao = models.CharField(max_length=20)
if MUNICIPIOS_GEO:
geom = models.MultiPolygonField(srid=SRID, null=True, blank=True)
objects = models.GeoManager()
def __str__(self):
return self.nome
The geometry is in 4674 SRID (I know for know it's not supported, but I can't even get a response from server - I've even created a view in PostgreSQL, transforming this to 900913 and mapping this as model, without success).
There are my url patterns:
# coding: utf-8
from django.conf.urls import patterns, include, url
from djgeojson.views import GeoJSONLayerView, TiledGeoJSONLayerView
from municipios.models import UF
urlpatterns = patterns("",
url(r'^uf/(?P<z>\d+)/(?P<x>\d+)/(?P<y>\d+).geojson$', TiledGeoJSONLayerView.as_view(model=UF, properties=["uf", "nome"]), name="uf")
)
Django is giving me following traceback:
ValueError at /geojson/uf/5/11/17.geojson
need more than 0 values to unpack
I hunted down the view, and the first line of the get_queryset method used this line of code:
self.z, self.x, self.y = map(int, self.args[:3])
What happens is that in this specific case, the z, x and y are no arguments, they are kwarguments. I did a little testing on this, replacing the map call by manually extracting all the values from the kwargs. It got passed, but i started getting erros like:
"Cannot resolve keyword 'intersection' into field. Choices are: geom, id_ibge, municipio, nome, regiao, uf"
This traces down to the trim option. I manually overrode it to be False.
Then I got: 'unicode' object has no attribute 'iterator' - this call seems to be made inside dispatch. After that dispatch, something got wrong in "handle reverse relationship".
I just did this to try trcking the error down and it seems to be related to the already created bug. I even explicited the necessary fields, and they DO NOT include a reverse field.
So, can you guys help me?