1

FusedLocationAPI를 사용하여 고정밀도 위치 업데이트 (업데이트 간격은 2 초, 가장 빠른 간격은 5 초임)입니다. 대부분의 경우 잘 작동합니다. 그러나 때로는 1200m와 같은 정확도를 제공합니다.PRIORITY_HIGH_ACCURACY조차도 위치 정확도가 매우 낮습니다.

나는 그것이 처음 발생할 수 있음을 알고 있습니다. 하지만 문제는 잠시 동안 공정한 (~ 20m 정확도) 업데이트를 얻은 다음 갑자기 ~ 1200m의 정확도로 전환한다는 것입니다.

어떻게 이것이 Fused API에서 발생할 수 있습니까?

답변

1

때때로 발생합니다. 더욱이, 잘못된 위치 수정은 5 분 동안 계속 될 수 있습니다. 이러한 좌표를 필터링하려고 시도 했으므로 Location Strategies 문서 (최대 유지 보수 섹션 참조)에 설명 된 방법을 사용했습니다.

private static final int TWO_MINUTES = 1000 * 60 * 2; 

/** Determines whether one Location reading is better than the current Location fix 
* @param location The new Location that you want to evaluate 
* @param currentBestLocation The current Location fix, to which you want to compare the new one 
*/ 
protected boolean isBetterLocation(Location location, Location currentBestLocation) { 
    if (currentBestLocation == null) { 
     // A new location is always better than no location 
     return true; 
    } 

    // Check whether the new location fix is newer or older 
    long timeDelta = location.getTime() - currentBestLocation.getTime(); 
    boolean isSignificantlyNewer = timeDelta > TWO_MINUTES; 
    boolean isSignificantlyOlder = timeDelta < -TWO_MINUTES; 
    boolean isNewer = timeDelta > 0; 

    // If it's been more than two minutes since the current location, use the new location 
    // because the user has likely moved 
    if (isSignificantlyNewer) { 
     return true; 
     // If the new location is more than two minutes older, it must be worse 
    } else if (isSignificantlyOlder) { 
     return false; 
    } 

    // Check whether the new location fix is more or less accurate 
    int accuracyDelta = (int) (location.getAccuracy() - currentBestLocation.getAccuracy()); 
    boolean isLessAccurate = accuracyDelta > 0; 
    boolean isMoreAccurate = accuracyDelta < 0; 
    boolean isSignificantlyLessAccurate = accuracyDelta > 200; 

    // Check if the old and new location are from the same provider 
    boolean isFromSameProvider = isSameProvider(location.getProvider(), 
      currentBestLocation.getProvider()); 

    // Determine location quality using a combination of timeliness and accuracy 
    if (isMoreAccurate) { 
     return true; 
    } else if (isNewer && !isLessAccurate) { 
     return true; 
    } else if (isNewer && !isSignificantlyLessAccurate && isFromSameProvider) { 
     return true; 
    } 
    return false; 
} 

/** Checks whether two providers are the same */ 
private boolean isSameProvider(String provider1, String provider2) { 
    if (provider1 == null) { 
     return provider2 == null; 
    } 
    return provider1.equals(provider2); 
} 

표준 Android 위치 API와 함께 사용하도록 설계되었지만 작동합니다. 모든 수정 프로그램이 동일한 공급자를 가지고 있기 때문에 방금 수정했습니다. 그것은 "나쁜"위치 수정의 약 30 %를 걸러 내게합니다.

+0

감사합니다. @fishbone. 하지만 실제로 원하는 것은 거리를 추적해야하므로 사용자의 가장 좋은 위치를 지속적으로 추적하는 것입니다. 가장 좋은 수정 프로그램을 유지하는 것은 그 시나리오에서 실제로 도움이되지 않습니다. 나는이 경우 거리계를 추적하기 위해 만보계로 바꾼다. 그럼에도 불구하고이 거대한 부정확성이 끝날 때까지 계속된다면 사용자의 마지막 위치가 무엇인지 알 수 없습니다. 특히 언급 한대로 몇 분 동안 계속 발생하는 경우. – wgihan

0

원시 GPS 데이터의 거리 측정은 기본 데이터가 부정확하기 때문에 항상 시끄 럽습니다. 이러한 점프는 부정확 한 위치 측정으로 인한 것입니다. 정확한 거리 측정을 위해서는 데이터의 노이즈를 필터링해야합니다. 당신이 탐험 할 수

몇 가지 유용한 필터링 기술은 다음과 같습니다 칼만 필터를 사용

  1. 평활 위치 데이터 - tutorial
  2. 구글 도로 스냅 참조 snap-to-roads API, 또는 OSRM match service 매핑합니다.

정확한 위치 데이터와 거리 측정을 제공하는 엔드 투 엔드 솔루션을 찾고 있다면 Android 또는 iOS 용 HyperTrack SDK를 사용해 볼 수도 있습니다. their blog에서 정확도를 높이기 위해 위치를 필터링하는 방법에 대해 읽을 수 있습니다. (면책 조항 : HyperTrack에서 근무합니다.)

+0

감사합니다 @Aman Jain, 매우 도움이됩니다. – wgihan