[Django] #26138: Example for GeoJSON Serializer don't work as described

2 views
Skip to first unread message

Django

unread,
Jan 26, 2016, 2:00:55 AM1/26/16
to django-...@googlegroups.com
#26138: Example for GeoJSON Serializer don't work as described
--------------------------------------+--------------------
Reporter: brot | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: GIS | Version: 1.9
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
The example in the documentation for GeoJSON Serializer don't work as
described.
https://docs.djangoproject.com/es/1.9/ref/contrib/gis/serializers/

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.

Django

unread,
Jan 26, 2016, 4:51:33 AM1/26/16
to django-...@googlegroups.com
#26138: Example for GeoJSON Serializer don't work as described
--------------------------------------+------------------------------------
Reporter: brot | Owner: claudep
Type: Cleanup/optimization | Status: assigned
Component: GIS | Version: 1.9
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by claudep):

* 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>

Django

unread,
Jan 26, 2016, 5:10:27 AM1/26/16
to django-...@googlegroups.com
#26138: Example for GeoJSON Serializer don't work as described
--------------------------------------+------------------------------------
Reporter: brot | Owner: claudep
Type: Cleanup/optimization | Status: assigned
Component: GIS | Version: 1.9

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by claudep):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/6043 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/26138#comment:2>

Django

unread,
Jan 26, 2016, 6:29:49 AM1/26/16
to django-...@googlegroups.com
#26138: GeoJSON Serializer doesn't include geometry_field if it's not in fields
-------------------------------------+-------------------------------------
Reporter: brot | Owner: claudep
Type: | Status: assigned
Cleanup/optimization |
Component: GIS | Version: 1.9
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/26138#comment:3>

Django

unread,
Jan 28, 2016, 2:52:02 AM1/28/16
to django-...@googlegroups.com
#26138: GeoJSON Serializer doesn't include geometry_field if it's not in fields
-------------------------------------+-------------------------------------
Reporter: brot | Owner: claudep
Type: | Status: closed
Cleanup/optimization |
Component: GIS | Version: 1.9
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz <claude@…>):

* 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>

Django

unread,
Jan 28, 2016, 2:53:06 AM1/28/16
to django-...@googlegroups.com
#26138: GeoJSON Serializer doesn't include geometry_field if it's not in fields
-------------------------------------+-------------------------------------
Reporter: brot | Owner: claudep
Type: | Status: closed
Cleanup/optimization |
Component: GIS | Version: 1.9

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

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>

Reply all
Reply to author
Forward
0 new messages