# 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 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.

##### 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;`

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

Edited by f1480187
##### 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 on other sites

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

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.

##### 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

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×