Add a vintage of the Esri World Imagery Wayback on JOSM

Hello everyone,

I’m interested in using some vintage Esri satellite imagery, which is possible with Esri’s World Imagery Wayback (World Imagery Wayback).

Deane Kensok’s diary, “Using Esri Wayback Imagery in OSM Editors” details this.

Following his diary I can get it to work on iD, but I can’t get it to work on JOSM (my favorite editor, which is on the latest version 19160).

I tried this with this imagery:

I get the following URL:

I tried to add it on JOSM like this:

But when I validate, I get the following error message:
image

org.openstreetmap.josm.data.imagery.WMTSTileSource$WMTSGetCapabilitiesException:
Error parsing WMTS capabilities document: ParseError at [row,col]:[1,1]
Message: Byte 1 of 1-byte UTF-8 sequence invalid.

Does anyone understand this error message? Do you know how I could solve this problem?

Thanks in advance!

The solution was to add a TMS instead of a WMTS. And with TMS it works!

3 Likes

Adding on to this, since I can’t find anybody else who’s figured this out and posted it:

Esri World Imagery Wayback does have a WMTS capabilities endpoint exposed—but they broke the XML namespaces in the file by upgrading the URIs to HTTPS. Because of this, JOSM raises a cryptic error message about the endpoint having no layers when trying to add the imagery source (other editors that comply with the WMTS schema also do this). To fix this, you can

  1. download the file;
  2. modify your local copy by rewriting the root Capabilities element, substituting all instances of https with http in each URI;
<!-- PRE-SUBTITUTION -->
<Capabilities xmlns="https://www.opengis.net/wmts/1.0"
              xmlns:ows="https://www.opengis.net/ows/1.1"
              xmlns:xlink="https://www.w3.org/1999/xlink"
              xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
              xmlns:gml="https://www.opengis.net/gml"
              xsi:schemaLocation="https://www.opengis.net/wmts/1.0 https://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd"
              version="1.0.0">

<!-- POST-SUBSTITUTION-->
<Capabilities xmlns="http://www.opengis.net/wmts/1.0"
              xmlns:ows="http://www.opengis.net/ows/1.1"
              xmlns:xlink="http://www.w3.org/1999/xlink"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns:gml="http://www.opengis.net/gml"
              xsi:schemaLocation="http://www.opengis.net/wmts/1.0 https://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd"
              version="1.0.0">
  1. import the modified capabilities document as an WMTS imagery source, using the URI file:///<PATH_TO_FILE>.

If you’ve succeeded, you should now be able to pull any available Wayback imagery without having to manually add each one as a TMS layer per Kensok’s diary entry on this. I would recommend selecting the layers with the matrix set identifier “default028mm”, since they have better quality imagery for whatever reason.

Someone should probably file a bug report with Esri for this; in the mean time, this is the least annoying solution. You can automate this with a script and cron job or task scheduler of your choice; I use this script

import re

import requests

WMTSCAPABILITIES_OUTPUT = r"D:\projects\osm\esri\wayback_WMTSCapabilities.xml"

ESRI_WAYBACK_WMTSCAPABILITIES = (
    "https://wayback.maptiles.arcgis.com"
    "/arcgis/rest/services/world_imagery/mapserver"
    "/wmts/1.0.0/wmtscapabilities.xml"
)

XML_NAMESPACE_REGEX = re.compile(
    r"(?:((?:xmlns|xsi)(?::\w+)?)=\"https?:\/\/([^\"]*?)\")+"
)

with requests.get(ESRI_WAYBACK_WMTSCAPABILITIES) as r:
    if r.status_code != 200:
        exit()
    with open(WMTSCAPABILITIES_OUTPUT, "w") as f:
        body = XML_NAMESPACE_REGEX.sub(r'\1="http://\2"', r.text)
        f.write(body)

and Windows task scheduler. Go wild, ig.

Happy mapping :slightly_smiling_face:

1 Like