2

I want to plot a map of rho(range) and theta(degrees) data around a center point at a map point of lat and long coordinates, where i later include basemaps, depth information and so on.

Is there a matlab function already available for this problem, where i could transformed x y z data to lat long value data?

I get range and angle data in meters and Degrees from a certain center point and the certain values at this point. Plotting of this is pretty easy, except that it is not georeferenced. For later use with plotted georeferenced data like topographic maps it is complicated to get a proper map. My goal is to center the whole map around a certain point and include topography, maps, datapoints and so on.

My previous approach was to "cut" the map accordingly to the center point, but this doesnt work properly in terms of measurement of range.


theta = [90,60,30,0,330,300,270,240];
rho = linspace(0,100000,15);
lvalues = randi([10 50],15,8);

rMin = min(rho);
rMax = 100000;
thetaMin=min(theta);
thetaMax =max(theta);

rRange = rMax - rMin;
rNorm = rho/rRange;
YY = (rNorm)'*cosd(theta);
XX = (rNorm)'*sind(theta);

figure('units','normalized','outerposition',[0 0 1 1]);
projection = 'mercator';
L0 = get(gcf, 'Position');
ha0 = axesm (projection);

cax = gca;

[c,h] = contourf(XX,YY,lvalues)
hold off
set(cax,'dataaspectratio',[1 1 1]);
axis off;

L1 = get(gcf, 'Position');
ax1 = axes('Position', L0);
ha1 = axesm (projection,...
    'MapLonLimit', [-58.1 -53.9],...
    'MapLatLimit', [-62.1 -59.9],...
    'Grid', 'on',...
    'Frame', 'off');

setm(ha1,'MLabelLocation', [-58 -57 -56 -55 -54]);
setm(ha1,'MLineLocation',1,'PLineLocation',1/3);
setm(ha1, 'PLabelLocation', [-62 -61.66 -61.33 -61 -60.66 -60.33 -60]);

mlabel on;
plabel on;
axis off;
tightmap;


load topo
contour3m(topo,topolegend,0:-100:-2000,'LineColor','black')

L2 = get(ha1, 'Position');
axes('Position', L1)
ha3 = axesm (projection);

p1 = plot(-56,-61,'rx', 'LineWidth', 2, 'MarkerSize', 5);
mlabel on;
plabel on;
axis off;
hold on

example of current non centered datapoints

  • You mean [`pol2cart`](https://mathworks.com/help/matlab/ref/pol2cart.html)? This transforms (note: transpose is something entirely different) polar (i.e. r,theta) coordinates to Cartesian (x,y) coordinates. – Adriaan Sep 12 '19 at 10:07
  • hi, i think this is the right direction, but i still need to get those cartesian points to be georeferenced properly. My approach now is to use ```matlab mstruct = defaultm('mercator'); mstruct.origin = [-54 -61 0]; mstruct.maplatlimit = [-62 -60.1]; mstruct.maplonlimit = [-57.9 -54.2]; mstruct = defaultm(mstruct); mstruct.maplatlimit = [-62 -60]; mstruct.maplonlimit = [-58 -54]; [lat,lon,values] = minvtran(mstruct,XX,YY,Z); ``` and print these via contourf(lat,lon,values) But i suppose it still has an issue with the projection in the first place as i get my values messed up. – Andri Baldeus Charton-Haymoss Sep 12 '19 at 13:44

1 Answers1

1

I just found the solution, I have to use rNorm as the rho dataset and handle it as a 2x2 matrix, something like this.

rMin = min(rho);
rMax = max(rho);

Rrange = rMax - rMin; % get the range for the radius
rNorm = rho/Rrange;

[Xr,Yt] = meshgrid(rNorm,theta);
[latout,lonout] = reckon('rh',-61.0147,-55.9755,Xr,Yt);
[cl,hl] = contourm(latout,lonout,lvalues');