Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to convert (google sourced) longitude and latitude coordinates to x and y to place points on a SVG map

I can get the longitude converted to X but I can't nail latitude.

  • red dots = place holders
  • green dot = calculated position from longitude/latitude

I have read so much about Mercator projections and other projection system API's I am now completely confused. I also followed Proj4JS library threads but couldn't find an example that was close to my task.

I attempted to emulate @Raphael Wichmann and @betamax solution, unfortunately I got something wrong.

Could someone please have a look at my jsfiddle and see if it's an obvious mistake?

The second test function secondconvert(latitude, longitude) (bottom of javascript pane) provides me with a reasonably accurate x coordinate i.e. if I manually enter the y coordinate b.ylat change to 265 it covers my left red dot place holder nearly perfectly.

I think I'm close, any help would be really appreciated.

Note: the longitude/latitude bounds I used for my SVG map are best guesstimates, worked surprisingly well for the longitude calculation.


Original SVG from here.

share|improve this question
up vote 0 down vote accepted

This question was answered by @acraig5075 here.

After correcting my mistake and adjusting southern latitude I get:

share|improve this answer
@Chris- rather than editing your title to say "solved", please click the "checkmark" next to your answer to mark it as "accepted". Thanks. – RyanDalton Sep 4 '12 at 14:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.