Jump to content
duveil

LAT/LONG to planar map?

Recommended Posts

Hi

First of all sorry for my english.It is my second language .My question is I have been following a tutorial of  Stefan Sietzen .he convert the lat/long data on a sphere with this formula 

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

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

 

I tried to project it into 2D plane and connect $MAPU, $MAPV data to $P .But my map is divided from wrong place.The part America supposed to be divided in the middle.My question is is there any better way to convert lat/long data into point position on a 2D map.

Any help is appreciated.Thanks in advance.

LatLong.jpg

Share this post


Link to post
Share on other sites

You could offset and wrap longitude (or any value in -180..180 range) like this:

longitude = (longitude + 180 + offset) % 360 - 180;

wrap_longitude.hipnc

Your lat-long conversion setup goes after that operation and can stay unmodified.

Edited by f1480187

Share this post


Link to post
Share on other sites

Thank you f1480187I am grateful for your answer. But clearly I am not as good as you think I am.I tried to put this wrangle before lat/long conversion.Also after conversion.But I guess I missed sth. here.And probably sth. very basic.I tried a couple of ways and still nothing.Do you mind showing this on scene file.Here is my scene.

 

LongLat_Test_027.rar

Edited by duveil
wrongNaming

Share this post


Link to post
Share on other sites

Sure, you need to modify some existing longitude variable you interested in. In your case it is @long point attribute.

longitude_offset.hipnc

By the way, because of the method you use to convert sphere to plane, you could simply rotate sphere around Y axis in transform1 node, it will do same job.

  • Like 1

Share this post


Link to post
Share on other sites

I think I owe you a beer sir.I mean if you ever be around istanbul just call me to collect your beer.Thanks a lot.I will work hard 

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×