2016-07-28 3 views
1

안녕하세요 저는 Android 개발에 처음입니다.처음부터 목적지까지의 위도와 경도 계산

나는 두 지점 사이의 위도와 경도 목록을 찾아야하는 위치에 근거한 대학 프로젝트에 있습니다. 시작 위치는 12.990143,80.215784이고 대상 위치는 12.992595,80.217618입니다.

Over the past days i search the google, i found so many links to find distance between locations and mid point. I cant able to find solution for my problem. 

Please suggest some solution for this problem. I am struggling over days to find solution for this. 


Thanks in advance 
+0

의 LatLng 점을 말했다? 직선으로? –

+0

@GeetChoubey 예 직선에 – iyu

+1

다음을 확인하십시오. https://developers.google.com/maps/documentation/distance-matrix/intro#travel_modes – Vickyexpert

답변

1

당신은 Google Maps API Utility Library에서 SphericalUtil.interpolate 방법을 사용할 수 있습니다. 당신이

LatLng origin = new LatLng(12.990143,80.215784); 
LatLng destination = new LatLng(12.992595,80.217618); 
LatLng result = SphericalUtil.interpolate(origin, destination, 0.2); 
0

당신은 전체 폴리 라인을 얻기 위해 구글 길 찾기 API를 사용할 수 있습니다를 수행하여 시작 위치와 목적지 사이의 거리의 1/5에있는 LatLng을 찾을 수 있습니다 예를 들어

통로. JSON 객체를 objain하고 파싱하여 경로의 위치를 ​​얻을 수 있습니다.

http://maps.googleapis.com/maps/api/directions/json?origin=12.990143,80.215784&destination=12.992595,80.217618&mode=driving

이 당신이 그것에 속하는 모든 점에 전체 경로를 찾을 필요가 모든 것을 포함하는 전체 JSON 결과를 반환합니다.

당신이 그것으로 더 볼 수 있습니다 : 둘 사이에

https://developers.google.com/maps/documentation/directions/intro#Introduction

+0

예. 길에서 위도와 경도의 경로를 반환하는이 방향 API를 시도했습니다. 하지만 직선과 수출 목록 위치에서 위도와 경도의 목록이 필요합니다. – iyu