Google maps api coordinates from java to javascript

If I want to share my geocoded points in javascript and java, how is this possible?

In Javascript, points are indicated as

var point = GPoint(76.27562,9.97943);

In Java they

GeoPoint point = new GeoPoint(45005000, -93228900);

It seems that these are two different formats, and how can I convert them from one to another?

+3
source share
1 answer

GeoPointrequires lat / lng to be passed as integers, with degrees multiplied by 10^6. Thus, you will need to multiply 76.27562by 10^6and convert it to an integer before passing it to GeoPoint. The reverse process must be done for the inverse transformation.

Taken from here :

GeoPoint (int latitudeE6, int longitudeE6)            GeoPoint , ( * 1E6).

1E6 10^6

+4

Source: https://habr.com/ru/post/1776090/


All Articles