Changeset 18046 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2021-07-17T14:42:03+02:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/Mediawiki.java
r17880 r18046 95 95 public void searchGeoImages(Bounds bounds, BiConsumer<String, LatLon> imageConsumer) 96 96 throws IOException, ParserConfigurationException, SAXException, XPathExpressionException { 97 final URL url = new URL(baseUrl + 98 "?format=xml" + 99 "&action=query" + 100 "&list=geosearch" + 101 "&gsnamespace=6" + 102 "&gslimit=500" + 103 "&gsprop=type|name" + 104 "&gsbbox=" + bounds.getMaxLat() + "|" + bounds.getMinLon() + "|" + bounds.getMinLat() + "|" + bounds.getMaxLon()); 97 final URL url = new URL(getGeoImagesUrl(baseUrl, bounds)); 105 98 final Document document = getDocument(url); 106 99 final XPath xPath = XPathFactory.newInstance().newXPath(); … … 113 106 imageConsumer.accept(title, new LatLon(lat, lon)); 114 107 } 108 } 109 110 /** 111 * Returns the URL for searching geolocated images in given bounds. 112 * @param baseUrl The wiki base URL 113 * @param bounds the bounds of the search area 114 * @return the URL for searching geolocated images in given bounds 115 * @since 18046 116 */ 117 public static String getGeoImagesUrl(String baseUrl, Bounds bounds) { 118 String sep = Utils.encodeUrl("|"); 119 return baseUrl + 120 "?format=xml" + 121 "&action=query" + 122 "&list=geosearch" + 123 "&gsnamespace=6" + 124 "&gslimit=500" + 125 "&gsprop=type" + sep + "name" + 126 "&gsbbox=" + bounds.getMaxLat() + sep + bounds.getMinLon() + sep + bounds.getMinLat() + sep + bounds.getMaxLon(); 115 127 } 116 128
Note:
See TracChangeset
for help on using the changeset viewer.