Closed Afourcat closed 3 years ago
Could you share us where did you get 5185147391319244000
? I tested with golang implementation and it give a same result with rust one. @Afourcat
Golang code
package main
import (
"fmt"
"github.com/golang/geo/s2"
)
func main() {
var lat = 44.910730699999995
var lng = 4.8773971
var ll = s2.LatLngFromDegrees(lat, lng)
var cell = s2.CellFromLatLng(ll)
var cellid = cell.ID()
fmt.Printf("ll=%v, cellid=%v, pos=%v", ll, cellid, cellid.Pos())
}
output
ll=[44.9107307, 4.8773971], cellid=2/033322223000221013310003322331, pos=573461372891856251
Rust version
use s2::cellid::CellID;
use s2::latlng::LatLng;
use s2::s1::angle::*;
fn main() {
let lat = 44.910730699999995;
let lon = 4.8773971;
let cellid = CellID::from(LatLng::new(Angle::from(Deg(lat)), Angle::from(Deg(lon))));
let ll = LatLng::from(&cellid);
println!("ll={:?}, cellid={:?}, pos={:?}", ll, cellid, cellid.pos());
}
output
ll=[44.9107307, 4.8773971], cellid=2/033322223000221013310003322331, pos=573461372891856251
Hey, Thank you for your work. We are iterating through France's
Nodes
and we think the following callCellID::from(LatLng...))
failed!with
Gave us the position
573461372891856251
instead of5185147391319244000
.Have you any idea? Maybe we are using it the wrong way. Thank you again.