Reputation: 394
I have a little visualization project on a webpage in html5 and javascript. I want to make a map of connections between points by draw them on canvas. My big problem are that im not sure how to convert latitude and longitude coordinates to xy coordinates that matches my canvas.
I've made the webpage, which read a txt file containing positions and draw them on the canvas. But it only works for the 'positive' coordinates.
My goal is that it would like this one: http://chrisharrison.net/projects/InternetMap/medium/worldBlack.jpg
Can you guys help me?
Upvotes: 2
Views: 1216
Reputation: 7141
That depends upon what kind of map you want to use. There is more than one. Mercator, Equirectangular, Winkel-Tripel? Spudley's answer might work (well, I think you might need to instead figure 180 minus the lattitude instead of add), but you may find you want something different.
Upvotes: 0
Reputation: 168655
If you've got it working for all the positive co-ords, why not just add 180 to all the figures, and then they'll all be positive.
Upvotes: 1