GetUrlScript.txt 1.1 KiB

54 년 전
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. function Exp(X: extended): extended;
  2. var m, n: integer;
  3. r, fac, pow: extended;
  4. begin
  5. m:=Round(Abs(X/10));
  6. if m >= 2 then X:=X/m;
  7. Result:=1+X;
  8. fac:=1;
  9. pow:=X;
  10. n:=2;
  11. while r<>Result do
  12. begin
  13. fac:=fac*n;
  14. pow:=pow*X;
  15. n:=n+1;
  16. r:=Result;
  17. Result:=Result+pow/fac;
  18. end;
  19. if m >= 2 then
  20. begin
  21. pow:=Result;
  22. for n:=2 to m do
  23. Result:=Result*pow;
  24. end;
  25. end;
  26. function ArcTan(x: Extended): Extended;
  27. var i: Integer;
  28. begin
  29. if x>1.0
  30. then Result := Pi / 2 - ArcTan(1 / x)
  31. else for i := 0 to 200 do
  32. Result:=Result+((intpower((-1),i)*intpower(x,(2*i+1)))/(2*i+1));
  33. while Result>360 do
  34. Result:=Result-360;
  35. while Result<0 do
  36. result:=result+360;
  37. end;
  38. function y2lat(y:integer):extended;
  39. var TilesAtZoom : Integer;
  40. begin
  41. TilesAtZoom := 1 shl (GetZ+7);
  42. result:=(y-TilesAtZoom/2)/-(TilesAtZoom/(2*PI));
  43. result:=(2*arctan(exp(result))-PI/2)*180/PI;
  44. end;
  45. begin
  46. ResultURL:=GetURLBase+RoundEx(GetLLon,13)+','+RoundEx(y2lat((GetY*256)+298),13)+','+
  47. RoundEx(GetRLon,13)+','+RoundEx(GetTLat,13);
  48. end.