将坐标从kml文件发送到我的模拟器时遇到了一些麻烦。
例如,我发送了long: 13,428753
lat: 52,518823
,我收到了:13.428751666666669
和52.51882166666666
使用这些坐标在GoogleMap
上创建标记时,我会收到一个位置略有不同的标记,但这会打破LatLng
对象之间的比较。我有什么想法可以解决这个问题吗?如果需要,我可以提供更多信息。
我如何收到我的数据:
@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);
}