Beispiel #1
0
func TestProjectESPG3857(t *testing.T) {
	latLng := geo.NewLatLng(
		32.720064477996,
		-117.16588899493217,
	)

	p := NewEspg3857().Project(latLng)

	if p.X != -13042847.101257065 || p.Y != 3858205.880090526 {
		t.Errorf("ESPG3857 project failed: %+v", p)
	}
}
Beispiel #2
0
func TestLatLngToPointESPG3857(t *testing.T) {
	latLng := geo.NewLatLng(
		32.720064477996,
		-117.16588899493217,
	)

	//	coordinate ref system
	crs := NewEspg3857()

	//	no scale
	p := LatLngToPoint(crs, latLng, 0.0)
	if p.X != 44.68203449249269 || p.Y != 103.35370445251465 {
		t.Errorf("espg3857 failed to convert latLng to point (scale of 0.0): %v", p)
	}

	//	convert to point with 2x scale
	p = LatLngToPoint(crs, latLng, 2.0)
	if p.X != 178.72813796997076 || p.Y != 413.4148178100586 {
		t.Errorf("espg3857 failed to convert latLng to point (scale of 2.0): %v", p)
	}
}