定义路线之间的所有区域纬度和经度



我正在开发谷歌地图应用程序。当我定义一条路线时,例如从城市一到城市二。。那么我怎样才能得到城市一和城市二之间所有地方的经纬度呢。

destinationid= (EditText) findViewById(R.id.destinationid);
String clocation = destinationid.getText().toString();
List<Address> addressList=null;
if(clocation!= null || clocation!="")
{
Geocoder geocoder=new Geocoder(this);
try {
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("google.navigation:q="+clocation+""));
startActivity(intent);
addressList= geocoder.getFromLocationName(clocation,1);
}
catch (IOException e)
{
e.printStackTrace();
}
Address address= addressList.get(0);
LatLng latLng=new LatLng(address.getLatitude(),address.getLongitude());
mMap.addMarker(new MarkerOptions().position(latLng).title("Current Location  "));
mMap.animateCamera(CameraUpdateFactory.newLatLng(latLng));
mMap.addMarker(new MarkerOptions().position(latLng).title("Current Location  "));
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 15.0f));
mMap.animateCamera(CameraUpdateFactory.zoomIn());        mMap.animateCamera(CameraUpdateFactory.zoomTo(15), 2000, null);  CameraPosition cameraPosition = new CameraPosition.Builder()
.target(latLng)
.zoom(15)
.bearing(150)
.tilt(70)
.build();
mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
mMap.setTrafficEnabled(true);

}'

要回答上面评论中的第一个问题,1] 要显示路线上的任何特定点B,您可以使用markers,这是谷歌地图API的一个功能,您可以在这里找到更多详细信息。

2] 要检查半径范围内的任何人,您可以使用Geo fenceAPI。你可以在这里找到更多的细节。

最新更新