Closed kiddhustle closed 6 years ago
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" notifications@github.com 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 https://github.com/coderholic/django-cities/pull/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 https://github.com/coderholic/django-cities/issues/183#issuecomment-345161767, 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: