Question by
dtylman · May 02, 2018 at 06:36 AM ·
positioningmapscalculationsbending
Positioning a point on a bended Mercator world map
I have created a bended 3d view holding a world map based on Mercator projection, as follows:
I want to a script to place the blue marble in the right place, using lat & long coordinates. I have used the following function to try to convert to Mercator, but my map is on a bended mesh (50 degrees) and I don't really know how to transform the x,y coordinates and how to computer the z coordinate.
// Project a geographic coordinate on the (spherical) Mercator map.
// Using the mean between major an minor axis here ("PTV standard").
// You could also use the major axis 6378137 ("Google standard").
public Vector3 LatLonToSphereMercator(float xradius, float yradius, float latitude, float longitude)
{
float x = xradius * longitude * Mathf.PI / 180;
float y = yradius * Mathf.Log(Mathf.Tan(Mathf.PI / 4 + latitude * Mathf.PI / 360));
return new Vector3 (x, y, 0);
}
What would be the best way to achieve this? Thanks in advance!
map.gif
(116.3 kB)
Comment