You've already forked lazarus-ccr
LazMapViewer: Fix support of OpenCycleMap and OpenStreetMap_Transport map providers which require an API key.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7950 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -807,19 +807,19 @@ object MainForm: TMainForm
|
||||
end
|
||||
object GeoNames: TMVGeoNames
|
||||
OnNameFound = GeoNamesNameFound
|
||||
left = 240
|
||||
top = 192
|
||||
Left = 240
|
||||
Top = 192
|
||||
end
|
||||
object OpenDialog: TOpenDialog
|
||||
DefaultExt = '.pgx'
|
||||
Filter = 'GPX files (*.gpx)|*.gpx|All files (*.*)|*.*'
|
||||
left = 240
|
||||
top = 456
|
||||
Left = 240
|
||||
Top = 456
|
||||
end
|
||||
object FontDialog: TFontDialog
|
||||
MinFontSize = 0
|
||||
MaxFontSize = 0
|
||||
left = 680
|
||||
top = 296
|
||||
Left = 680
|
||||
Top = 296
|
||||
end
|
||||
end
|
||||
|
@@ -574,9 +574,11 @@ begin
|
||||
HERE_AppID := ini.ReadString('HERE', 'APP_ID', '');
|
||||
HERE_AppCode := ini.ReadString('HERE', 'APP_CODE', '');
|
||||
OpenWeatherMap_ApiKey := ini.ReadString('OpenWeatherMap', 'API_Key', '');
|
||||
ThunderForest_ApiKey := ini.ReadString('ThunderForest', 'API_Key', '');
|
||||
|
||||
if ((HERE_AppID <> '') and (HERE_AppCode <> '')) or
|
||||
(OpenWeatherMap_ApiKey <> '') then
|
||||
(OpenWeatherMap_ApiKey <> '') or
|
||||
(ThunderForest_ApiKey <> '') then
|
||||
begin
|
||||
MapView.Engine.ClearMapProviders;
|
||||
MapView.Engine.RegisterProviders;
|
||||
@@ -762,6 +764,9 @@ begin
|
||||
if OpenWeatherMap_ApiKey <> '' then
|
||||
ini.WriteString('OpenWeatherMap', 'API_Key', OpenWeatherMap_ApiKey);
|
||||
|
||||
if ThunderForest_ApiKey <> '' then
|
||||
ini.WriteString('ThunderForest', 'API_Key', ThunderForest_ApiKey);
|
||||
|
||||
ini.EraseSection('Locations');
|
||||
for i := 0 to CbLocations.Items.Count-1 do
|
||||
ini.WriteString('Locations', 'Item'+IntToStr(i), CbLocations.Items[i]);
|
||||
|
@@ -174,6 +174,7 @@ var
|
||||
HERE_AppID: String = '';
|
||||
HERE_AppCode: String = '';
|
||||
OpenWeatherMap_ApiKey: String = '';
|
||||
ThunderForest_ApiKey: String = '';
|
||||
|
||||
|
||||
implementation
|
||||
@@ -980,9 +981,23 @@ begin
|
||||
AddMapProvider('OpenStreetMap.fr Hot', ptEPSG3857, 'https://%serv%.tile.openstreetmap.fr/hot/%z%/%x%/%y%.png', 0, 18, 3, @GetSvrLetter);
|
||||
AddMapProvider('Open Topo Map', ptEPSG3857, 'http://%serv%.tile.opentopomap.org/%z%/%x%/%y%.png', 0, 19, 3, @GetSvrLetter);
|
||||
AddMapProvider('OpenStreetMap.fr Cycle Map', ptEPSG3857, 'https://dev.%serv%.tile.openstreetmap.fr/cyclosm/%z%/%x%/%y%.png', 0, 18, 3, @GetSvrLetter);
|
||||
// todo: requires an optional key
|
||||
AddMapProvider('Open Cycle Map', ptEPSG3857, 'http://%serv%.tile.opencyclemap.org/cycle/%z%/%x%/%y%.png', 0, 18, 3, @GetSvrLetter);
|
||||
AddMapProvider('OpenStreetMap Transport', ptEPSG3857, 'https://%serv%.tile.thunderforest.com/transport/%z%/%x%/%y%.png', 0, 18, 3, @GetSvrLetter);
|
||||
|
||||
// API Key required
|
||||
if (ThunderForest_ApiKey <> '') then
|
||||
begin
|
||||
// Registration required to access OpenCycleMap or OpenStreetMap Transport:
|
||||
// https://www.thunderforest.com/docs/apikeys/
|
||||
// The API key is found on their website after registration and logging in.
|
||||
// Store the API key in the ini file under key [ThunderForest] as item API_Key
|
||||
AddMapProvider('Open Cycle Map', ptEPSG3857, 'https://tile.thunderforest.com/cycle/%z%/%x%/%y%.png?apikey=' + ThunderForest_ApiKey, 0, 18, 3, nil, nil, nil, nil);
|
||||
AddMapProvider('OpenStreetMap Transport', ptEPSG3857, 'https://tile.thunderforest.com/transport/%z%/%x%/%y%.png?apikey=' + ThunderForest_ApiKey, 0, 18, 3, nil, nil, nil, nil);
|
||||
|
||||
// The following providers could be used alternatively. No API key required,
|
||||
// but gray "API Key required" watermark and maybe other restrictions!
|
||||
// AddMapProvider('Open Cycle Map', ptEPSG3857, 'http://%serv%.tile.opencyclemap.org/cycle/%z%/%x%/%y%.png', 0, 18, 3, @GetSvrLetter);
|
||||
// AddMapProvider('OpenStreetMap Transport', ptEPSG3857, 'https://%serv%.tile.thunderforest.com/transport/%z%/%x%/%y%.png', 0, 18, 3, @GetSvrLetter);
|
||||
end;
|
||||
|
||||
|
||||
// Google
|
||||
AddMapProvider('Google Maps', ptEPSG3857, 'http://mt%serv%.google.com/vt/lyrs=m@145&v=w2.104&x=%x%&y=%y%&z=%z%', 0, 19, 4, nil);
|
||||
|
Reference in New Issue
Block a user