@@ -1,7 +1,10 @@ | |||||
[PARAMS] | [PARAMS] | ||||
GUID={1123ADB1-4561-4280-9224-D4690321117E} | |||||
asLayer=1 | |||||
GUID={1123ADB1-4561-4280-9224-D4690321117E} | |||||
ParentSubMenu_ru=Ìàðøðóòû è GPS-Òðåêè | |||||
ParentSubMenu_uk=Ìàðøðóòû è GPS-Òðåêè | |||||
ParentSubMenu=Ways and GPS-Tracks | |||||
name=WayMarkeredTrails Cycling | name=WayMarkeredTrails Cycling | ||||
asLayer=1 | |||||
NameInCache=waymarkedtrails_cycling | NameInCache=waymarkedtrails_cycling | ||||
DefURLBase=https://tile.waymarkedtrails.org/cycling | DefURLBase=https://tile.waymarkedtrails.org/cycling | ||||
ContentType=image/png | ContentType=image/png | ||||
@@ -10,6 +13,5 @@ projection=1 | |||||
sradiusa=6378137 | sradiusa=6378137 | ||||
sradiusb=6378137 | sradiusb=6378137 | ||||
DefHotKey=16463 | DefHotKey=16463 | ||||
PARENTSUBMENU=Tracks | |||||
RequestHead=Referer: http://www.openstreetmap.org/ | RequestHead=Referer: http://www.openstreetmap.org/ | ||||
@@ -1,7 +1,10 @@ | |||||
[PARAMS] | [PARAMS] | ||||
GUID={1123ADB1-4561-4280-9225-D4690321117E} | |||||
asLayer=1 | |||||
GUID={1123ADB1-4561-4280-9225-D4690321117E} | |||||
ParentSubMenu_ru=Ìàðøðóòû è GPS-Òðåêè | |||||
ParentSubMenu_uk=Ìàðøðóòû è GPS-Òðåêè | |||||
ParentSubMenu=Ways and GPS-Tracks | |||||
name=WayMarkeredTrails iking | name=WayMarkeredTrails iking | ||||
asLayer=1 | |||||
NameInCache=waymarkedtrails_hiking | NameInCache=waymarkedtrails_hiking | ||||
DefURLBase=https://tile.waymarkedtrails.org/hiking | DefURLBase=https://tile.waymarkedtrails.org/hiking | ||||
ContentType=image/png | ContentType=image/png | ||||
@@ -10,6 +13,5 @@ projection=1 | |||||
sradiusa=6378137 | sradiusa=6378137 | ||||
sradiusb=6378137 | sradiusb=6378137 | ||||
DefHotKey=16463 | DefHotKey=16463 | ||||
PARENTSUBMENU=Tracks | |||||
RequestHead=Referer: http://www.openstreetmap.org/ | RequestHead=Referer: http://www.openstreetmap.org/ | ||||
@@ -1,9 +1,12 @@ | |||||
[PARAMS] | [PARAMS] | ||||
GUID={1123ADB1-4561-4280-9222-D4690321117E} | |||||
asLayer=1 | |||||
GUID={1123ADB1-4561-4280-9222-D4690321117E} | |||||
ParentSubMenu_ru=Ìàðøðóòû è GPS-Òðåêè | |||||
ParentSubMenu_uk=Ìàðøðóòû è GPS-Òðåêè | |||||
ParentSubMenu=Ways and GPS-Tracks | |||||
name_ru=Êàðòà GPS-òðåêîâ OSM | name_ru=Êàðòà GPS-òðåêîâ OSM | ||||
name=Map GPS-track OSM | name=Map GPS-track OSM | ||||
name_uk=Êàðòà GPS-òðåêîâ OSM | |||||
name_uk=Êàðòà GPS-òðåêîâ OSM | |||||
asLayer=1 | |||||
NameInCache=osm_gps_tile | NameInCache=osm_gps_tile | ||||
DefURLBase=http://b.gps-tile.openstreetmap.org/lines | DefURLBase=http://b.gps-tile.openstreetmap.org/lines | ||||
ContentType=image/png | ContentType=image/png | ||||
@@ -12,7 +15,6 @@ projection=1 | |||||
sradiusa=6378137 | sradiusa=6378137 | ||||
sradiusb=6356752 | sradiusb=6356752 | ||||
DefHotKey=16463 | DefHotKey=16463 | ||||
PARENTSUBMENU=Tracks | |||||
IteratorSubRectSize=8,8 | IteratorSubRectSize=8,8 | ||||
RequestHead=Referer: http://www.openstreetmap.org/ | RequestHead=Referer: http://www.openstreetmap.org/ | ||||
License=(c) OpenStreetMap contributors, CC-BY-SA | License=(c) OpenStreetMap contributors, CC-BY-SA |
@@ -1,7 +1,10 @@ | |||||
[PARAMS] | [PARAMS] | ||||
GUID={1123ADB1-4562-4280-9222-D4690321117E} | GUID={1123ADB1-4562-4280-9222-D4690321117E} | ||||
ParentSubMenu_ru=Ìàðøðóòû è GPS-Òðåêè | |||||
ParentSubMenu_uk=Ìàðøðóòû è GPS-Òðåêè | |||||
ParentSubMenu=Ways and GPS-Tracks | |||||
name=OpenSnowMap (pistes layer) | |||||
asLayer=1 | asLayer=1 | ||||
name=OpenSnowMap (pistes layer) | |||||
NameInCache=opensnowmap_overlay | NameInCache=opensnowmap_overlay | ||||
DefURLBase=http://www.opensnowmap.org/pistes | DefURLBase=http://www.opensnowmap.org/pistes | ||||
ContentType=image/png | ContentType=image/png | ||||
@@ -10,7 +13,6 @@ projection=1 | |||||
sradiusa=6378137 | sradiusa=6378137 | ||||
sradiusb=6378137 | sradiusb=6378137 | ||||
DefHotKey=16463 | DefHotKey=16463 | ||||
PARENTSUBMENU=Tracks | |||||
IteratorSubRectSize=8,8 | IteratorSubRectSize=8,8 | ||||
RequestHead=Referer: http://www.opensnowmap.org/ | RequestHead=Referer: http://www.opensnowmap.org/ | ||||
@@ -0,0 +1,216 @@ | |||||
// ----------------------------------------------------------------------------- | |||||
// --- Óíèâåðñàëüíûé àäàïòåð îò AnyGIS | |||||
// ----------------------------------------------------------------------------- | |||||
// Ýòîò ñêðèïò ïðèçâàí óïðîñòèòü äîáàâëåíèå íîâûõ êàðò â SasPlanet. | |||||
// Îí èçáàâèò íà÷èíàþùèõ ïîëüçîâàòåëåé îò íåîáõîäèìîñòè ïðîãðàììèðîâàòü íà Pascal, | |||||
// ÷òîáû âíîñèòü èçìåíåíèÿ â ôàéë GetUrlScript.txt ïðè äîáàâëåíèè êàæäîé íîâîé êàðòû. | |||||
// Òåïåðü ìîæíî ïðîñòî âñòàâëÿòü ïðèâû÷íûé URL ñ çàãëóøêàìè òèïà {x}, {y}, {z} | |||||
// â ïîëå DefURLBase èç ôàéëà params.txt. Íà ïðèìåð, òàê: | |||||
// | |||||
// DefURLBase=http://{s:a,b,c}.tile.openstreetmap.org/{z}/{x}/{y}.png | |||||
// Ñêðèïò ðàçðàáàòûâàëè Nnngrach è Erelen | |||||
// --- Ñïèñîê äîñòóïíûõ ïàðàìåòðîâ äëÿ àâòîçàìåíû: | |||||
// {x} Íîìåð òàéëà ïî îñè X. (Êàê â êàðòàõ OpenStreetMaps) | |||||
// {y} Íîìåð òàéëà ïî îñè Y. (Êàê â êàðòàõ OpenStreetMaps) | |||||
// {z} Óðîâåíü ïðèáëèæåíèÿ/çóìà. (Êàê â êàðòàõ OpenStreetMaps) | |||||
// {q} Íîìåð òàéëà â ñèñòåìå QuadKey. (Êàê â êàðòàõ Bing) | |||||
// {-y} Èíâåðòèðîâàííûé íîìåð òàéëà ïî îñè Y. (Êàê íà ñàéòå Nakarte) | |||||
// {bbox} Êîîðäèíàòû ãðàíèö òàéëà. (Äëÿ WMS ñåðâåðîâ) | |||||
// {timeStamp} Òåêóùåå âðåìÿ â ôîðìàòå UnixTime. (Äëÿ êàðò ñ ïðîáêàìè) | |||||
// {z+1} Óðîâåíü çóìà. (Äëÿ êàðò, õðàíÿùèõñÿ â ôîðìàòå SasPlanet) | |||||
// {x/1024} Íîìåð ïåðâîé ïîäïàïêè (Äëÿ êàðò, â ôîðìàòå SasPlanet) | |||||
// {y/1024} Íîìåð âòîðîé ïîäïàïêè (Äëÿ êàðò, â ôîðìàòå SasPlanet) | |||||
// {s:a,b,c} Áóêâà èëè öèôðà ñ íîìåðîì çåðêàëà ñåðâåðà. | |||||
//  äàííîì ñëó÷àå - îäíà èç áóêâ (A,B,C), âûáðàííàÿ ðàíäîìíî. | |||||
// Ñîâåò äëÿ íà÷èíàþùèõ: åñëè õîòèòå ðàçîáðàòüñÿ â ýòîì êîäå, | |||||
// òî óäîáíåå âñåãî ÷èòàòü åãî ñ êîíöà. | |||||
// Åùå îäèí ñîâåò: åñëè áóäåòå ïèñàòü ñâîè ñêðèïòû, | |||||
// òî âûâîä â êîíñîëü (à òî÷íåå, â îêíî Debug Output ) äåëàåòñÿ òàê: | |||||
// | |||||
// writeLn('Hello Sas.Planet!'); | |||||
// ----------------------------------------------------------------------------- | |||||
// --- 4. Âñïîìîãàòåëüíûå ôóíêöèè | |||||
// ----------------------------------------------------------------------------- | |||||
// --- Ïðîâåðèòü, ñîäåðæèò ëè îäíà ñòðîêà äðóãóþ? | |||||
function isContains(findingText: string; inSourceText: string) : boolean; | |||||
begin | |||||
result := pos(findingText, inSourceText) <> 0; | |||||
end; | |||||
// --- Îêðóãëåíèå äî íóæíîãî êîëè÷åñòâà çíàêîâ ïîñëå çàïÿòîé | |||||
// --- (ñòàíäàðòíûå ôóíêöèè îêðóãëåíèÿ ó ìåíÿ ïî÷åìó-òî íå çàðàáîòàëè) | |||||
function roundFor(sourceNumber: Double ; digitAfterComma: integer) : string; | |||||
var | |||||
intPart, floatPart : integer; | |||||
begin | |||||
intPart := floor(sourceNumber); | |||||
floatPart := floor( (sourceNumber - intPart) * round(intPower(10, digitAfterComma)) ) | |||||
result := intToStr(intPart) + '.' + intToStr(floatPart) | |||||
end; | |||||
// --- Âû÷èñëèòü íîìåð òàéëà â ñèñòåìå Quadkey (èñïîëüçóåòñÿ â êàðòàõ Bing) | |||||
function getQuadkeyText(x: integer; y: integer; z: integer) : string; | |||||
var | |||||
i, q : byte; | |||||
begin | |||||
result:=''; | |||||
for i:=1 to z do begin | |||||
q:=0; | |||||
if x mod 2 = 1 then q := q + 1; | |||||
if y mod 2 = 1 then q := q + 2; | |||||
x := x div 2; | |||||
y := y div 2; | |||||
result := intToStr(q) + result; | |||||
end; | |||||
end; | |||||
// ----------------------------------------------------------------------------- | |||||
// --- 3. Åñëè òðåáóåòñÿ, òî ïîäñòàâèòü èìÿ äëÿ çåðêàëà ñåðâåðà | |||||
// --- íà ìåñòî çàãëóøêè òèïà {s: a,b,c} | |||||
// ----------------------------------------------------------------------------- | |||||
type | |||||
TSubst = record | |||||
mask, val : string; | |||||
end; | |||||
TSubsts = record | |||||
count : integer; | |||||
s : array [0..15] of TSubst; | |||||
end; | |||||
function replaceServerName(url: string) : string; | |||||
var | |||||
s, ss : string; | |||||
sarr : array [0..9] of string; | |||||
sarr_l, p : integer; | |||||
begin | |||||
s := RegExprGetMatchSubStr(url, '\{[sS]:([^}]+)\}', 0); | |||||
if s <> '' then begin | |||||
ss := s; | |||||
ss := StringReplace(ss, '{s:', '', [rfIgnoreCase]); | |||||
ss := StringReplace(ss, '}', '', [rfIgnoreCase]); | |||||
ss := ss + ','; | |||||
sarr_l := 0; | |||||
while ss <> '' do begin | |||||
p := pos(',', ss); | |||||
if p = 0 then p := length(ss); | |||||
sarr[sarr_l] := copy(ss, 1, p-1); | |||||
sarr_l := sarr_l + 1; | |||||
delete(ss, 1, p); | |||||
end; | |||||
url := StringReplace(url, s, sarr[random(sarr_l)], []); | |||||
end; | |||||
Result := url; | |||||
end; | |||||
// ----------------------------------------------------------------------------- | |||||
// --- 2. Åñëè òðåáóåòñÿ, òî âû÷èñëèòü è ïîäñòàâèòü â øàáëîí URL àäðåñà | |||||
// --- íóæíûå çíà÷åíèÿ íà ìåñòî çàãëóøåê òèïà {x}, {y}, {z}. | |||||
// ----------------------------------------------------------------------------- | |||||
function replaceLeafletPlaceholders(urlTemplate: string; x: integer; y: integer; z: integer) : string; | |||||
var | |||||
options: tReplaceFlags; | |||||
calculatedValue: string; | |||||
begin | |||||
options := [rfReplaceAll, rfIgnoreCase]; | |||||
result := urlTemplate; | |||||
if isContains('{x}', result) then begin | |||||
calculatedValue := intToStr(x); | |||||
result := stringReplace( result, '{x}', calculatedValue, options) | |||||
end; | |||||
if isContains('{y}', result) then begin | |||||
calculatedValue := intToStr(y); | |||||
result := stringReplace( result, '{y}', calculatedValue, options) | |||||
end; | |||||
if isContains('{z}', result) then begin | |||||
calculatedValue := intToStr(z-1); | |||||
result := stringReplace( result, '{z}', calculatedValue, options) | |||||
end; | |||||
if isContains('{z+1}', result) then begin | |||||
calculatedValue := intToStr(z); | |||||
result := stringReplace( result, '{z+1}', calculatedValue, options) | |||||
end; | |||||
if isContains('{x/1024}', result) then begin | |||||
calculatedValue := intToStr(x div 1024); | |||||
result := stringReplace( result, '{x/1024}', calculatedValue, options) | |||||
end; | |||||
if isContains('{y/1024}', result) then begin | |||||
calculatedValue := intToStr(y div 1024); | |||||
result := stringReplace( result, '{y/1024}', calculatedValue, options) | |||||
end; | |||||
if isContains('{-y}', result) then begin | |||||
calculatedValue := intToStr( round(intPower(2, z-1)) - 1 - y); | |||||
result := stringReplace( result, '{-y}', calculatedValue, options) | |||||
end; | |||||
if isContains('{q}', result) then begin | |||||
calculatedValue := getQuadkeyText(x, y, z); | |||||
result := stringReplace( result, '{q}', calculatedValue, options) | |||||
end; | |||||
if isContains('{bbox}', result) then begin | |||||
result := stringReplace( result, '{bbox}', '{Left},{Bottom},{Right},{Top}', options) | |||||
result := stringReplace( result, '{Left}', roundFor(GetLMetr,8), options) | |||||
result := stringReplace( result, '{Bottom}', roundFor(GetBMetr,8), options) | |||||
result := stringReplace( result, '{Right}', roundFor(GetRMetr,8), options) | |||||
result := stringReplace( result, '{Top}', roundFor(GetTMetr,8), options) | |||||
// Äåëàþ çàìåíó â ïÿòü îïåðàöèé ïîòîìó, ÷òî ïðè ïîïûòêå | |||||
// ñäåëàòü âñå îäíîé ñòðîêîé âîçíèêàåò îøèáêà. | |||||
// Âîçìîæíî êàêîå-òî îãðàíè÷åíèå íà ïàìÿòü. | |||||
end; | |||||
if isContains('{timeStamp}', result) then begin | |||||
calculatedValue := IntToStr(GetUnixTime); | |||||
result := stringReplace( result, '{timeStamp}', calculatedValue, options) | |||||
end; | |||||
end; | |||||
// ----------------------------------------------------------------------------- | |||||
// --- 1. Ñòàðò ñêðèïòà. Çàïóñòèòü âû÷èñëåíèå URL-àäðåñà òàéëà. | |||||
// --- Ñêà÷àòü òàéë ïî ïîëó÷åííîìó URL. | |||||
// ----------------------------------------------------------------------------- | |||||
begin | |||||
resultURL := replaceLeafletPlaceholders(getURLBase, getX, getY, getZ); | |||||
resultURL := replaceServerName(resultURL); | |||||
end. |
@@ -0,0 +1,7 @@ | |||||
Ýòîò ôàéë áûë ñîçäàí àâòîìàòè÷åñêè ñ ïîìîùüþ ôàéëî-ãåíåðàòîðà AnyGIS.ru | |||||
Åñëè âû çàìåòèëè îøèáêó, ñâÿæèòåñü ñî ìíîé è ñîîáùèòå î íåé: | |||||
https://t.me/anygis | |||||
https://vk.com/anygis | |||||
anygis@bk.ru |
@@ -0,0 +1,19 @@ | |||||
| |||||
[PARAMS] | |||||
GUID={7E330845-C966-4B63-B909-5214A016BDB1} | |||||
ParentSubMenu_ru=Маршруты и GPS-Треки | |||||
ParentSubMenu_uk=Маршруты и GPS-Треки | |||||
ParentSubMenu=Ways and GPS-Tracks | |||||
name_ru=Strava Heatmap - Все слои | |||||
name_uk=Strava Heatmap - Все слои | |||||
name=Strava Heatmap - All layers | |||||
NameInCache=Tracks_Strava_All | |||||
asLayer=1 | |||||
projection=1 | |||||
sradiusa=6378137 | |||||
sradiusb=6378137 | |||||
DefURLBase=https://anygis.ru/api/v1/Tracks_Strava_All/{x}/{y}/{z} | |||||
RequestHead=Referer:https://www.strava.com/heatmap\r\nConnection: keep-alive\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36\r\nAccept: image/webp,image/apng,image/*,*/*;q=0.8\r\nAccept-Encoding: gzip, deflate\r\nAccept-Language: ru,en-US;q=0.9,en;q=0.8 | |||||
ContentType=image/jpeg,image/png | |||||
Ext=.png | |||||
License= © Strava |
@@ -0,0 +1,216 @@ | |||||
// ----------------------------------------------------------------------------- | |||||
// --- Óíèâåðñàëüíûé àäàïòåð îò AnyGIS | |||||
// ----------------------------------------------------------------------------- | |||||
// Ýòîò ñêðèïò ïðèçâàí óïðîñòèòü äîáàâëåíèå íîâûõ êàðò â SasPlanet. | |||||
// Îí èçáàâèò íà÷èíàþùèõ ïîëüçîâàòåëåé îò íåîáõîäèìîñòè ïðîãðàììèðîâàòü íà Pascal, | |||||
// ÷òîáû âíîñèòü èçìåíåíèÿ â ôàéë GetUrlScript.txt ïðè äîáàâëåíèè êàæäîé íîâîé êàðòû. | |||||
// Òåïåðü ìîæíî ïðîñòî âñòàâëÿòü ïðèâû÷íûé URL ñ çàãëóøêàìè òèïà {x}, {y}, {z} | |||||
// â ïîëå DefURLBase èç ôàéëà params.txt. Íà ïðèìåð, òàê: | |||||
// | |||||
// DefURLBase=http://{s:a,b,c}.tile.openstreetmap.org/{z}/{x}/{y}.png | |||||
// Ñêðèïò ðàçðàáàòûâàëè Nnngrach è Erelen | |||||
// --- Ñïèñîê äîñòóïíûõ ïàðàìåòðîâ äëÿ àâòîçàìåíû: | |||||
// {x} Íîìåð òàéëà ïî îñè X. (Êàê â êàðòàõ OpenStreetMaps) | |||||
// {y} Íîìåð òàéëà ïî îñè Y. (Êàê â êàðòàõ OpenStreetMaps) | |||||
// {z} Óðîâåíü ïðèáëèæåíèÿ/çóìà. (Êàê â êàðòàõ OpenStreetMaps) | |||||
// {q} Íîìåð òàéëà â ñèñòåìå QuadKey. (Êàê â êàðòàõ Bing) | |||||
// {-y} Èíâåðòèðîâàííûé íîìåð òàéëà ïî îñè Y. (Êàê íà ñàéòå Nakarte) | |||||
// {bbox} Êîîðäèíàòû ãðàíèö òàéëà. (Äëÿ WMS ñåðâåðîâ) | |||||
// {timeStamp} Òåêóùåå âðåìÿ â ôîðìàòå UnixTime. (Äëÿ êàðò ñ ïðîáêàìè) | |||||
// {z+1} Óðîâåíü çóìà. (Äëÿ êàðò, õðàíÿùèõñÿ â ôîðìàòå SasPlanet) | |||||
// {x/1024} Íîìåð ïåðâîé ïîäïàïêè (Äëÿ êàðò, â ôîðìàòå SasPlanet) | |||||
// {y/1024} Íîìåð âòîðîé ïîäïàïêè (Äëÿ êàðò, â ôîðìàòå SasPlanet) | |||||
// {s:a,b,c} Áóêâà èëè öèôðà ñ íîìåðîì çåðêàëà ñåðâåðà. | |||||
//  äàííîì ñëó÷àå - îäíà èç áóêâ (A,B,C), âûáðàííàÿ ðàíäîìíî. | |||||
// Ñîâåò äëÿ íà÷èíàþùèõ: åñëè õîòèòå ðàçîáðàòüñÿ â ýòîì êîäå, | |||||
// òî óäîáíåå âñåãî ÷èòàòü åãî ñ êîíöà. | |||||
// Åùå îäèí ñîâåò: åñëè áóäåòå ïèñàòü ñâîè ñêðèïòû, | |||||
// òî âûâîä â êîíñîëü (à òî÷íåå, â îêíî Debug Output ) äåëàåòñÿ òàê: | |||||
// | |||||
// writeLn('Hello Sas.Planet!'); | |||||
// ----------------------------------------------------------------------------- | |||||
// --- 4. Âñïîìîãàòåëüíûå ôóíêöèè | |||||
// ----------------------------------------------------------------------------- | |||||
// --- Ïðîâåðèòü, ñîäåðæèò ëè îäíà ñòðîêà äðóãóþ? | |||||
function isContains(findingText: string; inSourceText: string) : boolean; | |||||
begin | |||||
result := pos(findingText, inSourceText) <> 0; | |||||
end; | |||||
// --- Îêðóãëåíèå äî íóæíîãî êîëè÷åñòâà çíàêîâ ïîñëå çàïÿòîé | |||||
// --- (ñòàíäàðòíûå ôóíêöèè îêðóãëåíèÿ ó ìåíÿ ïî÷åìó-òî íå çàðàáîòàëè) | |||||
function roundFor(sourceNumber: Double ; digitAfterComma: integer) : string; | |||||
var | |||||
intPart, floatPart : integer; | |||||
begin | |||||
intPart := floor(sourceNumber); | |||||
floatPart := floor( (sourceNumber - intPart) * round(intPower(10, digitAfterComma)) ) | |||||
result := intToStr(intPart) + '.' + intToStr(floatPart) | |||||
end; | |||||
// --- Âû÷èñëèòü íîìåð òàéëà â ñèñòåìå Quadkey (èñïîëüçóåòñÿ â êàðòàõ Bing) | |||||
function getQuadkeyText(x: integer; y: integer; z: integer) : string; | |||||
var | |||||
i, q : byte; | |||||
begin | |||||
result:=''; | |||||
for i:=1 to z do begin | |||||
q:=0; | |||||
if x mod 2 = 1 then q := q + 1; | |||||
if y mod 2 = 1 then q := q + 2; | |||||
x := x div 2; | |||||
y := y div 2; | |||||
result := intToStr(q) + result; | |||||
end; | |||||
end; | |||||
// ----------------------------------------------------------------------------- | |||||
// --- 3. Åñëè òðåáóåòñÿ, òî ïîäñòàâèòü èìÿ äëÿ çåðêàëà ñåðâåðà | |||||
// --- íà ìåñòî çàãëóøêè òèïà {s: a,b,c} | |||||
// ----------------------------------------------------------------------------- | |||||
type | |||||
TSubst = record | |||||
mask, val : string; | |||||
end; | |||||
TSubsts = record | |||||
count : integer; | |||||
s : array [0..15] of TSubst; | |||||
end; | |||||
function replaceServerName(url: string) : string; | |||||
var | |||||
s, ss : string; | |||||
sarr : array [0..9] of string; | |||||
sarr_l, p : integer; | |||||
begin | |||||
s := RegExprGetMatchSubStr(url, '\{[sS]:([^}]+)\}', 0); | |||||
if s <> '' then begin | |||||
ss := s; | |||||
ss := StringReplace(ss, '{s:', '', [rfIgnoreCase]); | |||||
ss := StringReplace(ss, '}', '', [rfIgnoreCase]); | |||||
ss := ss + ','; | |||||
sarr_l := 0; | |||||
while ss <> '' do begin | |||||
p := pos(',', ss); | |||||
if p = 0 then p := length(ss); | |||||
sarr[sarr_l] := copy(ss, 1, p-1); | |||||
sarr_l := sarr_l + 1; | |||||
delete(ss, 1, p); | |||||
end; | |||||
url := StringReplace(url, s, sarr[random(sarr_l)], []); | |||||
end; | |||||
Result := url; | |||||
end; | |||||
// ----------------------------------------------------------------------------- | |||||
// --- 2. Åñëè òðåáóåòñÿ, òî âû÷èñëèòü è ïîäñòàâèòü â øàáëîí URL àäðåñà | |||||
// --- íóæíûå çíà÷åíèÿ íà ìåñòî çàãëóøåê òèïà {x}, {y}, {z}. | |||||
// ----------------------------------------------------------------------------- | |||||
function replaceLeafletPlaceholders(urlTemplate: string; x: integer; y: integer; z: integer) : string; | |||||
var | |||||
options: tReplaceFlags; | |||||
calculatedValue: string; | |||||
begin | |||||
options := [rfReplaceAll, rfIgnoreCase]; | |||||
result := urlTemplate; | |||||
if isContains('{x}', result) then begin | |||||
calculatedValue := intToStr(x); | |||||
result := stringReplace( result, '{x}', calculatedValue, options) | |||||
end; | |||||
if isContains('{y}', result) then begin | |||||
calculatedValue := intToStr(y); | |||||
result := stringReplace( result, '{y}', calculatedValue, options) | |||||
end; | |||||
if isContains('{z}', result) then begin | |||||
calculatedValue := intToStr(z-1); | |||||
result := stringReplace( result, '{z}', calculatedValue, options) | |||||
end; | |||||
if isContains('{z+1}', result) then begin | |||||
calculatedValue := intToStr(z); | |||||
result := stringReplace( result, '{z+1}', calculatedValue, options) | |||||
end; | |||||
if isContains('{x/1024}', result) then begin | |||||
calculatedValue := intToStr(x div 1024); | |||||
result := stringReplace( result, '{x/1024}', calculatedValue, options) | |||||
end; | |||||
if isContains('{y/1024}', result) then begin | |||||
calculatedValue := intToStr(y div 1024); | |||||
result := stringReplace( result, '{y/1024}', calculatedValue, options) | |||||
end; | |||||
if isContains('{-y}', result) then begin | |||||
calculatedValue := intToStr( round(intPower(2, z-1)) - 1 - y); | |||||
result := stringReplace( result, '{-y}', calculatedValue, options) | |||||
end; | |||||
if isContains('{q}', result) then begin | |||||
calculatedValue := getQuadkeyText(x, y, z); | |||||
result := stringReplace( result, '{q}', calculatedValue, options) | |||||
end; | |||||
if isContains('{bbox}', result) then begin | |||||
result := stringReplace( result, '{bbox}', '{Left},{Bottom},{Right},{Top}', options) | |||||
result := stringReplace( result, '{Left}', roundFor(GetLMetr,8), options) | |||||
result := stringReplace( result, '{Bottom}', roundFor(GetBMetr,8), options) | |||||
result := stringReplace( result, '{Right}', roundFor(GetRMetr,8), options) | |||||
result := stringReplace( result, '{Top}', roundFor(GetTMetr,8), options) | |||||
// Äåëàþ çàìåíó â ïÿòü îïåðàöèé ïîòîìó, ÷òî ïðè ïîïûòêå | |||||
// ñäåëàòü âñå îäíîé ñòðîêîé âîçíèêàåò îøèáêà. | |||||
// Âîçìîæíî êàêîå-òî îãðàíè÷åíèå íà ïàìÿòü. | |||||
end; | |||||
if isContains('{timeStamp}', result) then begin | |||||
calculatedValue := IntToStr(GetUnixTime); | |||||
result := stringReplace( result, '{timeStamp}', calculatedValue, options) | |||||
end; | |||||
end; | |||||
// ----------------------------------------------------------------------------- | |||||
// --- 1. Ñòàðò ñêðèïòà. Çàïóñòèòü âû÷èñëåíèå URL-àäðåñà òàéëà. | |||||
// --- Ñêà÷àòü òàéë ïî ïîëó÷åííîìó URL. | |||||
// ----------------------------------------------------------------------------- | |||||
begin | |||||
resultURL := replaceLeafletPlaceholders(getURLBase, getX, getY, getZ); | |||||
resultURL := replaceServerName(resultURL); | |||||
end. |
@@ -0,0 +1,7 @@ | |||||
Этот файл был создан автоматически с помощью файло-генератора AnyGIS.ru | |||||
Если вы заметили ошибку, свяжитесь со мной и сообщите о ней: | |||||
https://t.me/anygis | |||||
https://vk.com/anygis | |||||
anygis@bk.ru |
@@ -0,0 +1,19 @@ | |||||
| |||||
[PARAMS] | |||||
GUID={B71DF157-F075-4F01-9A69-DF344D69DF2D} | |||||
ParentSubMenu_ru=Маршруты и GPS-Треки | |||||
ParentSubMenu_uk=Маршруты и GPS-Треки | |||||
ParentSubMenu=Ways and GPS-Tracks | |||||
name_ru=Strava Heatmap - Велоспорт | |||||
name_uk=Strava Heatmap - Велоспорт | |||||
name=Strava Heatmap - Ride | |||||
NameInCache=Tracks_Strava_Ride | |||||
asLayer=1 | |||||
projection=1 | |||||
sradiusa=6378137 | |||||
sradiusb=6378137 | |||||
DefURLBase=https://anygis.ru/api/v1/Tracks_Strava_Ride/{x}/{y}/{z} | |||||
RequestHead=Referer:https://www.strava.com/heatmap\r\nConnection: keep-alive\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36\r\nAccept: image/webp,image/apng,image/*,*/*;q=0.8\r\nAccept-Encoding: gzip, deflate\r\nAccept-Language: ru,en-US;q=0.9,en;q=0.8 | |||||
ContentType=image/jpeg,image/png | |||||
Ext=.png | |||||
License= © Strava |
@@ -0,0 +1,216 @@ | |||||
// ----------------------------------------------------------------------------- | |||||
// --- Óíèâåðñàëüíûé àäàïòåð îò AnyGIS | |||||
// ----------------------------------------------------------------------------- | |||||
// Ýòîò ñêðèïò ïðèçâàí óïðîñòèòü äîáàâëåíèå íîâûõ êàðò â SasPlanet. | |||||
// Îí èçáàâèò íà÷èíàþùèõ ïîëüçîâàòåëåé îò íåîáõîäèìîñòè ïðîãðàììèðîâàòü íà Pascal, | |||||
// ÷òîáû âíîñèòü èçìåíåíèÿ â ôàéë GetUrlScript.txt ïðè äîáàâëåíèè êàæäîé íîâîé êàðòû. | |||||
// Òåïåðü ìîæíî ïðîñòî âñòàâëÿòü ïðèâû÷íûé URL ñ çàãëóøêàìè òèïà {x}, {y}, {z} | |||||
// â ïîëå DefURLBase èç ôàéëà params.txt. Íà ïðèìåð, òàê: | |||||
// | |||||
// DefURLBase=http://{s:a,b,c}.tile.openstreetmap.org/{z}/{x}/{y}.png | |||||
// Ñêðèïò ðàçðàáàòûâàëè Nnngrach è Erelen | |||||
// --- Ñïèñîê äîñòóïíûõ ïàðàìåòðîâ äëÿ àâòîçàìåíû: | |||||
// {x} Íîìåð òàéëà ïî îñè X. (Êàê â êàðòàõ OpenStreetMaps) | |||||
// {y} Íîìåð òàéëà ïî îñè Y. (Êàê â êàðòàõ OpenStreetMaps) | |||||
// {z} Óðîâåíü ïðèáëèæåíèÿ/çóìà. (Êàê â êàðòàõ OpenStreetMaps) | |||||
// {q} Íîìåð òàéëà â ñèñòåìå QuadKey. (Êàê â êàðòàõ Bing) | |||||
// {-y} Èíâåðòèðîâàííûé íîìåð òàéëà ïî îñè Y. (Êàê íà ñàéòå Nakarte) | |||||
// {bbox} Êîîðäèíàòû ãðàíèö òàéëà. (Äëÿ WMS ñåðâåðîâ) | |||||
// {timeStamp} Òåêóùåå âðåìÿ â ôîðìàòå UnixTime. (Äëÿ êàðò ñ ïðîáêàìè) | |||||
// {z+1} Óðîâåíü çóìà. (Äëÿ êàðò, õðàíÿùèõñÿ â ôîðìàòå SasPlanet) | |||||
// {x/1024} Íîìåð ïåðâîé ïîäïàïêè (Äëÿ êàðò, â ôîðìàòå SasPlanet) | |||||
// {y/1024} Íîìåð âòîðîé ïîäïàïêè (Äëÿ êàðò, â ôîðìàòå SasPlanet) | |||||
// {s:a,b,c} Áóêâà èëè öèôðà ñ íîìåðîì çåðêàëà ñåðâåðà. | |||||
//  äàííîì ñëó÷àå - îäíà èç áóêâ (A,B,C), âûáðàííàÿ ðàíäîìíî. | |||||
// Ñîâåò äëÿ íà÷èíàþùèõ: åñëè õîòèòå ðàçîáðàòüñÿ â ýòîì êîäå, | |||||
// òî óäîáíåå âñåãî ÷èòàòü åãî ñ êîíöà. | |||||
// Åùå îäèí ñîâåò: åñëè áóäåòå ïèñàòü ñâîè ñêðèïòû, | |||||
// òî âûâîä â êîíñîëü (à òî÷íåå, â îêíî Debug Output ) äåëàåòñÿ òàê: | |||||
// | |||||
// writeLn('Hello Sas.Planet!'); | |||||
// ----------------------------------------------------------------------------- | |||||
// --- 4. Âñïîìîãàòåëüíûå ôóíêöèè | |||||
// ----------------------------------------------------------------------------- | |||||
// --- Ïðîâåðèòü, ñîäåðæèò ëè îäíà ñòðîêà äðóãóþ? | |||||
function isContains(findingText: string; inSourceText: string) : boolean; | |||||
begin | |||||
result := pos(findingText, inSourceText) <> 0; | |||||
end; | |||||
// --- Îêðóãëåíèå äî íóæíîãî êîëè÷åñòâà çíàêîâ ïîñëå çàïÿòîé | |||||
// --- (ñòàíäàðòíûå ôóíêöèè îêðóãëåíèÿ ó ìåíÿ ïî÷åìó-òî íå çàðàáîòàëè) | |||||
function roundFor(sourceNumber: Double ; digitAfterComma: integer) : string; | |||||
var | |||||
intPart, floatPart : integer; | |||||
begin | |||||
intPart := floor(sourceNumber); | |||||
floatPart := floor( (sourceNumber - intPart) * round(intPower(10, digitAfterComma)) ) | |||||
result := intToStr(intPart) + '.' + intToStr(floatPart) | |||||
end; | |||||
// --- Âû÷èñëèòü íîìåð òàéëà â ñèñòåìå Quadkey (èñïîëüçóåòñÿ â êàðòàõ Bing) | |||||
function getQuadkeyText(x: integer; y: integer; z: integer) : string; | |||||
var | |||||
i, q : byte; | |||||
begin | |||||
result:=''; | |||||
for i:=1 to z do begin | |||||
q:=0; | |||||
if x mod 2 = 1 then q := q + 1; | |||||
if y mod 2 = 1 then q := q + 2; | |||||
x := x div 2; | |||||
y := y div 2; | |||||
result := intToStr(q) + result; | |||||
end; | |||||
end; | |||||
// ----------------------------------------------------------------------------- | |||||
// --- 3. Åñëè òðåáóåòñÿ, òî ïîäñòàâèòü èìÿ äëÿ çåðêàëà ñåðâåðà | |||||
// --- íà ìåñòî çàãëóøêè òèïà {s: a,b,c} | |||||
// ----------------------------------------------------------------------------- | |||||
type | |||||
TSubst = record | |||||
mask, val : string; | |||||
end; | |||||
TSubsts = record | |||||
count : integer; | |||||
s : array [0..15] of TSubst; | |||||
end; | |||||
function replaceServerName(url: string) : string; | |||||
var | |||||
s, ss : string; | |||||
sarr : array [0..9] of string; | |||||
sarr_l, p : integer; | |||||
begin | |||||
s := RegExprGetMatchSubStr(url, '\{[sS]:([^}]+)\}', 0); | |||||
if s <> '' then begin | |||||
ss := s; | |||||
ss := StringReplace(ss, '{s:', '', [rfIgnoreCase]); | |||||
ss := StringReplace(ss, '}', '', [rfIgnoreCase]); | |||||
ss := ss + ','; | |||||
sarr_l := 0; | |||||
while ss <> '' do begin | |||||
p := pos(',', ss); | |||||
if p = 0 then p := length(ss); | |||||
sarr[sarr_l] := copy(ss, 1, p-1); | |||||
sarr_l := sarr_l + 1; | |||||
delete(ss, 1, p); | |||||
end; | |||||
url := StringReplace(url, s, sarr[random(sarr_l)], []); | |||||
end; | |||||
Result := url; | |||||
end; | |||||
// ----------------------------------------------------------------------------- | |||||
// --- 2. Åñëè òðåáóåòñÿ, òî âû÷èñëèòü è ïîäñòàâèòü â øàáëîí URL àäðåñà | |||||
// --- íóæíûå çíà÷åíèÿ íà ìåñòî çàãëóøåê òèïà {x}, {y}, {z}. | |||||
// ----------------------------------------------------------------------------- | |||||
function replaceLeafletPlaceholders(urlTemplate: string; x: integer; y: integer; z: integer) : string; | |||||
var | |||||
options: tReplaceFlags; | |||||
calculatedValue: string; | |||||
begin | |||||
options := [rfReplaceAll, rfIgnoreCase]; | |||||
result := urlTemplate; | |||||
if isContains('{x}', result) then begin | |||||
calculatedValue := intToStr(x); | |||||
result := stringReplace( result, '{x}', calculatedValue, options) | |||||
end; | |||||
if isContains('{y}', result) then begin | |||||
calculatedValue := intToStr(y); | |||||
result := stringReplace( result, '{y}', calculatedValue, options) | |||||
end; | |||||
if isContains('{z}', result) then begin | |||||
calculatedValue := intToStr(z-1); | |||||
result := stringReplace( result, '{z}', calculatedValue, options) | |||||
end; | |||||
if isContains('{z+1}', result) then begin | |||||
calculatedValue := intToStr(z); | |||||
result := stringReplace( result, '{z+1}', calculatedValue, options) | |||||
end; | |||||
if isContains('{x/1024}', result) then begin | |||||
calculatedValue := intToStr(x div 1024); | |||||
result := stringReplace( result, '{x/1024}', calculatedValue, options) | |||||
end; | |||||
if isContains('{y/1024}', result) then begin | |||||
calculatedValue := intToStr(y div 1024); | |||||
result := stringReplace( result, '{y/1024}', calculatedValue, options) | |||||
end; | |||||
if isContains('{-y}', result) then begin | |||||
calculatedValue := intToStr( round(intPower(2, z-1)) - 1 - y); | |||||
result := stringReplace( result, '{-y}', calculatedValue, options) | |||||
end; | |||||
if isContains('{q}', result) then begin | |||||
calculatedValue := getQuadkeyText(x, y, z); | |||||
result := stringReplace( result, '{q}', calculatedValue, options) | |||||
end; | |||||
if isContains('{bbox}', result) then begin | |||||
result := stringReplace( result, '{bbox}', '{Left},{Bottom},{Right},{Top}', options) | |||||
result := stringReplace( result, '{Left}', roundFor(GetLMetr,8), options) | |||||
result := stringReplace( result, '{Bottom}', roundFor(GetBMetr,8), options) | |||||
result := stringReplace( result, '{Right}', roundFor(GetRMetr,8), options) | |||||
result := stringReplace( result, '{Top}', roundFor(GetTMetr,8), options) | |||||
// Äåëàþ çàìåíó â ïÿòü îïåðàöèé ïîòîìó, ÷òî ïðè ïîïûòêå | |||||
// ñäåëàòü âñå îäíîé ñòðîêîé âîçíèêàåò îøèáêà. | |||||
// Âîçìîæíî êàêîå-òî îãðàíè÷åíèå íà ïàìÿòü. | |||||
end; | |||||
if isContains('{timeStamp}', result) then begin | |||||
calculatedValue := IntToStr(GetUnixTime); | |||||
result := stringReplace( result, '{timeStamp}', calculatedValue, options) | |||||
end; | |||||
end; | |||||
// ----------------------------------------------------------------------------- | |||||
// --- 1. Ñòàðò ñêðèïòà. Çàïóñòèòü âû÷èñëåíèå URL-àäðåñà òàéëà. | |||||
// --- Ñêà÷àòü òàéë ïî ïîëó÷åííîìó URL. | |||||
// ----------------------------------------------------------------------------- | |||||
begin | |||||
resultURL := replaceLeafletPlaceholders(getURLBase, getX, getY, getZ); | |||||
resultURL := replaceServerName(resultURL); | |||||
end. |
@@ -0,0 +1,7 @@ | |||||
Ýòîò ôàéë áûë ñîçäàí àâòîìàòè÷åñêè ñ ïîìîùüþ ôàéëî-ãåíåðàòîðà AnyGIS.ru | |||||
Åñëè âû çàìåòèëè îøèáêó, ñâÿæèòåñü ñî ìíîé è ñîîáùèòå î íåé: | |||||
https://t.me/anygis | |||||
https://vk.com/anygis | |||||
anygis@bk.ru |
@@ -0,0 +1,19 @@ | |||||
| |||||
[PARAMS] | |||||
GUID={BF69A930-3739-454A-A833-DED4C0841297} | |||||
ParentSubMenu_ru=Маршруты и GPS-Треки | |||||
ParentSubMenu_uk=Маршруты и GPS-Треки | |||||
ParentSubMenu=Ways and GPS-Tracks | |||||
name_ru=Strava Heatmap - Бег | |||||
name_uk=Strava Heatmap - Бег | |||||
name=Strava Heatmap - Run | |||||
NameInCache=Tracks_Strava_Run | |||||
asLayer=1 | |||||
projection=1 | |||||
sradiusa=6378137 | |||||
sradiusb=6378137 | |||||
DefURLBase=https://anygis.ru/api/v1/Tracks_Strava_Run/{x}/{y}/{z} | |||||
RequestHead=Referer:https://www.strava.com/heatmap\r\nConnection: keep-alive\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36\r\nAccept: image/webp,image/apng,image/*,*/*;q=0.8\r\nAccept-Encoding: gzip, deflate\r\nAccept-Language: ru,en-US;q=0.9,en;q=0.8 | |||||
ContentType=image/jpeg,image/png | |||||
Ext=.png | |||||
License= © Strava |
@@ -0,0 +1,216 @@ | |||||
// ----------------------------------------------------------------------------- | |||||
// --- Óíèâåðñàëüíûé àäàïòåð îò AnyGIS | |||||
// ----------------------------------------------------------------------------- | |||||
// Ýòîò ñêðèïò ïðèçâàí óïðîñòèòü äîáàâëåíèå íîâûõ êàðò â SasPlanet. | |||||
// Îí èçáàâèò íà÷èíàþùèõ ïîëüçîâàòåëåé îò íåîáõîäèìîñòè ïðîãðàììèðîâàòü íà Pascal, | |||||
// ÷òîáû âíîñèòü èçìåíåíèÿ â ôàéë GetUrlScript.txt ïðè äîáàâëåíèè êàæäîé íîâîé êàðòû. | |||||
// Òåïåðü ìîæíî ïðîñòî âñòàâëÿòü ïðèâû÷íûé URL ñ çàãëóøêàìè òèïà {x}, {y}, {z} | |||||
// â ïîëå DefURLBase èç ôàéëà params.txt. Íà ïðèìåð, òàê: | |||||
// | |||||
// DefURLBase=http://{s:a,b,c}.tile.openstreetmap.org/{z}/{x}/{y}.png | |||||
// Ñêðèïò ðàçðàáàòûâàëè Nnngrach è Erelen | |||||
// --- Ñïèñîê äîñòóïíûõ ïàðàìåòðîâ äëÿ àâòîçàìåíû: | |||||
// {x} Íîìåð òàéëà ïî îñè X. (Êàê â êàðòàõ OpenStreetMaps) | |||||
// {y} Íîìåð òàéëà ïî îñè Y. (Êàê â êàðòàõ OpenStreetMaps) | |||||
// {z} Óðîâåíü ïðèáëèæåíèÿ/çóìà. (Êàê â êàðòàõ OpenStreetMaps) | |||||
// {q} Íîìåð òàéëà â ñèñòåìå QuadKey. (Êàê â êàðòàõ Bing) | |||||
// {-y} Èíâåðòèðîâàííûé íîìåð òàéëà ïî îñè Y. (Êàê íà ñàéòå Nakarte) | |||||
// {bbox} Êîîðäèíàòû ãðàíèö òàéëà. (Äëÿ WMS ñåðâåðîâ) | |||||
// {timeStamp} Òåêóùåå âðåìÿ â ôîðìàòå UnixTime. (Äëÿ êàðò ñ ïðîáêàìè) | |||||
// {z+1} Óðîâåíü çóìà. (Äëÿ êàðò, õðàíÿùèõñÿ â ôîðìàòå SasPlanet) | |||||
// {x/1024} Íîìåð ïåðâîé ïîäïàïêè (Äëÿ êàðò, â ôîðìàòå SasPlanet) | |||||
// {y/1024} Íîìåð âòîðîé ïîäïàïêè (Äëÿ êàðò, â ôîðìàòå SasPlanet) | |||||
// {s:a,b,c} Áóêâà èëè öèôðà ñ íîìåðîì çåðêàëà ñåðâåðà. | |||||
//  äàííîì ñëó÷àå - îäíà èç áóêâ (A,B,C), âûáðàííàÿ ðàíäîìíî. | |||||
// Ñîâåò äëÿ íà÷èíàþùèõ: åñëè õîòèòå ðàçîáðàòüñÿ â ýòîì êîäå, | |||||
// òî óäîáíåå âñåãî ÷èòàòü åãî ñ êîíöà. | |||||
// Åùå îäèí ñîâåò: åñëè áóäåòå ïèñàòü ñâîè ñêðèïòû, | |||||
// òî âûâîä â êîíñîëü (à òî÷íåå, â îêíî Debug Output ) äåëàåòñÿ òàê: | |||||
// | |||||
// writeLn('Hello Sas.Planet!'); | |||||
// ----------------------------------------------------------------------------- | |||||
// --- 4. Âñïîìîãàòåëüíûå ôóíêöèè | |||||
// ----------------------------------------------------------------------------- | |||||
// --- Ïðîâåðèòü, ñîäåðæèò ëè îäíà ñòðîêà äðóãóþ? | |||||
function isContains(findingText: string; inSourceText: string) : boolean; | |||||
begin | |||||
result := pos(findingText, inSourceText) <> 0; | |||||
end; | |||||
// --- Îêðóãëåíèå äî íóæíîãî êîëè÷åñòâà çíàêîâ ïîñëå çàïÿòîé | |||||
// --- (ñòàíäàðòíûå ôóíêöèè îêðóãëåíèÿ ó ìåíÿ ïî÷åìó-òî íå çàðàáîòàëè) | |||||
function roundFor(sourceNumber: Double ; digitAfterComma: integer) : string; | |||||
var | |||||
intPart, floatPart : integer; | |||||
begin | |||||
intPart := floor(sourceNumber); | |||||
floatPart := floor( (sourceNumber - intPart) * round(intPower(10, digitAfterComma)) ) | |||||
result := intToStr(intPart) + '.' + intToStr(floatPart) | |||||
end; | |||||
// --- Âû÷èñëèòü íîìåð òàéëà â ñèñòåìå Quadkey (èñïîëüçóåòñÿ â êàðòàõ Bing) | |||||
function getQuadkeyText(x: integer; y: integer; z: integer) : string; | |||||
var | |||||
i, q : byte; | |||||
begin | |||||
result:=''; | |||||
for i:=1 to z do begin | |||||
q:=0; | |||||
if x mod 2 = 1 then q := q + 1; | |||||
if y mod 2 = 1 then q := q + 2; | |||||
x := x div 2; | |||||
y := y div 2; | |||||
result := intToStr(q) + result; | |||||
end; | |||||
end; | |||||
// ----------------------------------------------------------------------------- | |||||
// --- 3. Åñëè òðåáóåòñÿ, òî ïîäñòàâèòü èìÿ äëÿ çåðêàëà ñåðâåðà | |||||
// --- íà ìåñòî çàãëóøêè òèïà {s: a,b,c} | |||||
// ----------------------------------------------------------------------------- | |||||
type | |||||
TSubst = record | |||||
mask, val : string; | |||||
end; | |||||
TSubsts = record | |||||
count : integer; | |||||
s : array [0..15] of TSubst; | |||||
end; | |||||
function replaceServerName(url: string) : string; | |||||
var | |||||
s, ss : string; | |||||
sarr : array [0..9] of string; | |||||
sarr_l, p : integer; | |||||
begin | |||||
s := RegExprGetMatchSubStr(url, '\{[sS]:([^}]+)\}', 0); | |||||
if s <> '' then begin | |||||
ss := s; | |||||
ss := StringReplace(ss, '{s:', '', [rfIgnoreCase]); | |||||
ss := StringReplace(ss, '}', '', [rfIgnoreCase]); | |||||
ss := ss + ','; | |||||
sarr_l := 0; | |||||
while ss <> '' do begin | |||||
p := pos(',', ss); | |||||
if p = 0 then p := length(ss); | |||||
sarr[sarr_l] := copy(ss, 1, p-1); | |||||
sarr_l := sarr_l + 1; | |||||
delete(ss, 1, p); | |||||
end; | |||||
url := StringReplace(url, s, sarr[random(sarr_l)], []); | |||||
end; | |||||
Result := url; | |||||
end; | |||||
// ----------------------------------------------------------------------------- | |||||
// --- 2. Åñëè òðåáóåòñÿ, òî âû÷èñëèòü è ïîäñòàâèòü â øàáëîí URL àäðåñà | |||||
// --- íóæíûå çíà÷åíèÿ íà ìåñòî çàãëóøåê òèïà {x}, {y}, {z}. | |||||
// ----------------------------------------------------------------------------- | |||||
function replaceLeafletPlaceholders(urlTemplate: string; x: integer; y: integer; z: integer) : string; | |||||
var | |||||
options: tReplaceFlags; | |||||
calculatedValue: string; | |||||
begin | |||||
options := [rfReplaceAll, rfIgnoreCase]; | |||||
result := urlTemplate; | |||||
if isContains('{x}', result) then begin | |||||
calculatedValue := intToStr(x); | |||||
result := stringReplace( result, '{x}', calculatedValue, options) | |||||
end; | |||||
if isContains('{y}', result) then begin | |||||
calculatedValue := intToStr(y); | |||||
result := stringReplace( result, '{y}', calculatedValue, options) | |||||
end; | |||||
if isContains('{z}', result) then begin | |||||
calculatedValue := intToStr(z-1); | |||||
result := stringReplace( result, '{z}', calculatedValue, options) | |||||
end; | |||||
if isContains('{z+1}', result) then begin | |||||
calculatedValue := intToStr(z); | |||||
result := stringReplace( result, '{z+1}', calculatedValue, options) | |||||
end; | |||||
if isContains('{x/1024}', result) then begin | |||||
calculatedValue := intToStr(x div 1024); | |||||
result := stringReplace( result, '{x/1024}', calculatedValue, options) | |||||
end; | |||||
if isContains('{y/1024}', result) then begin | |||||
calculatedValue := intToStr(y div 1024); | |||||
result := stringReplace( result, '{y/1024}', calculatedValue, options) | |||||
end; | |||||
if isContains('{-y}', result) then begin | |||||
calculatedValue := intToStr( round(intPower(2, z-1)) - 1 - y); | |||||
result := stringReplace( result, '{-y}', calculatedValue, options) | |||||
end; | |||||
if isContains('{q}', result) then begin | |||||
calculatedValue := getQuadkeyText(x, y, z); | |||||
result := stringReplace( result, '{q}', calculatedValue, options) | |||||
end; | |||||
if isContains('{bbox}', result) then begin | |||||
result := stringReplace( result, '{bbox}', '{Left},{Bottom},{Right},{Top}', options) | |||||
result := stringReplace( result, '{Left}', roundFor(GetLMetr,8), options) | |||||
result := stringReplace( result, '{Bottom}', roundFor(GetBMetr,8), options) | |||||
result := stringReplace( result, '{Right}', roundFor(GetRMetr,8), options) | |||||
result := stringReplace( result, '{Top}', roundFor(GetTMetr,8), options) | |||||
// Äåëàþ çàìåíó â ïÿòü îïåðàöèé ïîòîìó, ÷òî ïðè ïîïûòêå | |||||
// ñäåëàòü âñå îäíîé ñòðîêîé âîçíèêàåò îøèáêà. | |||||
// Âîçìîæíî êàêîå-òî îãðàíè÷åíèå íà ïàìÿòü. | |||||
end; | |||||
if isContains('{timeStamp}', result) then begin | |||||
calculatedValue := IntToStr(GetUnixTime); | |||||
result := stringReplace( result, '{timeStamp}', calculatedValue, options) | |||||
end; | |||||
end; | |||||
// ----------------------------------------------------------------------------- | |||||
// --- 1. Ñòàðò ñêðèïòà. Çàïóñòèòü âû÷èñëåíèå URL-àäðåñà òàéëà. | |||||
// --- Ñêà÷àòü òàéë ïî ïîëó÷åííîìó URL. | |||||
// ----------------------------------------------------------------------------- | |||||
begin | |||||
resultURL := replaceLeafletPlaceholders(getURLBase, getX, getY, getZ); | |||||
resultURL := replaceServerName(resultURL); | |||||
end. |
@@ -0,0 +1,7 @@ | |||||
Ýòîò ôàéë áûë ñîçäàí àâòîìàòè÷åñêè ñ ïîìîùüþ ôàéëî-ãåíåðàòîðà AnyGIS.ru | |||||
Åñëè âû çàìåòèëè îøèáêó, ñâÿæèòåñü ñî ìíîé è ñîîáùèòå î íåé: | |||||
https://t.me/anygis | |||||
https://vk.com/anygis | |||||
anygis@bk.ru |
@@ -0,0 +1,19 @@ | |||||
| |||||
[PARAMS] | |||||
GUID={B5C2127C-56AC-4630-94A1-34E17F5B183F} | |||||
ParentSubMenu_ru=Маршруты и GPS-Треки | |||||
ParentSubMenu_uk=Маршруты и GPS-Треки | |||||
ParentSubMenu=Ways and GPS-Tracks | |||||
name_ru=Strava Heatmap - Велоспорт и Бег (beta) | |||||
name_uk=Strava Heatmap - Велоспорт и Бег (beta) | |||||
name=Strava Heatmap - RunAndRide (beta) | |||||
NameInCache=Tracks_Strava_RunAndRide | |||||
asLayer=1 | |||||
projection=1 | |||||
sradiusa=6378137 | |||||
sradiusb=6378137 | |||||
DefURLBase=https://anygis.ru/api/v1/Tracks_Strava_RunAndRide/{x}/{y}/{z} | |||||
RequestHead=Referer:https://www.strava.com/heatmap\r\nConnection: keep-alive\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36\r\nAccept: image/webp,image/apng,image/*,*/*;q=0.8\r\nAccept-Encoding: gzip, deflate\r\nAccept-Language: ru,en-US;q=0.9,en;q=0.8 | |||||
ContentType=image/jpeg,image/png | |||||
Ext=.png | |||||
License= © Strava |
@@ -0,0 +1,216 @@ | |||||
// ----------------------------------------------------------------------------- | |||||
// --- Óíèâåðñàëüíûé àäàïòåð îò AnyGIS | |||||
// ----------------------------------------------------------------------------- | |||||
// Ýòîò ñêðèïò ïðèçâàí óïðîñòèòü äîáàâëåíèå íîâûõ êàðò â SasPlanet. | |||||
// Îí èçáàâèò íà÷èíàþùèõ ïîëüçîâàòåëåé îò íåîáõîäèìîñòè ïðîãðàììèðîâàòü íà Pascal, | |||||
// ÷òîáû âíîñèòü èçìåíåíèÿ â ôàéë GetUrlScript.txt ïðè äîáàâëåíèè êàæäîé íîâîé êàðòû. | |||||
// Òåïåðü ìîæíî ïðîñòî âñòàâëÿòü ïðèâû÷íûé URL ñ çàãëóøêàìè òèïà {x}, {y}, {z} | |||||
// â ïîëå DefURLBase èç ôàéëà params.txt. Íà ïðèìåð, òàê: | |||||
// | |||||
// DefURLBase=http://{s:a,b,c}.tile.openstreetmap.org/{z}/{x}/{y}.png | |||||
// Ñêðèïò ðàçðàáàòûâàëè Nnngrach è Erelen | |||||
// --- Ñïèñîê äîñòóïíûõ ïàðàìåòðîâ äëÿ àâòîçàìåíû: | |||||
// {x} Íîìåð òàéëà ïî îñè X. (Êàê â êàðòàõ OpenStreetMaps) | |||||
// {y} Íîìåð òàéëà ïî îñè Y. (Êàê â êàðòàõ OpenStreetMaps) | |||||
// {z} Óðîâåíü ïðèáëèæåíèÿ/çóìà. (Êàê â êàðòàõ OpenStreetMaps) | |||||
// {q} Íîìåð òàéëà â ñèñòåìå QuadKey. (Êàê â êàðòàõ Bing) | |||||
// {-y} Èíâåðòèðîâàííûé íîìåð òàéëà ïî îñè Y. (Êàê íà ñàéòå Nakarte) | |||||
// {bbox} Êîîðäèíàòû ãðàíèö òàéëà. (Äëÿ WMS ñåðâåðîâ) | |||||
// {timeStamp} Òåêóùåå âðåìÿ â ôîðìàòå UnixTime. (Äëÿ êàðò ñ ïðîáêàìè) | |||||
// {z+1} Óðîâåíü çóìà. (Äëÿ êàðò, õðàíÿùèõñÿ â ôîðìàòå SasPlanet) | |||||
// {x/1024} Íîìåð ïåðâîé ïîäïàïêè (Äëÿ êàðò, â ôîðìàòå SasPlanet) | |||||
// {y/1024} Íîìåð âòîðîé ïîäïàïêè (Äëÿ êàðò, â ôîðìàòå SasPlanet) | |||||
// {s:a,b,c} Áóêâà èëè öèôðà ñ íîìåðîì çåðêàëà ñåðâåðà. | |||||
//  äàííîì ñëó÷àå - îäíà èç áóêâ (A,B,C), âûáðàííàÿ ðàíäîìíî. | |||||
// Ñîâåò äëÿ íà÷èíàþùèõ: åñëè õîòèòå ðàçîáðàòüñÿ â ýòîì êîäå, | |||||
// òî óäîáíåå âñåãî ÷èòàòü åãî ñ êîíöà. | |||||
// Åùå îäèí ñîâåò: åñëè áóäåòå ïèñàòü ñâîè ñêðèïòû, | |||||
// òî âûâîä â êîíñîëü (à òî÷íåå, â îêíî Debug Output ) äåëàåòñÿ òàê: | |||||
// | |||||
// writeLn('Hello Sas.Planet!'); | |||||
// ----------------------------------------------------------------------------- | |||||
// --- 4. Âñïîìîãàòåëüíûå ôóíêöèè | |||||
// ----------------------------------------------------------------------------- | |||||
// --- Ïðîâåðèòü, ñîäåðæèò ëè îäíà ñòðîêà äðóãóþ? | |||||
function isContains(findingText: string; inSourceText: string) : boolean; | |||||
begin | |||||
result := pos(findingText, inSourceText) <> 0; | |||||
end; | |||||
// --- Îêðóãëåíèå äî íóæíîãî êîëè÷åñòâà çíàêîâ ïîñëå çàïÿòîé | |||||
// --- (ñòàíäàðòíûå ôóíêöèè îêðóãëåíèÿ ó ìåíÿ ïî÷åìó-òî íå çàðàáîòàëè) | |||||
function roundFor(sourceNumber: Double ; digitAfterComma: integer) : string; | |||||
var | |||||
intPart, floatPart : integer; | |||||
begin | |||||
intPart := floor(sourceNumber); | |||||
floatPart := floor( (sourceNumber - intPart) * round(intPower(10, digitAfterComma)) ) | |||||
result := intToStr(intPart) + '.' + intToStr(floatPart) | |||||
end; | |||||
// --- Âû÷èñëèòü íîìåð òàéëà â ñèñòåìå Quadkey (èñïîëüçóåòñÿ â êàðòàõ Bing) | |||||
function getQuadkeyText(x: integer; y: integer; z: integer) : string; | |||||
var | |||||
i, q : byte; | |||||
begin | |||||
result:=''; | |||||
for i:=1 to z do begin | |||||
q:=0; | |||||
if x mod 2 = 1 then q := q + 1; | |||||
if y mod 2 = 1 then q := q + 2; | |||||
x := x div 2; | |||||
y := y div 2; | |||||
result := intToStr(q) + result; | |||||
end; | |||||
end; | |||||
// ----------------------------------------------------------------------------- | |||||
// --- 3. Åñëè òðåáóåòñÿ, òî ïîäñòàâèòü èìÿ äëÿ çåðêàëà ñåðâåðà | |||||
// --- íà ìåñòî çàãëóøêè òèïà {s: a,b,c} | |||||
// ----------------------------------------------------------------------------- | |||||
type | |||||
TSubst = record | |||||
mask, val : string; | |||||
end; | |||||
TSubsts = record | |||||
count : integer; | |||||
s : array [0..15] of TSubst; | |||||
end; | |||||
function replaceServerName(url: string) : string; | |||||
var | |||||
s, ss : string; | |||||
sarr : array [0..9] of string; | |||||
sarr_l, p : integer; | |||||
begin | |||||
s := RegExprGetMatchSubStr(url, '\{[sS]:([^}]+)\}', 0); | |||||
if s <> '' then begin | |||||
ss := s; | |||||
ss := StringReplace(ss, '{s:', '', [rfIgnoreCase]); | |||||
ss := StringReplace(ss, '}', '', [rfIgnoreCase]); | |||||
ss := ss + ','; | |||||
sarr_l := 0; | |||||
while ss <> '' do begin | |||||
p := pos(',', ss); | |||||
if p = 0 then p := length(ss); | |||||
sarr[sarr_l] := copy(ss, 1, p-1); | |||||
sarr_l := sarr_l + 1; | |||||
delete(ss, 1, p); | |||||
end; | |||||
url := StringReplace(url, s, sarr[random(sarr_l)], []); | |||||
end; | |||||
Result := url; | |||||
end; | |||||
// ----------------------------------------------------------------------------- | |||||
// --- 2. Åñëè òðåáóåòñÿ, òî âû÷èñëèòü è ïîäñòàâèòü â øàáëîí URL àäðåñà | |||||
// --- íóæíûå çíà÷åíèÿ íà ìåñòî çàãëóøåê òèïà {x}, {y}, {z}. | |||||
// ----------------------------------------------------------------------------- | |||||
function replaceLeafletPlaceholders(urlTemplate: string; x: integer; y: integer; z: integer) : string; | |||||
var | |||||
options: tReplaceFlags; | |||||
calculatedValue: string; | |||||
begin | |||||
options := [rfReplaceAll, rfIgnoreCase]; | |||||
result := urlTemplate; | |||||
if isContains('{x}', result) then begin | |||||
calculatedValue := intToStr(x); | |||||
result := stringReplace( result, '{x}', calculatedValue, options) | |||||
end; | |||||
if isContains('{y}', result) then begin | |||||
calculatedValue := intToStr(y); | |||||
result := stringReplace( result, '{y}', calculatedValue, options) | |||||
end; | |||||
if isContains('{z}', result) then begin | |||||
calculatedValue := intToStr(z-1); | |||||
result := stringReplace( result, '{z}', calculatedValue, options) | |||||
end; | |||||
if isContains('{z+1}', result) then begin | |||||
calculatedValue := intToStr(z); | |||||
result := stringReplace( result, '{z+1}', calculatedValue, options) | |||||
end; | |||||
if isContains('{x/1024}', result) then begin | |||||
calculatedValue := intToStr(x div 1024); | |||||
result := stringReplace( result, '{x/1024}', calculatedValue, options) | |||||
end; | |||||
if isContains('{y/1024}', result) then begin | |||||
calculatedValue := intToStr(y div 1024); | |||||
result := stringReplace( result, '{y/1024}', calculatedValue, options) | |||||
end; | |||||
if isContains('{-y}', result) then begin | |||||
calculatedValue := intToStr( round(intPower(2, z-1)) - 1 - y); | |||||
result := stringReplace( result, '{-y}', calculatedValue, options) | |||||
end; | |||||
if isContains('{q}', result) then begin | |||||
calculatedValue := getQuadkeyText(x, y, z); | |||||
result := stringReplace( result, '{q}', calculatedValue, options) | |||||
end; | |||||
if isContains('{bbox}', result) then begin | |||||
result := stringReplace( result, '{bbox}', '{Left},{Bottom},{Right},{Top}', options) | |||||
result := stringReplace( result, '{Left}', roundFor(GetLMetr,8), options) | |||||
result := stringReplace( result, '{Bottom}', roundFor(GetBMetr,8), options) | |||||
result := stringReplace( result, '{Right}', roundFor(GetRMetr,8), options) | |||||
result := stringReplace( result, '{Top}', roundFor(GetTMetr,8), options) | |||||
// Äåëàþ çàìåíó â ïÿòü îïåðàöèé ïîòîìó, ÷òî ïðè ïîïûòêå | |||||
// ñäåëàòü âñå îäíîé ñòðîêîé âîçíèêàåò îøèáêà. | |||||
// Âîçìîæíî êàêîå-òî îãðàíè÷åíèå íà ïàìÿòü. | |||||
end; | |||||
if isContains('{timeStamp}', result) then begin | |||||
calculatedValue := IntToStr(GetUnixTime); | |||||
result := stringReplace( result, '{timeStamp}', calculatedValue, options) | |||||
end; | |||||
end; | |||||
// ----------------------------------------------------------------------------- | |||||
// --- 1. Ñòàðò ñêðèïòà. Çàïóñòèòü âû÷èñëåíèå URL-àäðåñà òàéëà. | |||||
// --- Ñêà÷àòü òàéë ïî ïîëó÷åííîìó URL. | |||||
// ----------------------------------------------------------------------------- | |||||
begin | |||||
resultURL := replaceLeafletPlaceholders(getURLBase, getX, getY, getZ); | |||||
resultURL := replaceServerName(resultURL); | |||||
end. |
@@ -0,0 +1,7 @@ | |||||
Этот файл был создан автоматически с помощью файло-генератора AnyGIS.ru | |||||
Если вы заметили ошибку, свяжитесь со мной и сообщите о ней: | |||||
https://t.me/anygis | |||||
https://vk.com/anygis | |||||
anygis@bk.ru |
@@ -0,0 +1,19 @@ | |||||
| |||||
[PARAMS] | |||||
GUID={542841FD-209E-4C96-9714-BC4F337371CA} | |||||
ParentSubMenu_ru=Маршруты и GPS-Треки | |||||
ParentSubMenu_uk=Маршруты и GPS-Треки | |||||
ParentSubMenu=Ways and GPS-Tracks | |||||
name_ru=Strava Heatmap - Водный спорт | |||||
name_uk=Strava Heatmap - Водный спорт | |||||
name=Strava Heatmap - Water | |||||
NameInCache=Tracks_Strava_Water | |||||
asLayer=1 | |||||
projection=1 | |||||
sradiusa=6378137 | |||||
sradiusb=6378137 | |||||
DefURLBase=https://anygis.ru/api/v1/Tracks_Strava_Water/{x}/{y}/{z} | |||||
RequestHead=Referer:https://www.strava.com/heatmap\r\nConnection: keep-alive\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36\r\nAccept: image/webp,image/apng,image/*,*/*;q=0.8\r\nAccept-Encoding: gzip, deflate\r\nAccept-Language: ru,en-US;q=0.9,en;q=0.8 | |||||
ContentType=image/jpeg,image/png | |||||
Ext=.png | |||||
License= © Strava |
@@ -0,0 +1,216 @@ | |||||
// ----------------------------------------------------------------------------- | |||||
// --- Óíèâåðñàëüíûé àäàïòåð îò AnyGIS | |||||
// ----------------------------------------------------------------------------- | |||||
// Ýòîò ñêðèïò ïðèçâàí óïðîñòèòü äîáàâëåíèå íîâûõ êàðò â SasPlanet. | |||||
// Îí èçáàâèò íà÷èíàþùèõ ïîëüçîâàòåëåé îò íåîáõîäèìîñòè ïðîãðàììèðîâàòü íà Pascal, | |||||
// ÷òîáû âíîñèòü èçìåíåíèÿ â ôàéë GetUrlScript.txt ïðè äîáàâëåíèè êàæäîé íîâîé êàðòû. | |||||
// Òåïåðü ìîæíî ïðîñòî âñòàâëÿòü ïðèâû÷íûé URL ñ çàãëóøêàìè òèïà {x}, {y}, {z} | |||||
// â ïîëå DefURLBase èç ôàéëà params.txt. Íà ïðèìåð, òàê: | |||||
// | |||||
// DefURLBase=http://{s:a,b,c}.tile.openstreetmap.org/{z}/{x}/{y}.png | |||||
// Ñêðèïò ðàçðàáàòûâàëè Nnngrach è Erelen | |||||
// --- Ñïèñîê äîñòóïíûõ ïàðàìåòðîâ äëÿ àâòîçàìåíû: | |||||
// {x} Íîìåð òàéëà ïî îñè X. (Êàê â êàðòàõ OpenStreetMaps) | |||||
// {y} Íîìåð òàéëà ïî îñè Y. (Êàê â êàðòàõ OpenStreetMaps) | |||||
// {z} Óðîâåíü ïðèáëèæåíèÿ/çóìà. (Êàê â êàðòàõ OpenStreetMaps) | |||||
// {q} Íîìåð òàéëà â ñèñòåìå QuadKey. (Êàê â êàðòàõ Bing) | |||||
// {-y} Èíâåðòèðîâàííûé íîìåð òàéëà ïî îñè Y. (Êàê íà ñàéòå Nakarte) | |||||
// {bbox} Êîîðäèíàòû ãðàíèö òàéëà. (Äëÿ WMS ñåðâåðîâ) | |||||
// {timeStamp} Òåêóùåå âðåìÿ â ôîðìàòå UnixTime. (Äëÿ êàðò ñ ïðîáêàìè) | |||||
// {z+1} Óðîâåíü çóìà. (Äëÿ êàðò, õðàíÿùèõñÿ â ôîðìàòå SasPlanet) | |||||
// {x/1024} Íîìåð ïåðâîé ïîäïàïêè (Äëÿ êàðò, â ôîðìàòå SasPlanet) | |||||
// {y/1024} Íîìåð âòîðîé ïîäïàïêè (Äëÿ êàðò, â ôîðìàòå SasPlanet) | |||||
// {s:a,b,c} Áóêâà èëè öèôðà ñ íîìåðîì çåðêàëà ñåðâåðà. | |||||
//  äàííîì ñëó÷àå - îäíà èç áóêâ (A,B,C), âûáðàííàÿ ðàíäîìíî. | |||||
// Ñîâåò äëÿ íà÷èíàþùèõ: åñëè õîòèòå ðàçîáðàòüñÿ â ýòîì êîäå, | |||||
// òî óäîáíåå âñåãî ÷èòàòü åãî ñ êîíöà. | |||||
// Åùå îäèí ñîâåò: åñëè áóäåòå ïèñàòü ñâîè ñêðèïòû, | |||||
// òî âûâîä â êîíñîëü (à òî÷íåå, â îêíî Debug Output ) äåëàåòñÿ òàê: | |||||
// | |||||
// writeLn('Hello Sas.Planet!'); | |||||
// ----------------------------------------------------------------------------- | |||||
// --- 4. Âñïîìîãàòåëüíûå ôóíêöèè | |||||
// ----------------------------------------------------------------------------- | |||||
// --- Ïðîâåðèòü, ñîäåðæèò ëè îäíà ñòðîêà äðóãóþ? | |||||
function isContains(findingText: string; inSourceText: string) : boolean; | |||||
begin | |||||
result := pos(findingText, inSourceText) <> 0; | |||||
end; | |||||
// --- Îêðóãëåíèå äî íóæíîãî êîëè÷åñòâà çíàêîâ ïîñëå çàïÿòîé | |||||
// --- (ñòàíäàðòíûå ôóíêöèè îêðóãëåíèÿ ó ìåíÿ ïî÷åìó-òî íå çàðàáîòàëè) | |||||
function roundFor(sourceNumber: Double ; digitAfterComma: integer) : string; | |||||
var | |||||
intPart, floatPart : integer; | |||||
begin | |||||
intPart := floor(sourceNumber); | |||||
floatPart := floor( (sourceNumber - intPart) * round(intPower(10, digitAfterComma)) ) | |||||
result := intToStr(intPart) + '.' + intToStr(floatPart) | |||||
end; | |||||
// --- Âû÷èñëèòü íîìåð òàéëà â ñèñòåìå Quadkey (èñïîëüçóåòñÿ â êàðòàõ Bing) | |||||
function getQuadkeyText(x: integer; y: integer; z: integer) : string; | |||||
var | |||||
i, q : byte; | |||||
begin | |||||
result:=''; | |||||
for i:=1 to z do begin | |||||
q:=0; | |||||
if x mod 2 = 1 then q := q + 1; | |||||
if y mod 2 = 1 then q := q + 2; | |||||
x := x div 2; | |||||
y := y div 2; | |||||
result := intToStr(q) + result; | |||||
end; | |||||
end; | |||||
// ----------------------------------------------------------------------------- | |||||
// --- 3. Åñëè òðåáóåòñÿ, òî ïîäñòàâèòü èìÿ äëÿ çåðêàëà ñåðâåðà | |||||
// --- íà ìåñòî çàãëóøêè òèïà {s: a,b,c} | |||||
// ----------------------------------------------------------------------------- | |||||
type | |||||
TSubst = record | |||||
mask, val : string; | |||||
end; | |||||
TSubsts = record | |||||
count : integer; | |||||
s : array [0..15] of TSubst; | |||||
end; | |||||
function replaceServerName(url: string) : string; | |||||
var | |||||
s, ss : string; | |||||
sarr : array [0..9] of string; | |||||
sarr_l, p : integer; | |||||
begin | |||||
s := RegExprGetMatchSubStr(url, '\{[sS]:([^}]+)\}', 0); | |||||
if s <> '' then begin | |||||
ss := s; | |||||
ss := StringReplace(ss, '{s:', '', [rfIgnoreCase]); | |||||
ss := StringReplace(ss, '}', '', [rfIgnoreCase]); | |||||
ss := ss + ','; | |||||
sarr_l := 0; | |||||
while ss <> '' do begin | |||||
p := pos(',', ss); | |||||
if p = 0 then p := length(ss); | |||||
sarr[sarr_l] := copy(ss, 1, p-1); | |||||
sarr_l := sarr_l + 1; | |||||
delete(ss, 1, p); | |||||
end; | |||||
url := StringReplace(url, s, sarr[random(sarr_l)], []); | |||||
end; | |||||
Result := url; | |||||
end; | |||||
// ----------------------------------------------------------------------------- | |||||
// --- 2. Åñëè òðåáóåòñÿ, òî âû÷èñëèòü è ïîäñòàâèòü â øàáëîí URL àäðåñà | |||||
// --- íóæíûå çíà÷åíèÿ íà ìåñòî çàãëóøåê òèïà {x}, {y}, {z}. | |||||
// ----------------------------------------------------------------------------- | |||||
function replaceLeafletPlaceholders(urlTemplate: string; x: integer; y: integer; z: integer) : string; | |||||
var | |||||
options: tReplaceFlags; | |||||
calculatedValue: string; | |||||
begin | |||||
options := [rfReplaceAll, rfIgnoreCase]; | |||||
result := urlTemplate; | |||||
if isContains('{x}', result) then begin | |||||
calculatedValue := intToStr(x); | |||||
result := stringReplace( result, '{x}', calculatedValue, options) | |||||
end; | |||||
if isContains('{y}', result) then begin | |||||
calculatedValue := intToStr(y); | |||||
result := stringReplace( result, '{y}', calculatedValue, options) | |||||
end; | |||||
if isContains('{z}', result) then begin | |||||
calculatedValue := intToStr(z-1); | |||||
result := stringReplace( result, '{z}', calculatedValue, options) | |||||
end; | |||||
if isContains('{z+1}', result) then begin | |||||
calculatedValue := intToStr(z); | |||||
result := stringReplace( result, '{z+1}', calculatedValue, options) | |||||
end; | |||||
if isContains('{x/1024}', result) then begin | |||||
calculatedValue := intToStr(x div 1024); | |||||
result := stringReplace( result, '{x/1024}', calculatedValue, options) | |||||
end; | |||||
if isContains('{y/1024}', result) then begin | |||||
calculatedValue := intToStr(y div 1024); | |||||
result := stringReplace( result, '{y/1024}', calculatedValue, options) | |||||
end; | |||||
if isContains('{-y}', result) then begin | |||||
calculatedValue := intToStr( round(intPower(2, z-1)) - 1 - y); | |||||
result := stringReplace( result, '{-y}', calculatedValue, options) | |||||
end; | |||||
if isContains('{q}', result) then begin | |||||
calculatedValue := getQuadkeyText(x, y, z); | |||||
result := stringReplace( result, '{q}', calculatedValue, options) | |||||
end; | |||||
if isContains('{bbox}', result) then begin | |||||
result := stringReplace( result, '{bbox}', '{Left},{Bottom},{Right},{Top}', options) | |||||
result := stringReplace( result, '{Left}', roundFor(GetLMetr,8), options) | |||||
result := stringReplace( result, '{Bottom}', roundFor(GetBMetr,8), options) | |||||
result := stringReplace( result, '{Right}', roundFor(GetRMetr,8), options) | |||||
result := stringReplace( result, '{Top}', roundFor(GetTMetr,8), options) | |||||
// Äåëàþ çàìåíó â ïÿòü îïåðàöèé ïîòîìó, ÷òî ïðè ïîïûòêå | |||||
// ñäåëàòü âñå îäíîé ñòðîêîé âîçíèêàåò îøèáêà. | |||||
// Âîçìîæíî êàêîå-òî îãðàíè÷åíèå íà ïàìÿòü. | |||||
end; | |||||
if isContains('{timeStamp}', result) then begin | |||||
calculatedValue := IntToStr(GetUnixTime); | |||||
result := stringReplace( result, '{timeStamp}', calculatedValue, options) | |||||
end; | |||||
end; | |||||
// ----------------------------------------------------------------------------- | |||||
// --- 1. Ñòàðò ñêðèïòà. Çàïóñòèòü âû÷èñëåíèå URL-àäðåñà òàéëà. | |||||
// --- Ñêà÷àòü òàéë ïî ïîëó÷åííîìó URL. | |||||
// ----------------------------------------------------------------------------- | |||||
begin | |||||
resultURL := replaceLeafletPlaceholders(getURLBase, getX, getY, getZ); | |||||
resultURL := replaceServerName(resultURL); | |||||
end. |
@@ -0,0 +1,7 @@ | |||||
Ýòîò ôàéë áûë ñîçäàí àâòîìàòè÷åñêè ñ ïîìîùüþ ôàéëî-ãåíåðàòîðà AnyGIS.ru | |||||
Åñëè âû çàìåòèëè îøèáêó, ñâÿæèòåñü ñî ìíîé è ñîîáùèòå î íåé: | |||||
https://t.me/anygis | |||||
https://vk.com/anygis | |||||
anygis@bk.ru |
@@ -0,0 +1,19 @@ | |||||
| |||||
[PARAMS] | |||||
GUID={051E9432-9EBD-4CB0-B21E-E209209A28C7} | |||||
ParentSubMenu_ru=Маршруты и GPS-Треки | |||||
ParentSubMenu_uk=Маршруты и GPS-Треки | |||||
ParentSubMenu=Ways and GPS-Tracks | |||||
name_ru=Strava Heatmap - Зимний спорт | |||||
name_uk=Strava Heatmap - Зимний спорт | |||||
name=Strava Heatmap - Winter | |||||
NameInCache=Tracks_Strava_Winter | |||||
asLayer=1 | |||||
projection=1 | |||||
sradiusa=6378137 | |||||
sradiusb=6378137 | |||||
DefURLBase=https://anygis.ru/api/v1/Tracks_Strava_Winter/{x}/{y}/{z} | |||||
RequestHead=Referer:https://www.strava.com/heatmap\r\nConnection: keep-alive\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36\r\nAccept: image/webp,image/apng,image/*,*/*;q=0.8\r\nAccept-Encoding: gzip, deflate\r\nAccept-Language: ru,en-US;q=0.9,en;q=0.8 | |||||
ContentType=image/jpeg,image/png | |||||
Ext=.png | |||||
License= © Strava |
@@ -1,3 +0,0 @@ | |||||
begin | |||||
ResultURL:= GetUrlBase + inttostr(GetX) + '/' + inttostr(GetY) + '/' + inttostr(GetZ - 1); | |||||
end. |
@@ -1,15 +0,0 @@ | |||||
[PARAMS] | |||||
pnum=170 | |||||
GUID={01BDC3A9-D0C1-4B84-BFB5-94AAF9D100F7} | |||||
name=RusOutdoor maps | |||||
NameInCache=rusoutdoors | |||||
DefURLBase=https://anygis.herokuapp.com/Combo_RusOutdoor/ | |||||
Ext=.jpg | |||||
defaultContentType=image/jpeg,image/png | |||||
ContentType=image/jpeg,image/png | |||||
projection=1 | |||||
sradiusa=6378137 | |||||
sradiusb=6378137 | |||||
ParentSubMenu_ru=Äðóãèå êàðòû\AnyGIS | |||||
ParentSubMenu=Other maps\AnyGIS | |||||
ParentSubMenu_uk=²íø³ êàðòè\AnyGIS |
@@ -1,3 +0,0 @@ | |||||
begin | |||||
ResultURL:= GetUrlBase + inttostr(GetX) + '/' + inttostr(GetY) + '/' + inttostr(GetZ - 1); | |||||
end. |
@@ -1,15 +0,0 @@ | |||||
[PARAMS] | |||||
pnum=170 | |||||
GUID={01BDC3A9-D0C2-4B84-BFB5-94AAF9D100F7} | |||||
name=RusOutdoor maps (lite) | |||||
NameInCache=rusoutdoors_lite | |||||
DefURLBase=https://anygis.herokuapp.com/Combo_RusOutdoor_lite/ | |||||
Ext=.jpg | |||||
defaultContentType=image/jpeg,image/png | |||||
ContentType=image/jpeg,image/png | |||||
projection=1 | |||||
sradiusa=6378137 | |||||
sradiusb=6378137 | |||||
ParentSubMenu_ru=Äðóãèå êàðòû\AnyGIS | |||||
ParentSubMenu=Other maps\AnyGIS | |||||
ParentSubMenu_uk=²íø³ êàðòè\AnyGIS |