简体   繁体   English

将经纬度值转换为两倍

[英]convert latitude and longitude value to double

I have Code: LatLng latLng = new LatLng(-7.11231243, 110.45345433); 我有代码: LatLng latLng = new LatLng(-7.11231243, 110.45345433);

How can I take each value latitude and longitude? 如何获取每个值的纬度和经度?

I want to convert like this; 我想这样转换;

double lat = -7.11231243; double lng = 110.45345433;

Can anyone help, please. 任何人都可以帮忙。

You can access the class fields directly, they are public 您可以直接访问课程字段,因为它们是公共的

double lat = latLng.latitude;

see https://developers.google.com/android/reference/com/google/android/gms/maps/model/LatLng 参见https://developers.google.com/android/reference/com/google/android/gms/maps/model/LatLng

You can directly get the value of latitude and longitude from LatLng object. 您可以直接从LatLng对象获取经度和纬度值。
`public final class LatLng `公共最终课程LatLng

  public final double latitude

  Latitude, in degrees. This value is in the range [-90, 90].

  public final double longitude

  Longitude, in degrees. This value is in the range [-180, 180).`

You need to call this : 您需要致电:

double lat = latlng.latitude; double lng = latlng.longitude;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM