public static void copyGeo(GeoTimeSerie from,GeoTimeSerie to){
  GTSHelper.sort(from,false);
  GTSHelper.sort(to,false);
  int fromidx=0;
  int toidx=0;
  while (toidx < to.values && fromidx < from.values) {
    long fromtick=GTSHelper.tickAtIndex(from,fromidx);
    long totick=GTSHelper.tickAtIndex(to,toidx);
    while (fromidx < from.values && fromtick < totick) {
      fromidx++;
      fromtick=GTSHelper.tickAtIndex(from,fromidx);
    }
    if (fromidx >= from.values) {
      break;
    }
    while (toidx < to.values && totick < fromtick) {
      toidx++;
      totick=GTSHelper.tickAtIndex(to,toidx);
    }
    if (toidx >= to.values) {
      break;
    }
    if (totick == fromtick) {
      long location=GTSHelper.locationAtIndex(from,fromidx);
      long elevation=GTSHelper.elevationAtIndex(from,fromidx);
      GTSHelper.setLocationAtIndex(to,toidx,location);
      GTSHelper.setElevationAtIndex(to,toidx,elevation);
      fromidx++;
    }
  }
}

public static void copyGeo ( GeoTimeSerie from , GeoTimeSerie to ) { GTSHelper . sort ( from , false ) ; GTSHelper . sort ( to , false ) ; int fromidx = 0 ; int toidx = 0 ; while ( toidx < to . values && fromidx < from . values ) { long fromtick = GTSHelper . tickAtIndex ( from , fromidx ) ; long totick = GTSHelper . tickAtIndex ( to , toidx ) ; while ( fromidx < from . values && fromtick < totick ) { fromidx ++ ; fromtick = GTSHelper . tickAtIndex ( from , fromidx ) ; } if ( fromidx >= from . values ) { break ; } while ( toidx < to . values && totick < fromtick ) { toidx ++ ; totick = GTSHelper . tickAtIndex ( to , toidx ) ; } if ( toidx >= to . values ) { break ; } if ( totick == fromtick ) { long location = GTSHelper . locationAtIndex ( from , fromidx ) ; long elevation = GTSHelper . elevationAtIndex ( from , fromidx ) ; GTSHelper . setLocationAtIndex ( to , toidx , location ) ; GTSHelper . setElevationAtIndex ( to , toidx , elevation ) ; fromidx ++ ; } } }
copy geo infos ( location + elevation ) from gts ' from ' into gts ' to ' only infos for matching ticks with values in ' to ' will be copied
