Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#9745 closed (fixed)

Add support of PostGIS's SnapToGrid function

Reported by: norn Owned by: jbronn
Component: GIS Version: dev
Severity: Keywords: postgis
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

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 (2)

snaptogrid.diff (1.6 KB ) - added by norn 16 years ago.
SnapToGrid support patch against django-1.0.2-final
snaptogrid_corrected.diff (3.0 KB ) - added by jbronn 16 years ago.
SVN diff of user-provided patch

Download all attachments as: .zip

Change History (10)

by norn, 16 years ago

Attachment: snaptogrid.diff added

SnapToGrid support patch against django-1.0.2-final

by jbronn, 16 years ago

Attachment: snaptogrid_corrected.diff added

SVN diff of user-provided patch

comment:1 by jbronn, 16 years ago

Needs tests: set
Owner: changed from nobody to jbronn
Status: newassigned

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.

comment:2 by norn, 16 years ago

'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.

comment:3 by (none), 16 years ago

milestone: post-1.0

Milestone post-1.0 deleted

comment:4 by Jacob, 16 years ago

Triage Stage: UnreviewedAccepted

comment:5 by jbronn, 16 years ago

milestone: 1.1

comment:6 by jbronn, 16 years ago

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

comment:7 by jbronn, 16 years ago

Resolution: fixed
Status: assignedclosed

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

comment:8 by Jacob, 13 years ago

milestone: 1.1

Milestone 1.1 deleted

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