 
			
				09.12.2009, 17:10
			
			
			
		  
	 | 
	
		
		
		
			
			| 
			
				
				
				 Модератор 
				
				
			 | 
			  | 
			
				
				
					Регистрация: 17.04.2008 
					
					
					Сообщения: 8,111
 
				Версия Delphi: 7, XE3, 10.2 
					Репутация: 49089 
					    
				 
				
			 | 
		 
		 
		
	 | 
	
	
	
		
			
			
			 
			
		
		
		
		Как-то так: 
	Код: 
	unit Unit2;
interface
uses
  SysUtils, Windows, Classes, Math;
type
  gmaps = class
  public
    function tile(lat, lng : Double; zoom : Integer) : TPoint;
    function Xpixel(lng : Double; zoom : Integer) : Integer;
    function Ypixel(lat : Double; zoom : Integer) : Integer;
  end;
implementation
{ gmaps }
function gmaps.tile(lat, lng: Double; zoom: Integer): TPoint;
begin
  Result.X := Round(Xpixel(lng, zoom) / 256);
  Result.Y := Round(Ypixel(lat, zoom));
end;
function gmaps.Xpixel(lng: Double; zoom: Integer): Integer;
var
  dlng : Double;
  dxpixel : Double;
begin
  dlng := lng + 180; // this.lng.Value + 180.0; <- не понятно, что за this.lng.Value
  dxpixel := dlng / 360.0 * 256 * Power(2, 17 - zoom);
  Result := Round(dxpixel);
end;
function gmaps.Ypixel(lat: Double; zoom: Integer): Integer;
var
  ypixelcenter : Double;
  dypixel : Double;
begin
  ypixelcenter := Power(2, 25 - zoom - 1);
  dypixel := ypixelcenter - Ln(Tan(lat * PI / 360 + PI / 4)) * ypixelcenter / PI;
  Result := Round(dypixel);
end;
end. 
  
		
	
		
		
		
		
		
	
		
		
	
	
	 |