Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Convert longitude & latitude to layer coordinates postions

  • Convert longitude & latitude to layer coordinates postions

    Posted by Nabeel Khalid on January 30, 2018 at 2:06 pm

    Hi,
    I don’t know where to start with this but i need to convert real longitude & latitude coordinates to map them on a map layer in after effects. The Long and lat coordinates will be changed via a CSV file so they need to dynamic. The canvas is 1920×1080. Is there any easy way of converting coordinates via expressions?

    Thanks
    Nabeel

    Nabeel Khalid replied 8 years, 7 months ago 2 Members · 4 Replies
  • 4 Replies
  • Kevin Camp

    January 31, 2018 at 12:16 am

    this would change depending on where you have your international date line… but assuming the date line is on the left edge of the screen and 90 degrees N is at the top edge of the screen and -90 is at the bottom edge, I think this would work:

    lat = 47 ; // enter latitude value
    lon = -122 ; // enter longitude value
    y = linear( lat, -90, 90, 1080, 0 ) ;
    x = linear( lon, -180, 180, 0, 1920 ) ;
    [ x, y ]

    i haven’t written an expression to load data from an external file, but it can be done. search this forum for terms like “load data csv”, then use that to fill the lat and lon values.

    Kevin Camp
    Art Director
    KCPQ, KZJO & KRCW

  • Kevin Camp

    January 31, 2018 at 12:27 am

    this would depend on the projection of the map…

    Kevin Camp
    Art Director
    KCPQ, KZJO & KRCW

  • Kevin Camp

    January 31, 2018 at 12:56 am

    here’s a link to a map with the projection that would work for that expression:
    https://www.1worldglobes.com/images/custom/inflatable/basic_world_map_lg.jpg

    if you take that into a 1080 comp and fit it to the comp (layer>transform>fit to comp). then add a null and copy/paste that expression in the null’s position, it should line up pretty well with the map. in my sample expression, the values were for Seattle, and that seems to be pretty accurate, and i tested a few others.

    Kevin Camp
    Art Director
    KCPQ, KZJO & KRCW

  • Nabeel Khalid

    January 31, 2018 at 1:46 pm

    Thanks Kevin,

    I ended up using the expression below. I modified the source.
    Thank you for your help

    Nabeel

    eval("var state=" + footage("map.json").sourceText);

    latitude = location[0]. latitude;
    longitude = location[0]. longitude;

    y = linear( latitude, -90, 90, 1080, 0 ) ;
    x = linear( longitude, -180, 180, 0, 1920 ) ;
    [ x, y ]

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy