Reputation: 4854
If I want to share my geocoded spots in javascript and java how is this possible?
In Javascript the points are specified as
var point = GPoint(76.27562,9.97943);
In Java they are
GeoPoint point = new GeoPoint(45005000, -93228900);
those seem to be two different formats, so how do I convert from one to the other?
Upvotes: 3
Views: 492
Reputation: 31564
GeoPoint
requires lat/lng to be passed as integers, with degrees multiplied by 10^6
. So, you would need to multiply 76.27562
by 10^6
and convert that into an integer before passing it to the GeoPoint. The reverse process needs to be done for the reverse transformation.
Taken from here:
GeoPoint(int latitudeE6, int longitudeE6) Constructs a GeoPoint with the given latitude and longitude, measured in microdegrees (degrees * 1E6).
1E6
is 10^6
Upvotes: 4