Last change
on this file since 15735 was 15717, checked in by simon04, 4 years ago |
Java 8: use Collectors.joining
|
-
Property svn:eol-style
set to
native
|
File size:
1.2 KB
|
Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.io;
|
---|
3 |
|
---|
4 | import java.util.Set;
|
---|
5 | import java.util.stream.Collectors;
|
---|
6 |
|
---|
7 | import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
|
---|
8 | import org.openstreetmap.josm.tools.Utils;
|
---|
9 |
|
---|
10 | /**
|
---|
11 | * Retrieves a set of {@link org.openstreetmap.josm.data.osm.OsmPrimitive}s from an Overpass API server.
|
---|
12 | *
|
---|
13 | * @since 9241
|
---|
14 | */
|
---|
15 | class MultiFetchOverpassObjectReader extends MultiFetchServerObjectReader {
|
---|
16 |
|
---|
17 | @Override
|
---|
18 | protected String buildRequestString(final OsmPrimitiveType type, Set<Long> idPackage) {
|
---|
19 | final String query = idPackage.stream()
|
---|
20 | .map(x -> type.getAPIName() + '(' + x + ");>;")
|
---|
21 | .collect(Collectors.joining("", "(", ");out meta;"));
|
---|
22 | return "interpreter?data=" + Utils.encodeUrl(query);
|
---|
23 | }
|
---|
24 |
|
---|
25 | @Override
|
---|
26 | protected String getBaseUrl() {
|
---|
27 | return OverpassDownloadReader.OVERPASS_SERVER.get();
|
---|
28 | }
|
---|
29 |
|
---|
30 | @Override
|
---|
31 | protected boolean recursesDown() {
|
---|
32 | // see https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#Recurse_down_.28.3E.29 for documentation
|
---|
33 | // accomplished using >; in the query string above
|
---|
34 | return true;
|
---|
35 | }
|
---|
36 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.