Modify

Opened 2 months ago

Last modified 2 months ago

#24034 new defect

Add {apikey} support for TIGER Roads 2023

Reported by: CAM-Gerlach Owned by: team
Priority: normal Milestone:
Component: Core imagery Version:
Keywords: api key apikey mapkey Cc: stoecker

Description (last modified by CAM-Gerlach)

First off, thanks for all your work to create and maintain JOSM as such an awesome tool! As one of the open source maintainers of a community-developed GUI application myself (and a silly programming language), I can only imagine how much time and effort has gone into the ≈two decades of JOSM development to build and maintain an indispensable part of OSM. Cheers!

The imagery wiki data needed an update to add the latest TIGER Roads 2023 QA overlay (as the latest listed currently is 2022), that iD has had for quite a while now. I verified the URL and existing parameters work in JSOM locally (minus apikey , which I had to temporarily hardcoded to the iD value), and added the updated TIGER Roads 2023 to the Maps of USA Country wiki page based off the previous years data with the necessary updates, cross-checking it against the previous year's config and matching parameters in iD (e.g. bounds, etc).

However, given it uses apikey since #18726 , I figured it needs an update the JOSM web service to retrieve the keys, which (understandably) I'm not able to do. And indeed, I get an error dialog (attached) when attempting to add the new, wiki-derived TIGER Roads 2023 imagery from the Imagery menu to the layer stack in JOSM. Unfortunately, the exception text is frustratingly uncopyable (might want to flip whatever flag in the dialog object controls that for easier debugging :) ) but I've manually transcribed it here as well as attaching an image:

java.lang.IllegalArgumentException: java.lang.NullPointerException: Cannot invoke "String.length()" because <parameter2> is null

To my Java- and JOSM-codebase-naïve eye it seems generally consistent with an error either retrieving or inserting apikey due to it not being being sent from the server (or, that imagery ID not being present in some internal data structure).

I've been able to add/update other wiki imagery just fine as well as use the imagery from the same URL except with hardcoded API key (locally, not added to wiki ofc). Additionally, I've carefully checked for any other issues in the XML I added, specifically deltas from the previous I copy-pasted and updated that worked fine, but found nothing.

Therefore, opening this ticket so hopefully whoever is able to can make the appropriate change(s) can be made to get this working. Thanks!

Attachments (1)

JOSM_Error_TIGER_Roads_2023.png (8.2 KB ) - added by CAM-Gerlach 2 months ago.
Error dialog shown on attempting to load images

Download all attachments as: .zip

Change History (5)

by CAM-Gerlach, 2 months ago

Error dialog shown on attempting to load images

comment:1 by CAM-Gerlach, 2 months ago

Description: modified (diff)

comment:2 by taylor.smock, 2 months ago

Cc: stoecker added

@stoecker can add the apikey to the backend.

I was able to reproduce the IllegalArgumentException locally, here is the stack trace for future reference:

ReportedException [thread=Thread[#62,AWT-EventQueue-0,6,main], exception=java.lang.IllegalArgumentException: java.lang.NullPointerException: Cannot invoke "String.length()" because "replacement" is null, methodWarningFrom=null]
[...]
Caused by: java.lang.IllegalArgumentException: java.lang.NullPointerException: Cannot invoke "String.length()" because "replacement" is null
	at org.openstreetmap.gui.jmapviewer.tilesources.TemplatedTMSTileSource.lambda$handleTemplate$1(TemplatedTMSTileSource.java:107)
	at org.openstreetmap.gui.jmapviewer.tilesources.TemplatedTMSTileSource.replacePattern(TemplatedTMSTileSource.java:82)
	at org.openstreetmap.gui.jmapviewer.tilesources.TemplatedTMSTileSource.handleTemplate(TemplatedTMSTileSource.java:103)
	at org.openstreetmap.gui.jmapviewer.tilesources.TemplatedTMSTileSource.<init>(TemplatedTMSTileSource.java:74)
	at org.openstreetmap.josm.data.imagery.JosmTemplatedTMSTileSource.<init>(JosmTemplatedTMSTileSource.java:20)
	at org.openstreetmap.josm.gui.layer.TMSLayer.getTileSourceStatic(TMSLayer.java:120)
	at org.openstreetmap.josm.gui.layer.TMSLayer.getTileSource(TMSLayer.java:77)
	at org.openstreetmap.josm.gui.layer.TMSLayer.getTileSource(TMSLayer.java:35)
	at org.openstreetmap.josm.gui.layer.AbstractTileSourceLayer.initializeIfRequired(AbstractTileSourceLayer.java:579)
	at org.openstreetmap.josm.gui.layer.AbstractTileSourceLayer.attachToMapView(AbstractTileSourceLayer.java:561)
	at org.openstreetmap.josm.gui.MapView.layerAdded(MapView.java:361)
	... 38 more
Caused by: java.lang.NullPointerException: Cannot invoke "String.length()" because "replacement" is null
	at java.base/java.util.regex.Matcher.appendExpandedReplacement(Matcher.java:1058)
	at java.base/java.util.regex.Matcher.appendReplacement(Matcher.java:949)
	at org.openstreetmap.gui.jmapviewer.tilesources.TemplatedTMSTileSource.lambda$handleTemplate$1(TemplatedTMSTileSource.java:105)
	... 48 more

This will (technically) be fixed once the apikey is added to the backend. Realistically, we should look into adding a better message, e.g. {0} does not currently have an apikey specified, please contact the maintainers if you have an apikey that can be widely used.

in reply to:  2 comment:3 by stoecker, 2 months ago

Replying to taylor.smock:

@stoecker can add the apikey to the backend.

Done.

comment:4 by CAM-Gerlach, 2 months ago

Thanks so much @taylor.smock and @stoecker ! I tested the whole flow again in JOSM and everything works as expected now!

Realistically, we should look into adding a better message, e.g. {0} does not currently have an apikey specified, please contact the maintainers if you have an apikey that can be widely used.

Yeah, that sounds like a good idea from a UX POV, since while I was expecting some sort of error given it was a change I myself had made, in most cases users won't be as fortunate. It would also be nice to make error dialog copy-pastable so users don't need to manually transcribe (or most likely, just rely on images or worse, vague descriptions (as I'm unfortunately all too familiar with myself...). Unfortunately, my Java- (and JOSM, and SVN if you're still using that)-fu is likely not up to snuff for helping with that.

Cheers!

Last edited 2 months ago by CAM-Gerlach (previous) (diff)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user.
Next status will be 'needinfo'. The owner will be changed from team to CAM-Gerlach.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from team to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.