Filter löschen
Filter löschen

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

3 Ansichten (letzte 30 Tage)
Matthes Müller
Matthes Müller am 12 Sep. 2018
Erneut geöffnet: Walter Roberson am 22 Dez. 2018
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 Kommentare
Simon Streit
Simon Streit am 12 Sep. 2018
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 am 12 Sep. 2018
Geomapping is a bit outside of my expertise but I am inclined to agree with Simon. One axis will become non-linear.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

jonas
jonas am 12 Sep. 2018
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.

Kategorien

Mehr zu Geographic Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by