LazMapViewer: Add urls for OpenWeatherMaps.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6889 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2019-05-04 17:11:26 +00:00
parent f3098589fc
commit 2e29cc575c
2 changed files with 31 additions and 1 deletions

View File

@ -421,7 +421,11 @@ begin
try try
HERE_AppID := ini.ReadString('HERE', 'APP_ID', ''); HERE_AppID := ini.ReadString('HERE', 'APP_ID', '');
HERE_AppCode := ini.ReadString('HERE', 'APP_CODE', ''); HERE_AppCode := ini.ReadString('HERE', 'APP_CODE', '');
if (HERE_AppID <> '') and (HERE_AppCode <> '') then begin OpenWeatherMap_ApiKey := ini.ReadString('OpenWeatherMap', 'API_Key', '');
if ((HERE_AppID <> '') and (HERE_AppCode <> '')) or
(OpenWeatherMap_ApiKey <> '') then
begin
MapView.Engine.ClearMapProviders; MapView.Engine.ClearMapProviders;
MapView.Engine.RegisterProviders; MapView.Engine.RegisterProviders;
MapView.GetMapProviders(CbProviders.Items); MapView.GetMapProviders(CbProviders.Items);
@ -585,6 +589,9 @@ begin
if HERE_AppCode <> '' then if HERE_AppCode <> '' then
ini.WriteString('HERE', 'APP_CODE', HERE_AppCode); ini.WriteString('HERE', 'APP_CODE', HERE_AppCode);
if OpenWeatherMap_ApiKey <> '' then
ini.WriteString('OpenWeatherMap', 'API_Key', OpenWeatherMap_ApiKey);
ini.EraseSection('Locations'); ini.EraseSection('Locations');
for i := 0 to CbLocations.Items.Count-1 do for i := 0 to CbLocations.Items.Count-1 do
ini.WriteString('Locations', 'Item'+IntToStr(i), CbLocations.Items[i]); ini.WriteString('Locations', 'Item'+IntToStr(i), CbLocations.Items[i]);

View File

@ -177,6 +177,7 @@ procedure SplitGps(AValue: Double; out ADegs, AMins, ASecs: Double);
var var
HERE_AppID: String = ''; HERE_AppID: String = '';
HERE_AppCode: String = ''; HERE_AppCode: String = '';
OpenWeatherMap_ApiKey: String = '';
implementation implementation
@ -921,6 +922,28 @@ begin
1, 19, 4, @GetYahooSvr); 1, 19, 4, @GetYahooSvr);
end; end;
if (OpenWeatherMap_ApiKey <> '') then begin
// Registration required to access OpenWeatherMaps
// https://home.openweathermap.org/users/sign_up
// Store the API key found on the website in the ini file of the demo under
// key [OpenWeatherMap] and API_Key and restart the demo
AddMapProvider('OpenWeatherMap Clouds',
'https://tile.openweathermap.org/map/clouds_new/%z%/%x%/%y%.png?appid=' + OpenWeatherMap_ApiKey,
1, 19, 1, nil);
AddMapProvider('OpenWeatherMap Precipitation',
'https://tile.openweathermap.org/map/precipitation_new/%z%/%x%/%y%.png?appid=' + OpenWeatherMap_ApiKey,
1, 19, 1, nil);
AddMapProvider('OpenWeatherMap Pressure',
'https://tile.openweathermap.org/map/pressure_new/%z%/%x%/%y%.png?appid=' + OpenWeatherMap_ApiKey,
1, 19, 1, nil);
AddMapProvider('OpenWeatherMap Temperature',
'https://tile.openweathermap.org/map/temp_new/%z%/%x%/%y%.png?appid=' + OpenWeatherMap_ApiKey,
1, 19, 1, nil);
AddMapProvider('OpenWeatherMap Wind',
'https://tile.openweathermap.org/map/wind_new/%z%/%x%/%y%.png?appid=' + OpenWeatherMap_ApiKey,
1, 19, 1, nil);
end;
{ The Ovi Maps (former Nokia maps) are no longer available. { The Ovi Maps (former Nokia maps) are no longer available.
AddMapProvider('Ovi Normal', AddMapProvider('Ovi Normal',