Opened 3 years ago

Closed 3 years ago

#21096 closed New feature (invalid)

Allow setting of 'distance' attribute name

Reported by: Simon Litchfield Owned by: nobody
Component: GIS Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: yes UI/UX: no


In a distance query, the attribute name is currently hardcoded at 'distance', which prevents the use of multiple distance measurements (used in routing etc).

Patch attached that accepts the name as an optional arg.

Attachments (2)

distance-name.diff (2.9 KB) - added by Simon Litchfield 3 years ago.
documentation.diff (1008 bytes) - added by Luca Marra 3 years ago.
updated method documentation

Download all attachments as: .zip

Change History (11)

Changed 3 years ago by Simon Litchfield

Attachment: distance-name.diff added

comment:1 Changed 3 years ago by Claude Paroz

Needs documentation: set
Needs tests: set
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted
Type: UncategorizedNew feature
Version: 1.5master

Thanks for the proposal. Could you please complete your patch with tests and documentation?

Changed 3 years ago by Luca Marra

Attachment: documentation.diff added

updated method documentation

comment:2 Changed 3 years ago by Luca Marra

Needs documentation: unset

comment:3 Changed 3 years ago by anonymous

I'm currently trying to add a test. I've been looking into the geos/tests/ file, where the test_distance() function is defined. Is this the correct file to add a test?

comment:4 Changed 3 years ago by Claude Paroz

No, the proper file to add a test in is django/contrib/gis/tests/distapp/

comment:5 Changed 3 years ago by Susan Tan

Thanks! In addition, I'm having trouble visualizing the use case for allowing the "distance" attribute to be a different name. What are some specific, concrete use cases?
Knowing the use cases can help me write tests; I'm currently still stumped on how to resolve this ticket in terms of test code logic.

comment:6 Changed 3 years ago by Simon Charette

Maybe I'm completely off the track here but isn't model_att perfectly suited for the OP's use case?

comment:7 Changed 3 years ago by Claude Paroz

I think that charettes is not off the track :-) Simon29, can you check if model_att is effectively filling your use case?

comment:8 Changed 3 years ago by Simon Litchfield

charettes you are right, I completely overlooked model_att. Thanks!

comment:9 Changed 3 years ago by Simon Charette

Resolution: invalid
Status: newclosed

You're welcome!

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