- https://www.mathworks.com/help/map/ref/geoglobe.html
- https://www.mathworks.com/help/map/ref/geoplot3.html
Plotting polygon on geoglobe
8 ビュー (過去 30 日間)
古いコメントを表示
How can someone plot a polygon with fill color on a geoglobe plot. Currently, I'm able to plot lines using the following code.
uif = uifigure;
g = geoglobe(uif,'Basemap','satellite','NextPlot','add');
for x=1:length(kmlPoly)
geoplot3(g,kmlPoly(x).Lat,kmlPoly(x).Lon,[],'r');
end
g.Terrain = 'none';
The kmlPoly(attached below) is a Matlab Structure that contains only the Polygons from a .KMZ file that was converterted to a structure. https://www.mathworks.com/matlabcentral/fileexchange/70450-kmz2struct
The above code produces this:
But I'm looking to get something like this: (The image below is from Google Earth)
0 件のコメント
回答 (1 件)
Milan Bansal
2024 年 4 月 29 日
Hi Mathieu Vinette,
I understand you are able to get the boundary of the polygons on geoglobe, but you wish to get the filled shapes with different colors instead, as shown in the Google Earth image.
To fill the polygons on a geoglobe in MATLAB, it is not possible to directly use a function like fill or geofill because these are not directly compatible with the geoglobe. However, the color information is given in the "kmlPoly" structure for each polygon. Plot the polygons with their respective colors using geoplot3 as shown in the code snippet below:
uif = uifigure;
g = geoglobe(uif,'Basemap','satellite','NextPlot','add');
for x=1:length(kmlPoly)
geoplot3(g,kmlPoly(x).Lat,kmlPoly(x).Lon,[], Color = kmlPoly(x).Color); % Getting the colour from kmlPoly
end
g.Terrain = 'none';
Here is the output of the above code.
Please refer to the following documentation to learn more about geoglobe and geoplot3.
Hope it helps!
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!