Django

Code

Ticket #9745 (closed: fixed)

Opened 1 year ago

Last modified 1 year ago

Add support of PostGIS's SnapToGrid function

Reported by: norn Assigned to: jbronn
Milestone: 1.1 Component: GIS
Version: SVN Keywords: postgis
Cc: Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 1 Patch needs improvement: 0

Description

I'd like to have support of SnapToGrid? function from PostGIS. I made patch and it works for me. I believe it is simple enough to be implemented in trunk.

Attachments

snaptogrid.diff (1.6 kB) - added by norn on 12/03/08 04:22:08.
SnapToGrid? support patch against django-1.0.2-final
snaptogrid_corrected.diff (3.0 kB) - added by jbronn on 12/03/08 11:53:51.
SVN diff of user-provided patch

Change History

12/03/08 04:22:08 changed by norn

  • attachment snaptogrid.diff added.

SnapToGrid? support patch against django-1.0.2-final

12/03/08 11:53:51 changed by jbronn

  • attachment snaptogrid_corrected.diff added.

SVN diff of user-provided patch

12/03/08 12:34:20 changed by jbronn

  • owner changed from nobody to jbronn.
  • needs_better_patch changed.
  • status changed from new to assigned.
  • needs_tests set to 1.
  • needs_docs changed.

I'm +1 on having this feature in GeoDjango. However, we'll have to talk about implementation details -- I see you have this done on the geometry in-place rather than attaching a new geometry on the GeoQuerySet (otherwise you could've just used the _geom_attribute method to simplify the implementation). I wonder if this option should be an option for all methods, e.g., GeoModel.objects.intersection(other, in_place=True).

Also, I'll need tests before including it trunk, but otherwise it's a very good start. Thanks for contributing.

12/03/08 23:06:30 changed by norn

'In place' method was chosen because I have a need of chaining snaptogrid after transform(). Also I am interested in filtering out records with empty geometry field after snapping, but I have no idea how to implement it in effective way (avoiding double calculation in SQL). I think your decision about in_place is quite useful and will allow building longer chains.

02/25/09 13:51:44 changed by

  • milestone deleted.

Milestone post-1.0 deleted

02/26/09 19:17:32 changed by jacob

  • stage changed from Unreviewed to Accepted.

03/09/09 18:36:35 changed by jbronn

  • milestone set to 1.1.

04/02/09 11:41:49 changed by jbronn

Now that values() and defer() work, there's really no need to do the in_place option anymore.

04/02/09 11:50:45 changed by jbronn

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [10369]) Fixed #9745 -- Added the GeoQuerySet methods snap_to_grid and geojson.


Add/Change #9745 (Add support of PostGIS's SnapToGrid function)




Change Properties
Action