I have some trouble while sending coordinates form a kml file to my emulator.
For example I'm sending long: 13,428753
lat: 52,518823
and I receive: 13.428751666666669
and 52.51882166666666
When creating markers on a GoogleMap
with these coordinates I receive a marker with a slightly different position but this breaks comparisons between LatLng
object. Any ideas how I can fix this? I can provide more information if needed.
How I receive my data:
@Override
public void onLocationChanged(Location location) {
if(CurrentJourney.getInstance().getJourney() == null) {
return;
}
CurrentJourney.getInstance().getJourney().getCoordinates()
.add(new LatLng (location.getLatitude(), location.getLongitude()));
String latitude = String.valueOf(location.getLatitude());
String longitude = String.valueOf(location.getLongitude());
Intent intent = new Intent(ACTION_NEW_LOCATION);
intent.putExtra(EXTRA_NEW_LATITUDE, latitude);
intent.putExtra(EXTRA_NEW_LONGITUDE, longitude);
sendBroadcast(intent);
}