int count=0; double lat=55.8241; double lng=137.8347; double radius = 900; //半径 double capHeight = (2 * S2.M_PI) * (radius / 40075017); S2LatLng s2LatLng= S2LatLng.fromDegrees(lat, lng); S2Cap cap = S2Cap.fromAxisHeight(s2LatLng.toPoint(), capHeight * capHeight / 2); S2RegionCoverer s2RegionCoverer=new S2RegionCoverer(); s2RegionCoverer.setMinLevel(17); s2RegionCoverer.setMaxLevel(17); //s2RegionCoverer.setMaxCells(500); S2CellUnion s2CellUnion=s2RegionCoverer.getCovering(cap); for (S2CellId s2CellId : s2CellUnion.cellIds()) { S2LatLng s2LatLng1=s2CellId.toLatLng(); System.out.println("=回1==" + s2LatLng1.latDegrees() ); System.out.println("=回2==" + s2LatLng1.lngDegrees() ); System.out.println("================================================" ); count++; } System.out.println("=yyy==" + count ); S2LatLng startS2= S2LatLng.fromDegrees(55.8241, 137.8347); S2LatLng endS2= S2LatLng.fromDegrees(55.82183580084221 , 137.84616745746078 ); double dis = startS2.getEarthDistance(endS2); System.out.println("=xxxx==" + dis );
S2
最新推荐文章于 2024-04-17 09:33:58 发布