Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider renaming field distance #11

Open
timrobertson100 opened this issue Sep 2, 2020 · 3 comments
Open

Consider renaming field distance #11

timrobertson100 opened this issue Sep 2, 2020 · 3 comments

Comments

@timrobertson100
Copy link
Member

timrobertson100 commented Sep 2, 2020

The geocode API [example call] returns a distance field, such as:

{
  "id": "CL",
  "type": "Political",
  "source": "http://www.naturalearthdata.com/", 
  "title": "Chile",
  "isoCountryCode2Digit": "CL",
  "distance": 0.022322887300003803
},

To improve the intuitiveness I suggest we rename the field to include the unit. I presume this is in kilometers so perhaps something along the lines of distanceInKM would be better?

@MattBlissett
Copy link
Member

It is in degrees, i.e. not 22 metres from the coast of Chile but very roughly 2½ km.

Did someone ask for this?

The distance field is meant to show whether the point is inside or outside the feature, and to order the features the point is outside. I would need to check again how accurate it is, especially nearer the poles, as it is using PostGIS's fast Cartesian geometry functions rather than the version with full topological accuracy: https://postgis.net/docs/ST_Distance.html

@timrobertson100
Copy link
Member Author

timrobertson100 commented Sep 2, 2020

Thanks for the explanation @MattBlissett

Did someone ask for this?

Not specifically - I was asked by someone using it what the unit was. Since I didn't know I made the suggestion since others will likely ask too.

distanceInDegrees might be appropriate or if we don't want people to use it other than for ranking results perhaps sortOrder or similar would avoid possible misuse (e.g. an inaccurate result at poles).

@tucotuco
Copy link

tucotuco commented Sep 2, 2020

Thanks for the explanation. Renaming it would be good, to avoid further questions if nothing else. Calculating actual distance would probably be way too slow for an API and the results would be even more likely to raise questions of accuracy due to shape (im)precision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants