Code

Opened 10 months ago

Closed 9 months 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

Description

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 10 months ago.
documentation.diff (1008 bytes) - added by facciocose 10 months ago.
updated method documentation

Download all attachments as: .zip

Change History (11)

Changed 10 months ago by simon29

comment:1 Changed 10 months 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 10 months ago by facciocose

updated method documentation

comment:2 Changed 10 months ago by facciocose

  • Needs documentation unset

comment:3 Changed 10 months ago by anonymous

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

comment:4 Changed 10 months ago by claudep

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

comment:5 Changed 10 months 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 10 months 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 9 months 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 9 months ago by simon29

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

comment:9 Changed 9 months ago by charettes

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

You're welcome!

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.