Changeset 14015 in josm for trunk/src/org


Ignore:
Timestamp:
2018-07-08T02:42:00+02:00 (6 years ago)
Author:
Don-vip
Message:

add unit tests on nominatim area name resolution

File:
1 edited

Legend:

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

    r13682 r14015  
    1313import java.util.Arrays;
    1414import java.util.EnumMap;
     15import java.util.List;
    1516import java.util.Locale;
    1617import java.util.Map;
     
    281282
    282283    private static SearchResult searchName(String area) throws IOException {
    283         return NameFinder.queryNominatim(area).stream().filter(
     284        return searchName(NameFinder.queryNominatim(area));
     285    }
     286
     287    static SearchResult searchName(List<SearchResult> results) {
     288        return results.stream().filter(
    284289                x -> !OsmPrimitiveType.NODE.equals(x.getOsmId().getType())).iterator().next();
    285290    }
     
    292297        idOffset.put(OsmPrimitiveType.RELATION, 3_600_000_000L);
    293298        final PrimitiveId osmId = searchName(area).getOsmId();
     299        Logging.debug("Area '{0}' resolved to {1}", area, osmId);
    294300        return String.format("area(%d)", osmId.getUniqueId() + idOffset.get(osmId.getType()));
    295301    }
Note: See TracChangeset for help on using the changeset viewer.