Last change
on this file since 12894 was 12816, checked in by Don-vip, 7 years ago |
see #15229 - see #15182 - remove GUI references from I/O subsystem
|
-
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.function.Function;
|
---|
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 Function<Long, Object> toOverpassExpression = x -> type.getAPIName() + '(' + x + ");>;";
|
---|
20 | final String query = '(' + Utils.join("", Utils.transform(idPackage, toOverpassExpression)) + ");out meta;";
|
---|
21 | return "interpreter?data=" + Utils.encodeUrl(query);
|
---|
22 | }
|
---|
23 |
|
---|
24 | @Override
|
---|
25 | protected String getBaseUrl() {
|
---|
26 | return OverpassDownloadReader.OVERPASS_SERVER.get();
|
---|
27 | }
|
---|
28 |
|
---|
29 | @Override
|
---|
30 | protected boolean recursesDown() {
|
---|
31 | // see https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#Recurse_down_.28.3E.29 for documentation
|
---|
32 | // accomplished using >; in the query string above
|
---|
33 | return true;
|
---|
34 | }
|
---|
35 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.