Open ycflame opened 9 years ago
To calculate distance from points in degrees, you can use pyproj. https://code.google.com/p/pyproj/
In this library, the function that search geohexes within a circle is not implemented. Shapely might help to find such geohexes. https://github.com/Toblerity/Shapely
@pemugi I wonder if I can just use x and y to find all points within a fixed distance in a specific level.
Let a point's coordinates be (x, y) in level 11. Since the size of hex can be calculated by calcHexSize(11) , we can know how to map distance between coordinates to real length in meters, and let it be m for 1 km. At last, we can know those points no more than 1 km from that point, because their x and y are no more than m from that point.
Am I correct on this?
@ycflame I think that the method you provided is correct. However the calculation cost of that method might be high, because if the distance is great, the program have to test a large number of hexagon's vertices. Before the distance is calculated from the point to hex's vertices, maybe you should make a short list of hexagons using Spatia lndex, Envelope and something like that. cf. http://en.wikipedia.org/wiki/Spatial_database#Spatial_index
Hello, Before I survey about relation between GeoHex's size and distance. I'm not good at English, so I can't tell you in English, but I write about it in Japanese.
http://qiita.com/kochizufan/items/6c0f39638eee52f43c98
Here is the topic, so please read it with automatic translator or so, if you want.
Let's say we have a pair of x and y, how do I find hexagons no more than 1km away from it?