필터 지우기
필터 지우기

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

조회 수: 3 (최근 30일)
Matthes Müller
Matthes Müller 2018년 9월 12일
다시 열림: Walter Roberson 2018년 12월 22일
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