-
Notifications
You must be signed in to change notification settings - Fork 374
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
Region and Subregion model have no Geometry (area|location) - no way to query distance #183
Comments
Hi, thank you for reporting this, but this problem is actually much more complex than it might seem at a glance. If you would like to have a point that represents a region or a subregion: where exactly do you want that point to be? The centroid of the region/subregion? What if that point is someplace far away from any city or sign of civilization? The capital of the region/subregion? Some places have multiple capitals - which one do I pick? If you're trying to find the distance between two regions/subregions: which points do you want to use? The distance between the centroids? That wouldn't ever really be accurate. The distance between the closest points on each region/subregion? That also wouldn't ever be accurate. The distance between the farthest points on each region/subregion? Also wouldn't ever be accurate. Really, representing an entire area as a point is the fundamental problem. I probably won't ever implement that for something as large as a region/subregion. There's simply no reasonable and generic way to represent an area as a point. So lets talk about areas (or "boundaries" in GIS terminology). I would absolutely love to add boundaries to all of the models in the app! However, there isn't really a single good source for that data. Specifically I would like a single source that is:
Furthermore, there is already a PR that attempts to implement this: #159. Closing, because this is a duplicate of that. Please dig through the previously reported issues and pull requests before opening a new one. |
This also duplicates issue #125. |
Oh OK I see.
I didn't realise that this problem had already been considered in another
issue.
I guess in my case I could just take any city that belongs to a region and
use that's location. I don't need a super accurate distance, as I only need
the distance for sorting as a one off task.
Also because I am running this query on a relatively small dataset (around
100) I can manually correct any results where needs be.
I will have to keep an eye on the project to implement boundaries.
Thanks!
…On 17 Nov 2017 06:59, "blag" ***@***.***> wrote:
Hi, thank you for reporting this, but this problem is actually much more
complex than it might seem at a glance.
If you would like to have a point that represents a region or a subregion:
where exactly do you want that point to be? The centroid of the
region/subregion? What if that point is someplace far away from any city or
sign of civilization? The capital of the region/subregion? Some places have
multiple capitals - which one do I pick?
If you're trying to find the distance between two regions/subregions:
which points do you want to use? The distance between the centroids? That
wouldn't ever really be accurate. The distance between the closest points
on each region/subregion? That also wouldn't ever be accurate. The distance
between the farthest points on each region/subregion? Also wouldn't ever be
accurate.
Really, representing an entire area as a point is the fundamental problem.
I probably won't ever implement that for something as large as a
region/subregion. There's simply no reasonable and generic way to represent
an area as a point.
So lets talk about areas (or "boundaries" in GIS terminology). I would
absolutely *love* to add boundaries to all of the models in the app!
However, there isn't really a single good source for that data.
Specifically I would like a single source that is:
- international - only the US has very good maps (put out by the USGS
- thank you!), the rest of the world has no good maps
- accurate - I would like accurate sources
- legally friendly - the terms and conditions for using some maps
preclude them from use in this project - some sources may require payment,
even to download or use a sample, or they may require the use of closed
source or expensive software to use
- consistent - one single file format
Furthermore, there is already a PR that attempts to implement this: #159
<#159>.
Closing, because this is a duplicate of that. Please dig through the
previously reported issues and pull requests before opening a new one.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#183 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA0bcvPARDBp_EdNkHWyjT3cAbzhsgkdks5s3S61gaJpZM4Qey4V>
.
|
Checklist
master
branch of django-cities.result = Region.objects.all().annotate(dist=Distance('location', start_place.location)).exclude(id=start_place.id).filter(name='Scotland').order_by('-dist')
or
```result = Region.objects.all().annotate(dist=Distance('location', start_place.location)).exclude(id=start_place.id).filter(name='Scotland').order_by('-dist')`
Expected behavior
To return the distance from Scotland region
Actual behavior
Following errors:
The text was updated successfully, but these errors were encountered: