S2

s2sphere Python Module Lat and Long Precision Convert a latitude and longitude from their integer forms (we prefer integers to floating points because the latter results in too large a loss of precision) to a level 30 cell ID. This conversion will result in a loss of precision by a few centimeters. lat = 37791541 lng = -122390014 cellid = s2sphere.CellId.from_lat_lng(s2sphere.LatLng.from_degrees(lat/1e6,lng/1e6)) print(f"LatLong: {cellid.to_lat_lng()}") LatLong: LatLng: 37.79154098519877,-122.39001395963571 The average size of a level 30 S2 cell is 0....

May 9, 2020 · 3 min · Boy Plankton