这是一个不需要任何工具箱的示例.
首先,我们创建一个使用Mercator projection转换长/纬度位置的函数.
function [x,y] = mercatorProjection(lon, lat, width, height)
x = mod((lon+180)*width/360, width) ;
y = height/2 - log(tan((lat+90)*pi/360))*width/(2*pi);
end
我们创建了一些地点:
% GPS positions (latitude,longitude) of some markers
data = [
-22.976730, - 43.195080 ;
55.756950, 37.614975 ;
33.605381, - 7.631940 ;
35.670479, 139.740921 ;
51.506325, - 0.127144 ;
40.714550, - 74.007124 ;
-33.869629, 151.206955 ;
-26.204944, 28.040035 ;
37.777125, -122.419644 ;
30.083740, 31.255360 ;
6.439180, 3.423480
];
labels = {
'Rio de Janeiro'
'Moscow'
'Casablanca'
'Tokyo'
'London'
'New York