#24270 closed defect (fixed)
File -> Open Location is too strict about URL format - won't download geojson query
Reported by: | NeatNit | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | 25.04 |
Component: | Core | Version: | |
Keywords: | template_report | Cc: |
Description
What steps will reproduce the problem?
- File -> Open Location...
- Paste in:
https://gisn.tel-aviv.gov.il/arcgis/rest/services/IView2/MapServer/577/query?where=1%3D1&outFields=*&f=geojson
- Click "Download URL"
What is the expected result?
GeoJSON data is loaded from the query URL
What happens instead?
Error message:
Cannot open URL
The following download tasks accept the URL patterns shown:
[...]
Download GeoJSON:
https?:.*/(.*\.(json|geojson)(\.(gz|xz|bz2?|zip))?)
https?:.*format=geojson.*
Please provide any additional information below. Attach a screenshot if possible.
Found a silly workaround: the server ignores unrecognized parameters, so the following URL works: https://gisn.tel-aviv.gov.il/arcgis/rest/services/IView2/MapServer/577/query?where=1%3D1&outFields=*&f=geojson&format=geojson
Note that just &format=geojson
without &f=geojson
is not accepted by the server.
I don't know if this server is geo-restricted, but it's not necessary to reach it to reproduce the error.
In my humble opinion, any occurrence of "geojson" in the URL should be a big enough clue that it's geojson, and a reason to at least try. But if you disagree, fair enough, please add support for f=geojson
:)
Relative:URL: ^/trunk Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b Last:Changed Date: 2025-03-29 21:08:34 +0100 (Sat, 29 Mar 2025) Revision:19369 Build-Date:2025-03-30 01:30:37 URL:https://josm.openstreetmap.de/svn/trunk Identification: JOSM/1.5 (19369 en) Linux Mint 22 Memory Usage: 484 MB / 3964 MB (57 MB allocated, but free) Java version: 21.0.5+11-LTS, Azul Systems, Inc., OpenJDK 64-Bit Server VM Look and Feel: javax.swing.plaf.metal.MetalLookAndFeel Screen: :0.0 2560x1440x[Multi depth]@60Hz (scaling 1.00×1.00) :0.1 1920x1080x[Multi depth]@[Unknown refresh rate] (scaling 1.00×1.00) Maximum Screen Size: 2560×1440 Best cursor sizes: 16×16→16×16, 32×32→32×32 Environment variable LANG: en_IL.UTF-8 System property file.encoding: UTF-8 System property sun.jnu.encoding: UTF-8 Locale info: en_IL Numbers with default locale: 1234567890 -> 1234567890 Desktop environment: X-Cinnamon fonts-noto: fonts-noto:- VM arguments: [-Dicedtea-web.bin.location=/opt/OpenWebStart/javaws, -Djava.util.Arrays.useLegacyMergeSort=true, --add-reads=java.base=ALL-UNNAMED,java.desktop, --add-reads=java.desktop=ALL-UNNAMED,java.naming, --add-reads=java.naming=ALL-UNNAMED,java.desktop, --add-exports=java.desktop/sun.awt=ALL-UNNAMED,java.desktop, --add-exports=java.desktop/javax.jnlp=ALL-UNNAMED,java.desktop, --add-exports=java.base/com.sun.net.ssl.internal.ssl=ALL-UNNAMED,java.desktop, --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED,java.desktop, --add-exports=java.base/sun.security.action=ALL-UNNAMED,java.desktop, --add-exports=java.base/sun.security.provider=ALL-UNNAMED,java.desktop, --add-exports=java.base/sun.security.util=ALL-UNNAMED,java.desktop, --add-exports=java.base/sun.security.validator=ALL-UNNAMED,java.desktop, --add-exports=java.base/sun.security.x509=ALL-UNNAMED,java.desktop, --add-exports=java.base/jdk.internal.util.jar=ALL-UNNAMED,java.desktop, --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED,java.desktop, --add-exports=java.desktop/sun.awt.X11=ALL-UNNAMED,java.desktop, --add-exports=java.desktop/sun.applet=ALL-UNNAMED,java.desktop,jdk.jsobject, --add-exports=java.naming/com.sun.jndi.toolkit.url=ALL-UNNAMED,java.desktop, --add-modules=java.scripting,java.sql,javafx.controls,javafx.media,javafx.swing,javafx.web, --add-exports=java.desktop/com.apple.eawt=ALL-UNNAMED, --add-exports=java.desktop/com.sun.imageio.spi=ALL-UNNAMED, --add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED, --add-exports=javafx.graphics/com.sun.javafx.application=ALL-UNNAMED, --add-exports=jdk.deploy/com.sun.deploy.config=ALL-UNNAMED, --add-opens=java.base/java.lang=ALL-UNNAMED, --add-opens=java.base/java.nio=ALL-UNNAMED, --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED, --add-opens=java.base/jdk.internal.ref=ALL-UNNAMED, --add-opens=java.desktop/javax.imageio.spi=ALL-UNNAMED, --add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED, --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED, -Djava.security.manager=allow] Dataset consistency test: No problems found Plugins: + pt_assistant (656) + reverter (36413) + undelete (36413) + utilsplugin2 (36413) Last errors/warnings: - 00845.148 W: Warning - <html>Cannot open 1 file because file does not exist or no suitable file importer is available.<br><ul><li>${HOME}/https:/example.com/stuff.geojson?a=b (<i>does not exist</i>)</li></ul></html> - 00887.945 E: java.nio.file.NoSuchFileException: https:/example.com/stuff.geojson - 00887.975 E: Error - <html>Could not read file 'stuff.geojson'.<br>Error is:<br>https:/example.com/stuff.geojson</html> - 02450.437 E: Download Location - <html><p>Cannot open URL 'https://gisn.tel-aviv.gov.il/arcgis/rest/services/IView2/MapServer/577/query?where=1%3D1&outFields=*&f=geojson'<br>The following download tasks accept the URL patterns shown:<br><table><tr><td>Download OSM:</td><td><ul><li>https?://.*/api/0.6/(map|nodes?|ways?|relations?|\*).*</li><li>https?://.*/interpreter\?data=.*</li><li>https?://.*/xapi(?:\?.*\[@meta\]|_meta\?)(.*)</li><li>https?://.*/(.*\.osm)</li><li>https?://.*/(.*\.osm\.(gz|xz|bz2?|zip))</li></ul></td></tr><tr><td>Download GPS:</td><td><ul><li>https?://.*(osm|openstreetmap).org/trace/\p{Digit}+/data</li><li>https?://.*(osm|openstreetmap).org/user/[^/]+/traces/(\p{Digit}+)</li><li>https?://.*(osm|openstreetmap).org/edit/?\?gpx=(\p{Digit}+)(#.*)?</li><li>https?://.*/api/0.6/trackpoints\?bbox=.*,.*,.*,.*</li><li>https?://.*/api/v\p{Digit}+/projects?/\p{Digit}+/(tasks_as_gpx?.*|tasks/queries/gpx/\?tasks=.*)</li><li>https?://.*exportgpx.*</li><li>https?://.*/(.*\.gpx)</li></ul></td></tr><tr><td>Download OSM Notes:</td><td><ul><li>https?://.*/api/0.6/notes.*</li><li>https?://.*/(.*\.osn(\.(gz|xz|bz2?|zip))?)</li></ul></td></tr><tr><td>Download OSM Change:</td><td><ul><li>https?://www\.(osm|openstreetmap)\.org/changeset/(\p{Digit}+).*</li><li>https?://.*/api/0.6/changeset/\p{Digit}+/download</li><li>https?://.*/(.*\.osc)</li><li>https?://.*/(.*\.osc.(gz|xz|bz2?|zip))</li></ul></td></tr><tr><td>Download OSM URL:</td><td><ul><li>https?://www\.(osm|openstreetmap)\.org/\?lat=.*&lon=.*</li><li>https?://www\.(osm|openstreetmap)\.org/(.*)?#map=\p{Digit}+/.*/.*</li><li>geo:(?<lat>[+-]?[0-9.]+),(?<lon>[+-]?[0-9.]+)(?<crs>;crs=wgs84)?(?<uncertainty>;u=[0-9.]+)?(\?z=(?<zoom>[0-9]+))?</li></ul></td></tr><tr><td>Download OSM object by ID:</td><td><ul><li>https?://(?:www\.)?(osm|openstreetmap)\.org/(?:browse/)?(node|way|relation)/(\p{Digit}+).*</li></ul></td></tr><tr><td>Download session:</td><td><ul><li>https?://.*/.*\.jo([sz])</li></ul></td></tr><tr><td>Download OSM Notes within Bounds:</td><td><ul><li>https?://www\.(osm|openstreetmap)\.org/(.*)?#map=\p{Digit}+/.*/.*&layers=[A-MO-Z]*N[A-MO-Z]*</li></ul></td></tr><tr><td>Download OSM Note by ID:</td><td><ul><li>https?://www\.(osm|openstreetmap)\.org/note/(\p{Digit}+).*</li></ul></td></tr><tr><td>Download GeoJSON:</td><td><ul><li>https?://.*/(.*\.(json|geojson)(\.(gz|xz|bz2?|zip))?)</li><li>https?://.*format=geojson.*</li></ul></td></tr></table></p></html> - 02593.237 E: Download Location - <html><p>Cannot open URL 'https://gisn.tel-aviv.gov.il/arcgis/rest/services/IView2/MapServer/577/query?where=1%3D1&outFields=*&f=geojson'<br>The following download tasks accept the URL patterns shown:<br><table><tr><td>Download OSM:</td><td><ul><li>https?://.*/api/0.6/(map|nodes?|ways?|relations?|\*).*</li><li>https?://.*/interpreter\?data=.*</li><li>https?://.*/xapi(?:\?.*\[@meta\]|_meta\?)(.*)</li><li>https?://.*/(.*\.osm)</li><li>https?://.*/(.*\.osm\.(gz|xz|bz2?|zip))</li></ul></td></tr><tr><td>Download GPS:</td><td><ul><li>https?://.*(osm|openstreetmap).org/trace/\p{Digit}+/data</li><li>https?://.*(osm|openstreetmap).org/user/[^/]+/traces/(\p{Digit}+)</li><li>https?://.*(osm|openstreetmap).org/edit/?\?gpx=(\p{Digit}+)(#.*)?</li><li>https?://.*/api/0.6/trackpoints\?bbox=.*,.*,.*,.*</li><li>https?://.*/api/v\p{Digit}+/projects?/\p{Digit}+/(tasks_as_gpx?.*|tasks/queries/gpx/\?tasks=.*)</li><li>https?://.*exportgpx.*</li><li>https?://.*/(.*\.gpx)</li></ul></td></tr><tr><td>Download OSM Notes:</td><td><ul><li>https?://.*/api/0.6/notes.*</li><li>https?://.*/(.*\.osn(\.(gz|xz|bz2?|zip))?)</li></ul></td></tr><tr><td>Download OSM Change:</td><td><ul><li>https?://www\.(osm|openstreetmap)\.org/changeset/(\p{Digit}+).*</li><li>https?://.*/api/0.6/changeset/\p{Digit}+/download</li><li>https?://.*/(.*\.osc)</li><li>https?://.*/(.*\.osc.(gz|xz|bz2?|zip))</li></ul></td></tr><tr><td>Download OSM URL:</td><td><ul><li>https?://www\.(osm|openstreetmap)\.org/\?lat=.*&lon=.*</li><li>https?://www\.(osm|openstreetmap)\.org/(.*)?#map=\p{Digit}+/.*/.*</li><li>geo:(?<lat>[+-]?[0-9.]+),(?<lon>[+-]?[0-9.]+)(?<crs>;crs=wgs84)?(?<uncertainty>;u=[0-9.]+)?(\?z=(?<zoom>[0-9]+))?</li></ul></td></tr><tr><td>Download OSM object by ID:</td><td><ul><li>https?://(?:www\.)?(osm|openstreetmap)\.org/(?:browse/)?(node|way|relation)/(\p{Digit}+).*</li></ul></td></tr><tr><td>Download session:</td><td><ul><li>https?://.*/.*\.jo([sz])</li></ul></td></tr><tr><td>Download OSM Notes within Bounds:</td><td><ul><li>https?://www\.(osm|openstreetmap)\.org/(.*)?#map=\p{Digit}+/.*/.*&layers=[A-MO-Z]*N[A-MO-Z]*</li></ul></td></tr><tr><td>Download OSM Note by ID:</td><td><ul><li>https?://www\.(osm|openstreetmap)\.org/note/(\p{Digit}+).*</li></ul></td></tr><tr><td>Download GeoJSON:</td><td><ul><li>https?://.*/(.*\.(json|geojson)(\.(gz|xz|bz2?|zip))?)</li><li>https?://.*format=geojson.*</li></ul></td></tr></table></p></html> - 02621.007 W: Unknown remote control parameter outFields, skipping it - 02621.007 W: Unknown remote control parameter f, skipping it - 02621.007 W: Unknown remote control parameter format, skipping it - 02621.038 W: Warning - <html>Cannot open 1 file because file does not exist or no suitable file importer is available.<br><ul><li>${HOME}/https:/gisn.tel-aviv.gov.il/arcgis/rest/services/IView2/MapServer/577/query?where=1=1 (<i>does not exist</i>)</li></ul></html> - 02643.876 W: Warning - <html>Cannot open 1 file because file does not exist or no suitable file importer is available.<br><ul><li>${HOME}/https:/gisn.tel-aviv.gov.il/arcgis/rest/services/IView2/MapServer/577/query?format=geojson (<i>does not exist</i>)</li></ul></html>
Minimal solution is accepting
f=geojson
insrc/org/openstreetmap/josm/io/UrlPatterns.java
:- FORMAT_GEOJSON (".*format=geojson.*");
+ FORMAT_GEOJSON (".*f(ormat)?=geojson.*");