Ignore:
Timestamp:
2019-02-05T10:53:02+01:00 (6 years ago)
Author:
GerdP
Message:

fix #13195
1) BoundingBoxDownloader: Reduce number of gpx api calls: If a call returned less than 5000 points there is no need to request another page. This improves all routines which download raw GPX data from the server.
2) GpxImporter: Create a new GpxLayer even if the area contains no GPX data. This allows to keep track of the already downloaded boundaries. Without this change the continuosDownload will try agaian and again to download data from this area because the GpxLayer will not contain the information that the corresponding bbox was already downloaded.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/BoundingBoxDownloader.java

    r12620 r14761  
    5151        boolean done = false;
    5252        GpxData result = null;
     53        final int pointsPerPage = 5000; // see https://wiki.openstreetmap.org/wiki/API_v0.6#GPS_traces
    5354        String url = "trackpoints?bbox="+b.getMinLon()+','+b.getMinLat()+','+b.getMaxLon()+','+b.getMaxLat()+"&page=";
    5455        for (int i = 0; !done && !isCanceled(); ++i) {
    55             progressMonitor.subTask(tr("Downloading points {0} to {1}...", i * 5000, (i + 1) * 5000));
     56            progressMonitor.subTask(tr("Downloading points {0} to {1}...", i * pointsPerPage, (i + 1) * pointsPerPage));
    5657            try (InputStream in = getInputStream(url+i, progressMonitor.createSubTaskMonitor(1, true))) {
    5758                if (in == null) {
     
    6566                    result = currentGpx;
    6667                } else if (currentGpx.hasTrackPoints()) {
     68                    long count = currentGpx.getTrackPoints().count();
     69                    Logging.debug("got {0} gpx points", count);
     70                    if (count < pointsPerPage)
     71                        done = true;
    6772                    result.mergeFrom(currentGpx);
    6873                } else {
Note: See TracChangeset for help on using the changeset viewer.