-
Notifications
You must be signed in to change notification settings - Fork 4
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
Documentation about searches and calculations #4
Comments
Sorry for the late answer. I've had a very busy week. Yep. From the original doc:
So. for example: take a two 'level 2' zones
and accordingly, the distance between their centers will be equal to the size of one of the zone. Next. Zones have an [X,Y] coordinates. so using these parameters we can take the distance (in steps) between two zones with the simple equation: One thing that we will do to calculate the distance it's multiply size of the zone to count of steps. Programmatically, it will look something like this: import 'dart:math' as math;
import 'package:geohex/geohex.dart';
void main() {
final a = GeoHex.decode('XM488507762');
final b = GeoHex.decode('XM488531402');
final len = math.sqrt(math.pow(b.x - a.x, 2) + math.pow(b.y - a.y, 2));
print('${len * a.hexSize} 鯨尺');
}
So! it's an important thing. first time I've confused by result value, but after little investigating, I've able to this is could be old Japanese unit of measure named 鯨尺 (kujirajaku) And it looks like the right thing. |
Thanks for this information, very interesting. It could be useful but distance calculation with just coordinates is fast. I was wondering more about doing some fast geofencing: actually geofencing a point in a polygon is slow and expensive. Do you think that we could build a faster geofencing system out of these geohex objects? This might be related to the original doc: "You can search easily within flexible levels of zone size". How? I'm also interested by the another mysterious feature: "Single-query Searching": does this apply to more than just searching for one point's code? Sorry I'm curious: you made me discover that geo hex system with your lib and now I want to use it! |
it depends on how do you solve this.
From the original doc:
It means that geohex allows you to store some geo-related data as a simple key-value pair where the key is geohex code and value is some data. and search for some geo-related object data into the some area should be simple query by key. for example: I think just that, not anything else.
I'm very glad to hear it! |
Hi. I've made some experiments for geofencing. The test use case is to find in which country is a point. The idea: get level 0 grid of hexes, then prepare a dataset using geopandas in python to list the countries contained in each hex (from a geojson dataset for countries) and store this in a kvstore. Then when a user taps on the map it gets the hex and check what countries (and the stored polygons numbers as countries are multipolygons) to search for: if only one country is found the answer is instant, if more than one it will check the polygons with brute force to geofence. The thing is that I can not manage to get correct data. I am not sure of my hexes grid data: I made a script to get a grid but I am not sure of the method. So I would like to ask you how to get a clean grid of hexes for a level? |
The original library mentions that you can search "within flexible levels of zone size" and that you can do easy distance calculations but I did not find any documentation on how to do it.
Do you have more information about these features?
The text was updated successfully, but these errors were encountered: