-
Notifications
You must be signed in to change notification settings - Fork 7
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
Research on usage of google::s2 #236
Comments
My notes about Google S2
|
Draft logic(based on C++):
template <class Distance, class Data>
inline std::vector<typename S2ClosestPointQueryBase<Distance, Data>::Result>
S2ClosestPointQueryBase<Distance, Data>::FindClosestPoints(
Target* target, const Options& options) {
std::vector<Result> results;
FindClosestPoints(target, options, &results);
return results;
} |
The
|
Before start Original Draft Estimation (03182020)
Detail Analysis with Go-geo (03192020)Cell operation
c := CellFromLatLng(LatLngFromDegrees(test.lat, test.lng))
// code from go/geo/cellid.go
// Level returns the subdivision level of this cell ID, in the range [0, maxLevel].
func (ci CellID) Level() int {
return maxLevel - findLSBSetNonZero64(uint64(ci))>>1
}
// Parent returns the cell at the given level, which must be no greater than the current level.
func (ci CellID) Parent(level int) CellID {
lsb := lsbForLevel(level)
return CellID((uint64(ci) & -lsb) | lsb)
} Will write code as currLevel := c.Level()
for i := currLevel; i <= pre_defined_maxLevel; --i {
cellid = c.Parent(i)
dict[ceillid] = // append station id into slice
} Covering operation// code from go/geo
// Covering returns a CellUnion that covers the given region and satisfies the various restrictions.
func (rc *RegionCoverer) Covering(region Region) CellUnion {
covering := rc.CellUnion(region)
covering.Denormalize(maxInt(0, minInt(maxLevel, rc.MinLevel)), maxInt(1, minInt(3, rc.LevelMod)))
return covering
} Will write code like rc := &s2.RegionCoverer{MaxLevel: 30, MaxCells: 500}
r := s2.Region(CapFromCenterArea(center, area))
covering := rc.Covering(r) |
If new |
Agree. Thanks for the suggestion. |
Play with https://github.com/google/s2geometryopenssl
|
We plan to experience to use google::s2 to build spatial index for charge stations. For more context, please go to: #231
The target we want to achieve is:
The text was updated successfully, but these errors were encountered: