The tuple for the fields option is missing the 'point' field
{{{
from django.core.serializers import serialize
from my_app.models import City
serialize('geojson', City.objects.all(),
geometry_field='point',
fields=('name', 'point'))
}}}
If you use the example without the 'point' in the fields tuple the
returning geometry property is null
{{{
{
'type': 'FeatureCollection',
'crs': {
'type': 'name',
'properties': {'name': 'EPSG:4326'}
},
'features': [
{
'type': 'Feature',
'geometry': null,
'properties': {
'name': 'Chicago'
}
}
]
}
}}}
I think there should be a test-case in
https://github.com/django/django/blob/master/tests/gis_tests/geoapp/test_serializers.py
with a call to serialize used with both parameters (geometry_field and
fields)
--
Ticket URL: <https://code.djangoproject.com/ticket/26138>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => assigned
* needs_better_patch: => 0
* needs_tests: => 0
* owner: nobody => claudep
* needs_docs: => 0
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/26138#comment:1>
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/6043 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/26138#comment:2>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/26138#comment:3>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"54236a2c1cda4666c164c7edbfb4396e2b01604a" 54236a2]:
{{{
#!CommitTicketReference repository=""
revision="54236a2c1cda4666c164c7edbfb4396e2b01604a"
Fixed #26138 -- Ensured geometry_field's geometry is always serialized
Thanks Bernd Schlapsi for the report.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26138#comment:4>
Comment (by Claude Paroz <claude@…>):
In [changeset:"ca6ab72bb76fefac0188b95e60320466cc8d7610" ca6ab72b]:
{{{
#!CommitTicketReference repository=""
revision="ca6ab72bb76fefac0188b95e60320466cc8d7610"
[1.9.x] Fixed #26138 -- Ensured geometry_field's geometry is always
serialized
Thanks Bernd Schlapsi for the report.
Backport of 54236a2c1c from master.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26138#comment:5>