필터 지우기
필터 지우기

How to create a spherical graph with points that are latitude and longitude?

조회 수: 25 (최근 30일)
I have a list of locations given in lat and long. How can I graph them in a sphere so that it looks like a globe?

채택된 답변

Santa Raghavan
Santa Raghavan 2017년 7월 26일
MathWorks provides a Mapping Toolbox to analyze and visualize geographic information.
Here is a useful link: Mapping toolbox
To plot and visualize a geographical location on a globe, see this example: Mesh over a globe

추가 답변 (1개)

Chad Greene
Chad Greene 2017년 8월 2일
If you don't have the Mapping Toolbox, you can always use the standard Matlab function sph2cart to represent the Earth as a sphere of radius 6371 km like this:
lat = 180*rand(500,1)-90;
lon = 360*rand(500,1);
T = 15+10*cosd(lat);
[x,y,z] = sph2cart(deg2rad(lon),deg2rad(lat),6371);
scatter3(x,y,z,40,T,'filled');
axis tight equal
cmocean thermal
Above I used the cmocean thermal colormap, but you can skip that line if you prefer. To put those data points in context, I'll use border data from my borders function, convert the borders to cartesian coordinates the same way as above, and plot with the scattered points:
hold on
C = load('borderdata.mat');
for k = 1:246
[xtmp,ytmp,ztmp] = sph2cart(deg2rad(C.lon{k}),deg2rad(C.lat{k}),6371);
plot3(xtmp,ytmp,ztmp,'k')
end
axis off
  댓글 수: 1
Chad Greene
Chad Greene 2017년 8월 2일
I answered a similar question here, where I also made the globe opaque and included lines of latitude and longitude.

댓글을 달려면 로그인하십시오.

카테고리

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