Jump to content

 
Photo

Convert WGS84 (lat long) -> Robinson (x,y)

- - - - -

  • Please log in to reply
17 replies to this topic

#16
Nick H

Nick H

    Legendary Contributor

  • Validated Member
  • PipPipPipPipPip
  • 307 posts
  • Gender:Male
  • Location:Caversham, Reading, England.
  • United Kingdom

I'm a fool. Please ignore my previous two posts, on re-reading this thread it's obvious that I misunderstood what you were looking for. If (at last) I have it right, what you need is a projection engine. Such a one is Proj.4, see:

http://trac.osgeo.org/proj/

Using proj it is possible to project a tab-delimited WGS84 lon/lat file to Robinson using a command line such as:

proj +proj=robin cities_lon_lat.txt > cities_robinson.txt

The input file ('robin cities_lon_lat.txt') needs to be tab-delimited in something like this format (lon first, then lat):

# Some World Cities
50.08 26.33 Ad Damman Saudi Arabia SAU
47.97 29.38 Kuwait Kuwait KWT
47.76 30.50 Basra Iraq IRQ
42.94 14.79 Al Hudaydah Yemen YEM
29.90 31.20 Alexandria Egypt EGY

Running the command above will produce a tab-delimited text file ('cities_robinson.txt'):

# Some World Cities
4589375.66 2816200.97 Ad Damman Saudi Arabia SAU
4359187.88 3142419.46 Kuwait Kuwait KWT
4324742.07 3261834.90 Basra Iraq IRQ
4017410.26 1581817.95 Al Hudaydah Yemen YEM
2701163.32 3336376.28 Alexandria Egypt EGY

In this example the output was sent to a text file, but of course it could be directed to anywhere you like. If the command above is run without the '> cities_robinson.txt' output will be to stdout (the terminal window).

Regards, N.
Caversham, Reading, England.

#17
räph

räph

    Newbie

  • New Member
  • Pip
  • 1 posts
  • Gender:Male
  • Germany

so to convert dynamically the geographical coordinates (lat/long) to x/y value for a Robinson map, here is the mathematical explanation of the formulas :

http://findarticles....ag=content;col1

note that in mathematique formulas, you always want to convert the lat/long from decimal value to radian before to apply on the any formula (it took me a week before to figure out that !!)

if you have any question about that, feel free to write, my map is displaying on the fly any city of the world !


Hi,
quite an old post - but hoepfully I can still get some help! I'm trying to do something similar and I tried to translate lat/lon to x/y with Beineke's formula. Unluckily I don't have success doing so. I used radians - but maybe I'm missing something else. Which formula did you use? When you try to get y for 90° - shouldn't the result be 1, like propagated on Wikipedia? My result is -0,23.

Is Beineke's formula right? I found no other source in the web. It states here:

where s = 1 for ([phi][greater than or equal to]0) or s = 1 for ([phi]<0)

So the s would be always 1??

Thanks
Raphael

Edited by räph, 23 July 2010 - 03:42 AM.


#18
jucky68

jucky68

    Newbie

  • New Member
  • Pip
  • 1 posts
  • United States

I think I have to convert them into Projected Coordinate System, according to the Robinson projection.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

-->