#10380: gdal Envelope should allow min_x == max_x and/or min_y == max_y
----------------------------------+-----------------------------------------
 Reporter:  psmith                |       Owner:  nobody    
   Status:  new                   |   Milestone:            
Component:  GIS                   |     Version:  1.0       
 Keywords:  envelope extent gdal  |       Stage:  Unreviewed
Has_patch:  0                     |  
----------------------------------+-----------------------------------------
 When initializing a new {{{django.contrib.gis.gdal.Envelope}}} object, an
 {{{OGRException}}} is raised if the {{{min_x}}} value is less than or
 equal to {{{max_x}}}, and if the {{{min_y}}} value is less than or equal
 to {{{max_y}}}. It would be better if the exception was raised on in the
 case that {{{min_x}}} was greater than {{{max_x}}} and/or if {{{min_y}}}
 greater than {{{max_y}}}.

 The reason that it is often useful to create an {{{Envelope}}} from a
 point initially, say from the extent of a
 {{{django.contrib.gis.geos.Point}}} object, where the {{{min_x}}} and
 {{{min_y}}} will equal the {{{max_x}}} and {{{max_y}}}, respectively. For
 example, to find the extent of a set or list of points, it is convenient
 to iterate over the collection, creating the Envelope initially with the
 first point from the iteration, then expanding it with each successive
 point. (Perhaps using the {{{expand_to_include}}} method proposed in
 #10368.)

 Example:
 {{{
 >>> from django.contrib.gis.geos import Point
 >>> from django.contrib.gis.gdal import Envelope
 >>> env = None
 >>> for pt in [Point(5, 10), Point(-1, 3), Point(9, -2)]:
 ...     if env is None:
 ...         env = Envelope(pt.extent)
 ...     else:
 ...         env.expand_to_include(pt.extent)
 >>> env.tuple
 (-1, -2, 9, 10)
 }}}

 Making this change should have no impact on the semantics of the
 {{{Envelope}}} class: indeed, the {{{OGREnvelope}}} class in
 {{{ogr_core.h}}} from which it is derived does not enforce or check for
 the ordering of the min and max values.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/10380>
Django <http://code.djangoproject.com/>
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to