Hi Nigel
Yes that's right but I thought I had to modify source code to do it, I never realised that you could dynamically create one on the fly like you have, I should have read the help more fully.
Anyway I've tried to do it that way :-
Map := TIESlippyMap.Create('https://[abc].tile.thunderforest.com/?apikey=$0','Cache');
Map.UserKey := 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
and the GetProviderURL() produces a URL like this
'https://a.tile.thunderforest.com/?apikey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/14/4823/6166.png'
This doesn't work because the 'apikey=' precedes the zoom levels and the lat long folder structure, this is how it should look with the API key at the very end:-
'https://tile.thunderforest.com/outdoors/14/4823/6166.png?apikey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
To get around this I modified the GetFileURL function to put the API key at the end.
This generates a URL that works perfectly in a browser but not in code, so I must have screwed something up further downline.
Map:=TIESlippyMap.Create('https://tile.thunderforest.com/outdoors','D:\Maps\OpenCycleMapOutdoors');
function TIESlippyMap.GetFileURL(tileX: integer; tileY: integer): string;
var
fpath: string;
begin
if Pos('thunderforest', m_providerURL)>0 then
result := Format('%s/%d/%d/%d.png?apikey=%s', [m_providerURL, m_zoom, tileX, tileY, m_userKey])
else
result := Format('%s/%d/%d/%d.png', [GetProviderURL(), m_zoom, tileX, tileY]);
if m_cachePath <> '' then
begin
fpath := GetCachedFileName(tileX, tileY);
if IEFileExists(fpath) then
result := fpath;
end;
end;
Bruce.