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

have a map image 800px wide. How can I figure out a city.

like New York has 40.75 latitude and -73.98 longitude. I have to pin a mark over this point.

Before I have done with x_axis and y_axis which gives problem on more cities figure because i manually had to input values. now i have database with all cities with latitude and longitude. or is there any way that i can convert latitude and longitude to x and y axis.

Thank you


x = image.width * (longitude + 180) / (2 * 180)
y = image.height * (latitude + 180) / (2 * 180)
share|improve this question
An answer is provided by the statement of the question at… ! – whuber Jul 12 '11 at 15:18

The maths is pretty easy if you want to do it by hand(or in the database) but you will probably be best served by setting up a desktop GIS to draw the output image once or if you need interactivity then a web map server will be a better way to go.

share|improve this answer
For now i have latitude and longitude stored in database. I have to calculate x coordinate and y-coordinate of a image map and point the place on the coordinate. what will be the exact calculation. please see the codes to calculate on edit section up. this doesn't gives accurate coordinates. – kamal Jul 12 '11 at 10:16
with only 400x800 pixels to play with how accurate do you expect? – iant Jul 12 '11 at 12:07
Definitely I want accurate data. It it is possible as I am doing please advice. else I will search for gis disktop etc.. – kamal Jul 12 '11 at 13:15
well by my calculations you can't get better than .45 degree per pixel for that size of image. – iant Jul 12 '11 at 13:20
@iant It looks like the Robinson projection. The formulas are available. @kamal: look at those formulas. They will give an appreciation for what GIS software does. Do you really want to reinvent this wheel? If so, then pick a real simple projection, such as Plate Carree. – whuber Jul 12 '11 at 17:37

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.