1

I've created a custom tiled map using the Google Maps API and have got a click event to show the latitude/longitude values of where has been selected.

Is there any way of getting the x/y coordinates instead either through the Google Maps API or by converting the latitude/longitude values?

MarkusB
  • 29
  • 1
  • 3
  • 2
    https://developers.google.com/maps/documentation/javascript/reference#MapCanvasProjection – geocodezip Dec 10 '15 at 00:03
  • Possible duplicate of [How to call fromLatLngToDivPixel in Google Maps API V3?](http://stackoverflow.com/questions/1538681/how-to-call-fromlatlngtodivpixel-in-google-maps-api-v3) – duncan Dec 10 '15 at 09:27

1 Answers1

0

This is the recipe transfer from latitude/longitude to coordinates:

  • You have decimal degrees (-73.9874°) instead of degrees, minutes, and seconds (-73° 59’ 14.64")
  • The whole units of degrees will remain the same (-73.9874° longitude, start with 73°)
  • Multiply the decimal by 60 (0.9874 * 60 = 59.244)
  • The whole number becomes the minutes (59’)
  • Take the remaining decimal and multiply by 60. (0.244 * 60 = 14.64)
    The resulting number becomes the seconds (14.64"). Seconds can remain as a decimal.
  • Take your three sets of numbers and put them together, using the symbols for degrees (°), minutes (’), and seconds (") (-73° 59’ 14.64" longitude).

Example: latitude/longitude: 10.787331, 106.647095 = coordinates :10°47'14.4"N 106°38'49.5"E

Nasper
  • 15
  • 3