llamadonica / dart-geohash Goto Github PK
View Code? Open in Web Editor NEWGeohashing library for dart
License: BSD 3-Clause "New" or "Revised" License
Geohashing library for dart
License: BSD 3-Clause "New" or "Revised" License
As a user of this lib, I want to be able to easily create a hash search query, so that I can query databases quickly and consistently.
Supporting info
Here's a discussion of how to make a list of hashes to perform a location based search
https://gis.stackexchange.com/questions/18330/using-geohash-for-proximity-searches
And an even older article
https://www.movable-type.co.uk/scripts/geohash.html
AC
String[] getHashesByRadius(lat, long, radius)
With respect to
static Rectangle<double> getExtents(String geohash)
the values calculated in the block below are correct.
final latitude = latitudeFloat * (180 / pow(2.0, 52)) - 90;
final longitude = longitudeFloat * (360 / pow(2.0, 52)) - 180;
final height = latitudeDiff * (180 / pow(2.0, 52));
final width = longitudeDiff * (360 / pow(2.0, 52));
However, the computed latitude
and longitude
represent the top left corner of the geohash block.
Therefore:
return Rectangle<double>(latitude + height, longitude, height, width);
should be:
return Rectangle<double>(longitude, latitude, width, height); // Rectangle params: Rectangle(this.left, this.top, T width, T height)
Moreover, while latitude decreases downward - this is the definition of bottom
for Rectangle
:
/// The y-coordinate of the bottom edge.
T get bottom => (top + height) as T;
Therefore, with respect to:
static Point<double> decode(String geohash)
The computations of the coordinates should be:
final x = extents.left + extents.width / 2;
final y = extents.bottom - extents.height / 2;
I have used x=longitude and y=latitude based on the commonly accepted mathematical approach of used x to represent the horizontal axis and y to represent the vertical axis. I recommend this is implemented. It may be a breaking change but the code isn't functional anyway.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.