Re: [Django] #10594: distance(geom) results ambiguous when the PointField can be null

2009-06-17 Thread Django
#10594: distance(geom) results ambiguous when the PointField can be null
-+--
  Reporter:  whiteinge   | Owner:  nobody   
Status:  new | Milestone:   
 Component:  GIS |   Version:  SVN  
Resolution:  |  Keywords:  distance queryset
 Stage:  Unreviewed  | Has_patch:  1
Needs_docs:  0   |   Needs_tests:  0
Needs_better_patch:  0   |  
-+--
Changes (by yourcelf):

  * needs_better_patch:  => 0
  * has_patch:  0 => 1
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 The problem seems to arise from line 49 in django/contrib/gis/measure.py
 {{{
 if not isinstance(value, float): value = float(value)
 }}}

 Where "value" is the value of the geometry field.  If the field is null,
 this becomes None, and propagates a ValueError up the stack resulting in
 an empty queryset.

 I'm attaching a patch which fixes this by altering the method which
 constructs geometry objects out of the measurement attributes to instead
 keep the attribute as "None" if the value is None.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Django] #10594: distance(geom) results ambiguous when the PointField can be null

2009-03-23 Thread Django
#10594: distance(geom) results ambiguous when the PointField can be null
---+
 Reporter:  whiteinge  |   Owner:  nobody
   Status:  new|   Milestone:
Component:  GIS| Version:  SVN   
 Keywords:  distance queryset  |   Stage:  Unreviewed
Has_patch:  0  |  
---+
 Given the following GIS model:

 {{{
 class SomeModel(models.Model):
 location = models.PointField(null=True)
 
 }}}

 When populated with instances that both have and do not have location
 information, doing a {{{distance(geom)}}} query yields unexpected results.

 For example, {{{SomeModel.objects.distance(somePoint)}}} returns no
 results at all.
 {{{SomeModel.objects.filter(location__isnull=False).distance(somePoint)}}}
 works as expected.

 IMO, {{{distance(geom)}}} results that cannot calculate distance should
 simply return None.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---