some issues related to write kml files

19 ビュー (過去 30 日間)
lang
lang 2025 年 10 月 19 日 7:36
I have encountered an issue regarding the ordering of polygon vertices and writing to KML files. As demonstrated in the following code, I need to convert the polygon vertices to a counterclockwise order ([lonb, latb] = poly2ccw(lonb, latb); this is mandated by some data services). However, the output KML file appears somewhat strange (Figure 2). How can I obtain a KML file similar to Figure 1? I have limited knowledge in this area, and any advice would be greatly appreciated.
% load coastline
load('coast_polygon_c.mat', 'lonb', 'latb');
% check direction
ispolycw(lonb, latb)
ans = 4×1 logical array
1 0 0 0
% plot
shape = geopolyshape(latb, lonb);
shape.GeographicCRS = geocrs(4326);
figure;geoplot(shape);
% convert to counter-clockwise
[lonb, latb] = poly2ccw(lonb, latb);
% save and write kml
kmlwritepolygon('coast_polygon_c.kml', latb, lonb);
% plot
GT=readgeotable('coast_polygon_c.kml');
figure;geoplot(GT);

回答 (0 件)

カテゴリ

Help Center および File ExchangeGeographic Plots についてさらに検索

製品


リリース

R2025a

Community Treasure Hunt

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

Start Hunting!

Translated by