Convert Lat/Long to XY?

   3987   1   0
User Avatar
Member
16 posts
Joined: 5月 2015
Offline
Hi,
I have been watching a tutorial of Stefan Sietzen which is great by the way and trying to copy what he does.He converts Lat/Long data to xyz coordinates on a sphere with this formula:

float x = cos(radians(@lat)) * cos(radians(@long)) * 2;
float y = cos(radians(@lat)) * sin(radians(@long)) * 2;
float z = sin(radians(@lat)) * 2;

@P = set(x,y,z);

I try to achieve this effect on a flat map .I uvproject the points and connected $MAPU, and $MAPV to position and it looks looks like this.I can`t offset the projection and America part is divided from wrong place.Any idea how to use Lat/Long
data to project points on a 2D plane.I am new to houdini and I am sorry if it is very basic question.

Thanks in advance
mustafa

Attachments:
LatLong.jpg (420.2 KB)

User Avatar
Member
7815 posts
Joined: 9月 2011
Offline
Lat long data is already on a 2D plane. What exactly are you trying to do? If you have point data with the attributes, “lat” and “long”, skip the spherical transformation, and assign the values to @P. Then apply some scale to go from degrees to your desired range.
If you want to change where the ‘seam’ appears, rotate the values (add to longitude).
// begin attribute wrangle code
float x,y;
x = cos(radians(@long+chf('rotate')));
y = sin(radians(@long+chf('rotate')));
@long = degrees(atan2(y,x));
@P = set(@long,@lat,0);
@P *= 1.0/360; // divide by 360 to make image 1 unit wide and 0.5 units high
Edited by jsmack - 2017年6月10日 01:18:22

Attachments:
latlong_world.zip (700.0 KB)

  • Quick Links