Opened 15 years ago

Closed 15 years ago

#10368 closed (fixed)

Add expand_to_include method to gdal Envelope

Reported by: psmith Owned by: nobody
Component: GIS Version: 1.0
Severity: Keywords: envelope extent expand_to_include
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Mapnik has an Envelope class like that in django.contrib.gis.gdal.envelope that has an expand_to_include method we should steal. This is handy for building up an envelope by iterating over a collection of geometries -- at the end you have the extent / envelope of the collection.

>>> e = Envelope(pt_list[0])
>>> for pt in pt_list[1:]:
...     e.expand_to_include(pt)

or

>>> e = Envelope(geom_list[0].extent)
>>> for g in geom_list[1:]:
...     e.expand_to_include(g.extent)

Attachments (1)

gis_envelope_expand.diff (5.2 KB ) - added by psmith 15 years ago.
Patch to add expand_to_include to Envelope (with unit tests)

Download all attachments as: .zip

Change History (2)

by psmith, 15 years ago

Attachment: gis_envelope_expand.diff added

Patch to add expand_to_include to Envelope (with unit tests)

comment:1 by jbronn, 15 years ago

Resolution: fixed
Status: newclosed

(In [9985]) Maintenance refactor of the GDAL (OGR) ctypes interface. Changes include:

  • All C API method explictly called from their prototype module, no longer imported via *.
  • Applied DRY to C pointer management, classes that do so subclass from GDALBase.
  • OGRGeometry: Added from_bbox class method (patch from Christopher Schmidt) and kml property.
  • SpatialReference: Now initialize with SetFromUserInput (initialization is now more simple and flexible); removed duplicate methods.
  • Envelope: Added expand_to_include method and now allow same coordinates for lower left and upper right points. Thanks to Paul Smith for tickets and patches.
  • OGRGeomType: Now treat OGC 'Geometry' type as 'Unknown'.

Fixed #9855, #10368, #10380. Refs #9806.

Note: See TracTickets for help on using tickets.
Back to Top