Last active
May 14, 2018 07:36
-
-
Save brianv0/85a96df2236d49927b7de6fde87ccfd4 to your computer and use it in GitHub Desktop.
s2 tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
latlng = pywraps2.S2LatLng_FromDegrees(24,42) | |
latlng2 = pywraps2.S2LatLng_FromDegrees(40,60) | |
latlng3 = pywraps2.S2LatLng_FromDegrees(26,46) | |
distance = latlng.GetDistance(latlng2) | |
# contains | |
Circle = pywraps2.S2Cap | |
circ_center = pywraps2.S2LatLng_FromDegrees(26,46).ToPoint() | |
circ_angle = pywraps2.S1Angle.Degrees(10) | |
circle = Circle(circ_center, circ_angle) | |
circle.Contains(latlng.ToPoint()) | |
circle.Contains(latlng2.ToPoint()) | |
Box = pywraps2.S2LatLngRect | |
box = Box(latlng, latlng2) | |
box_center = box.GetCenter() | |
size = pywraps2.S2LatLng_FromDegrees(16, 18) | |
box2 = Box.FromCenterSize(box_center, size) | |
box.Contains(box2) | |
box2.Contains(box) | |
box.GetSize().ToStringInDegrees() | |
box2.GetSize().ToStringInDegrees() | |
box2.GetCenter() == box.GetCenter() | |
box2.GetSize() == box.GetSize() |
Author
brianv0
commented
May 14, 2018
Notes:
Coverage:
S2RegionCoverer::Options options;
options.set_max_cells(5);
S2RegionCoverer coverer(options);
S2Cap cap(center, radius);
S2CellUnion covering = coverer.GetCovering(cap);
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment