Changing the axes in a figure from geographical coordinates to distance in km

3 次查看(过去 30 天)
Several lines originate from one given point to different places on Earth, shown here in geographical coordinates.
I want the origin on the axes to be displayed as "0 km" and then scale the axes according to the distance from the origin, which can be easily calculated using
distance(lat1,lon1,lat2,lon2,Earth)
How can I include this in my figure programming?
  6 个评论
Simon Streit
Simon Streit 2018-9-12
I am sure this is not possible for at least the x-Axis, because 1° in x-direction at the equator in W or E is a lot more distance travelled than 1° close the poles. This is the old problem of mapping a sphere to 2D, it's not possible!
jonas
jonas 2018-9-12
Geomapping is a bit outside of my expertise but I am inclined to agree with Simon. One axis will become non-linear.

请先登录,再进行评论。

回答(1 个)

jonas
jonas 2018-9-12
I found your figure in another question and attached it to this answer. You could try something like this:
% Units of lat/lon
openfig('Figure.fig')
% Extract data
h=get(gca,'children')
xdata=get(h,'xdata')
ydata=get(h,'ydata')
% Calculate arclength from the origin
yd=cellfun(@(x,y) distance(x(1),y,x(1),y(1)),xdata,ydata,'uniformoutput',false);
xd=cellfun(@(x,y) distance(x,y(1),x(1),y(1)),xdata,ydata,'uniformoutput',false);
% Paths going west and south set to negative
for i=1:length(xdata)
xd{i}(xdata{i}<xdata{i}(1))=xd{i}(xdata{i}<xdata{i}(1)).*-1;
yd{i}(ydata{i}<ydata{i}(1))=yd{i}(ydata{i}<ydata{i}(1)).*-1;
end
% Units of arclength
figure;hold on
h=cellfun(@plot,xd,yd)
However, combining the two figures in the same axes will be difficult.

类别

Help CenterFile Exchange 中查找有关 Geographic Plots 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by