views:

20

answers:

0

Hi,

I want to plot a location on a map using the lat/lon pair reported by recent browsers. I've got that working with an image of the earth (like Google Maps zoomed out full) but what I'd really like to do is plot the lat/lon pairs at a more zoomed in level, like a ten mile radius from your current location, for example.

At the moment I'm using a very simple method to convert the lat/lon pairs to x and y co-ordinates:

function getPoint(lat, lon) {
  x = (180 + lon) * (map_width / 360);
  y = (90 - lat) * (map_height / 180);
  return {x:x,y:y};
}

Where the map_width and map_height variables are the browser width and height respectively.

Any ideas how I can "zoom in" and convert the lat and lon into x and y co-ordinates that reflect a city rather than the whole planet?