Can't read, evaluate the custom altitude for a given Geopoint in a List.
Basically I would like to have a path with x,y,Z, in Osmdroid. Z has to be ascending till middle of the path, then descending.(Z-value) Hold on, it has to be a Point or GeoPoint.
When I create a List it successfully adds a geopoint with altitude.
When I read it timer.setText("Your Coordinates are :" + marker.getPosition()+alt_S); in this setup(animation, interpolation) altitude remains 0.0.
Please help.
Thanks
The code below, reads latitude and Longitude of a marker, but it doesn't read the altitude that I try to obtain, when I stop animation.
Following this post: Osmdroid map marker animation
public void animateMarker(final Marker marker, final GeoPoint toPosition) {
final Handler handler = new Handler();
final long start = SystemClock.uptimeMillis();
Projection proj = map.getProjection();
Point startPoint = proj.toPixels(marker.getPosition(), null);
final IGeoPoint startGeoPoint = proj.fromPixels(startPoint.x, startPoint.y);
final long duration = 5000;
LinearInterpolator interpolator = new LinearInterpolator();
handler.post(new Runnable() {
@Override
public void run() {
long elapsed = SystemClock.uptimeMillis() - start;
float t = interpolator.getInterpolation((float) elapsed / duration);
for (int i = 0; i < geoPoints.size(); i++) {
ListIterator<GeoPoint> geoPTS = geoPoints.listIterator();
while (geoPTS.hasNext()) {
GeoPoint test = geoPTS.next();
// do something with o
double lng = t * toPosition.getLongitude() + (1 - t) * startGeoPoint.getLongitude();
double lat = t * toPosition.getLatitude() + (1 - t) * startGeoPoint.getLatitude();
double alt = test.getAltitude();
marker.setPosition(new GeoPoint(lat, lng,alt));
stopper = findViewById(R.id.buttonStop);
if (stopper.isPressed()) {
handler.removeCallbacks(this);
timer.getText();
alt_S = Double.toString(alt);
timer.setText("Your Coordinates are :" + marker.getPosition()+alt_S);
}
}
}
if (t < 1.0) {
handler.postDelayed(this, 15);
}
map.postInvalidate();
}
});
}