SASGIS

Веб-картография и навигация

Problem with navionics web app

English- or other language speakers welcome here
Please do not translate your native language to "broken Russian" via crappy machine translation services - please post it as it is, in your native language.

Модератор: Tolik

Problem with navionics web app

Сообщение Maciekm1 » 09 дек 2018, 11:31

Hello
Sasplanet is not connected to the navionics web app. How to fix the error.
Information in map settings.

Settings - internet:
Please help me with the problem.
Base part of request URL: http://backend.navionics.io/tile/
Custom HTTP Headers: Referer: https://webapiv2.navionics.com/examples ... ample.html
Map Version:

Listings - Params.txt
[PARAMS]
GUID={A830C100-49C8-4623-957A-60B85C39FBE0}
name=Navionics Marine Charts
ParentSubMenu_ru=Ěîđńęčĺ ęŕđňű
ParentSubMenu=Marine maps
DefURLBase=http://backend.navionics.io/tile/
NameInCache=navionics
Ext=.png
ContentType=image/png
projection=1
sradiusa=6378137
sradiusb=6378137
IsUseDownloaderInScript=1
RequestHead=Referer: https://webapiv2.navionics.com/examples ... ample.html

GetUrlScript.txt

//******************************************************************************
// LAYERS parameter: config_a_b_c
// a = 1 for depth in meters, 2 for depth in feet, 3 for fathoms
// b = 10.00: for 10.00 m safety depth (beginning of blue coloring) (unit equal to that set by a)
// c = 0 for pristine Navionics charts, 1 for Sonar Charts
//
// TRANSPARENT parameter:
// FALSE for non-layer
// TRUE for layer
//
// UGC parameter:
// FALSE for pristine Navionics charts
// TRUE for additinal user-generated content icons
//******************************************************************************

const
cReqParams = 'LAYERS=config_1_10.00_0&TRANSPARENT=FALSE&UGC=FALSE';

//******************************************************************************

const
cTTL = 24*60*60; // 24 hour
cNavTokenKey = 'NavToken=';
cTimeStampKey = 'TimeStamp=';

function CheckTTL(const ATimeStamp: AnsiString): Boolean;
begin
Result := ( (cTTL div 2) > GetUnixTime - StrToInt64Def(ATimeStamp, 0) );
end;

function GetNavToken: AnsiString;
var
VNavToken: AnsiString;
VTimeStamp: AnsiString;
VResponseCode: Cardinal;
VResponseHeader, VResponseData: AnsiString;
VRequestUrl, VRequestHeader: AnsiString;
begin
Result := '';

if ScriptBuffer <> '' then begin
VNavToken := GetBetween(ScriptBuffer, cNavTokenKey, ';');
VTimeStamp := GetBetween(ScriptBuffer, cTimeStampKey, ';');
if (VNavToken <> '') and (VTimeStamp <> '') and CheckTTL(VTimeStamp) then begin
Result := VNavToken;
end else begin
ScriptBuffer := '';
end;
end;

if (Result = '') and Assigned(Downloader) then begin
VTimeStamp := IntToStr(GetUnixTime);
VRequestUrl := 'https://backend.navionics.io/tile/get_key/Navionics_internalpurpose_00001/webapiv2.navionics.com?_=' + VTimeStamp;
VRequestHeader := 'Origin: https://webapiv2.navionics.com' + #13#10 + 'Referer: https://webapiv2.navionics.com/examples ... ple.html';
VResponseHeader := '';
VResponseData := '';
VResponseCode := Downloader.DoHttpRequest(VRequestUrl, VRequestHeader, '', VResponseHeader, VResponseData);

if VResponseCode = 200 then begin
Result := VResponseData;
ScriptBuffer := cNavTokenKey + Result + ';' + cTimeStampKey + VTimeStamp + ';';
end;
end;
end;

//******************************************************************************

var
VNavToken: AnsiString;
begin
VNavToken := GetNavToken;
if VNavToken <> '' then begin
ResultURL := GetURLBase + IntToStr(GetZ-1) + '/' + IntToStr(GetX) + '/' +
IntToStr(GetY) + '?' + cReqParams + '&' + 'navtoken=' + VNavToken;
end else begin
ResultURL := '';
end;
end.


Best regards
Maciek
Maciekm1
Новичок
 
Сообщения: 1
Зарегистрирован: 04 дек 2018, 17:08
Благодарил (а): 0 раз.
Поблагодарили: 0 раз.

Вернуться в International visitors section

Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 1