在Android文档中,“NYC”代表“New York City”。可以通过在应用程序中使用Geocoder类来获取New York City的经纬度坐标,示例如下:
// 获取New York City的经纬度 Geocoder geocoder = new Geocoder(context, Locale.getDefault()); List
addressList = geocoder.getFromLocationName("New York City", 1); if (addressList != null && addressList.size() > 0) { Address address = addressList.get(0); double latitude = address.getLatitude(); double longitude = address.getLongitude(); // 在地图上显示New York City的标记 LatLng nyc = new LatLng(latitude, longitude); mMap.addMarker(new MarkerOptions().position(nyc).title("New York City")); mMap.moveCamera(CameraUpdateFactory.newLatLng(nyc)); }