Opened 3 years ago

Closed 3 years ago

#21096 closed New feature (invalid)

Allow setting of 'distance' attribute name

Reported by: simon29 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 simon29 3 years ago.
documentation.diff (1008 bytes) - added by facciocose 3 years ago.
updated method documentation

Download all attachments as: .zip

Change History (11)

Changed 3 years ago by simon29

comment:1 Changed 3 years ago by claudep

  • Needs documentation set
  • Needs tests set
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Uncategorized to New feature
  • Version changed from 1.5 to master

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

Changed 3 years ago by facciocose

updated method documentation

comment:2 Changed 3 years ago by facciocose

  • 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 claudep

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

comment:5 Changed 3 years ago by susan

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 charettes

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 claudep

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 simon29

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

comment:9 Changed 3 years ago by charettes

  • Resolution set to invalid
  • Status changed from new to closed

You're welcome!

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