After many hours searching, experimenting and crying, I found a formula for projecting the points onto a sphere so I could create the globe.
But my map data was not perfect, and I wantted a more realistic globe image. So I downloaded some image data from NASA at https://visibleearth.nasa.gov/. There Blue Marble collection of images was perfect for my needs.
Daytime Globe View |
Night Map View |
Using my limited experiance and skills of 3D and PowerBI visual development, I was able to create a PowerBI Cutom Visual with a much more realisitic look and feel. Points can be plotted by latitude and longitude, or a country can be highlighted by name, ISO2 or ISO3.
private projectAsMap(long: number, lat: number, r: number): THREE.Vector3 {
let z = long / 180.0;
let y = lat / 180.0;
return new THREE.Vector3(r, -y, -z);
}
private projectAsGlobe(long: number, lat: number, r: number): THREE.Vector3 {
let s = -long * (Math.PI / 180);
let t = (lat + 90) * (Math.PI / 180);
let x = r * Math.cos(s) * Math.sin(t);
let z = r * Math.sin(s) * Math.sin(t);
let y = r * Math.cos(t);
return new THREE.Vector3(x, y, z);
}
No comments:
Post a Comment