Can somebody help me ? I don't have idea what filtering that i can use to clean noise from latitude and longitude
On Sun, Mar 11, 2012 at 3:46 PM, concave <[email protected]>wrote: > Hi guys, i've a little problem here. > I'm working with gps data, getting values every second and displaying > current position on a map. > The problem is that sometimes (specially when im using the app on > indoor and not make a move) the values vary a lot, making the current > position to change. > I was wondering about some easy enough method to avoid this. > As a first idea, I thought about discarding values with accuracy > beyond certain threshold, and use Exponential filtering as i use on my > Bearing. But i get up on Antartica. Here's the code that i used to get > the location and filtering it with exponential : > > public void onLocationChanged(Location newLocation) { > // Get previous Location, needed to get > the Bearing Value > if(currentPosition != null) > { > prevLocation = > currentPosition; > pLat = (int) > (prevLocation.getLatitude() *1E6); > pLongi = (int) > (prevLocation.getLongitude()*1E6); > > } > currentPosition = new Location > (newLocation); > int lat = (int) > (currentPosition.getLatitude()*1E6); > int longi = (int) > (currentPosition.getLongitude()*1E6); > > //Smoothing Latitude,Longitude > if(lat != 0 && longi != 0){ > coor[0] = lat; > coor[1] = longi; > if (smoothingCoor == null){ > smoothingCoor = coor; > } > for (i=0; > i<coor.length;i++){ > smoothingCoor[i] = > smoothingCoor [i] +alpha * (coor[i] - > smoothingCoor[i]); > } > smoothLat = (int) > (smoothingCoor [0] * 1E6); > smoothLongi = (int) > (smoothingCoor [1] * 1E6); > > > currentPosition.setLatitude(smoothLat); > > currentPosition.setLongitude(smoothLongi); > } > > // Get Bearing Value > if(prevLocation != null && currentPosition > != null){ > > bearing = > prevLocation.bearingTo(currentPosition); > > //Smoothing bearing value with exponential > if (smoothingBearing == 0) { > smoothingBearing = bearing; > } else { > smoothingBearing = smoothingBearing +alpha > * (bearing - > smoothingBearing); > } > > } > > Hope you can understand my explanataion, and i provide enough > information > Thanks > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

