Modify

Opened 6 months ago

Closed 6 months ago

Last modified 6 months ago

#16330 closed defect (fixed)

Unable to define WMS endpoint with key

Reported by: nkamapper Owned by: team
Priority: normal Milestone: 18.06
Component: Core imagery Version:
Keywords: Cc:

Description

What is the correct way of entering the WMS endpoint for the following service?

waapi.webatlas.no/wms-orto-hist?api_key=<key>

The <key> is the same as in Maps/Norway#NorwayOrthophoto (I am avoiding to write it here).

JOSM will prompt with the menu of layers but will not render the selected layer.
(If one layer is chosen instead of endpoint, the "?" and the key is missing from the generated wms url).

Here is a tested and functional example for one of the layers (Oslo area):

http://waapi.webatlas.no/wms-orto-hist?api_key=<key>&FORMAT=image/png&TRANSPARENT=TRUE&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&LAYERS=Oslo-1937&STYLES=&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}

The wms service contains hundreds of historic orthophotos and maps for Norway. Oslo entries are found under "Historiske ortofoto"->"Eldre orto Akershus".

I have been told that the key could alternatively be given as either 1) a HTTP request header with the name "X-WAAPI-TOKEN", or 2) as password in a Basic authentication (random user name, for example "osm"). I have not been able to make them work - not sure how to do it.

Attachments (0)

Change History (8)

comment:1 Changed 6 months ago by wiktorn

URL's for downloading tiles are generated from get capabilities document and I guess that they do not contain api_key and that would bend the WMS standard a bit.

The easiest way, that's already supported is to use custom header X-WAAPI-TOKEN. In imagery definition provide:

<custom-http-header header-name="X-WAAPI-TOKEN" header-value="<key>" />

And that should work. If you enable advanced mode in preferences you will also have ability to set this header when adding WMS layer, though then - it will work only for you.

You can also use HTTP basic authentication. You need to base64 encode following string osm:<key> (if you would like to set the user to osm). You can use for example https://www.base64encode.org/ then you need to set custom HTTP header:

<custom-http-header header-name="Authorization" header-value="Basic <base64value>" />

comment:2 Changed 6 months ago by nkamapper

Thank you for this input.

I have made a new entry here using the custom-http-header: Maps/Norway#NorwayOrthophotohistoric

There are a couple of problems:

1) JOSM fails to load the layers (the menu window) with this method. Also in the "Add Imagery URL" window in JOSM, the "3. Get layers" button does not seem to use the custom headers information in section 5 of that window when loading the layers.

2) When expanding the "2. Enter GetCapabilitites URL" to include the api_key, the layers will get loaded, but after selecting a layer the generated URL contains a "/" instead of a "?", resulting in errors. This also happens when the wms endpoint has been ticked.

http://waapi.webatlas.no/wms-orto-hist/FORMAT=image/png&TRANSPARENT=TRUE&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&LAYERS=Oslo-1937&STYLES=&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}

I have also tried basic authentication, however JOSM produces the same problems.

comment:3 Changed 6 months ago by wiktorn

Resolution: fixed
Status: newclosed

In 13872/josm:

Fix WMS_ENDPOINT headers.

  • Use custom headers when calling GetCapabilities on server
  • Pass custom headers and other imagery attributes after layer selection
  • if GetCapabilities document defines GetMap url, ensure that it ends with '?'

Closes: #16330

comment:4 Changed 6 months ago by Don-vip

Milestone: 18.06

comment:5 Changed 6 months ago by wiktorn

In 13878/josm:

Fix identifying if getMapUrl contains query part.

See: #16330

comment:6 Changed 6 months ago by nkamapper

Great, thank you!

comment:7 Changed 6 months ago by nkamapper

Unfortunately, certain wms endpoints now get two question marks, for example:

https://wms.geonorge.no/skwms1/wms.friluftsruter2??FORMAT=image/png&TRANSPARENT=TRUE&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&LAYERS=Fotrute&STYLES=&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}

comment:8 Changed 6 months ago by wiktorn

Indeed, I introduced this regression. This was fixed yesterday in [13883]

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.