how to do union of geopolyshape?

9 views (last 30 days)
Sierra
Sierra on 28 Jun 2022
I made several geopolyshapes in geoplot. but I want to merge every geopolyshape to one geopolyshape,
I've used union of plot, but it didn't work for geoplot
This is my code for plotting the first image.
for i = 1:length(dep_xl)-1
shape1 = geopolyshape([dep_lat(i,1),dep_lat(i,2),dep_lat(i,3),dep_lat(i,4)],[dep_lon(i,1),dep_lon(i,2),dep_lon(i,3),dep_lon(i,4)]);
shape2 = geopolyshape([dep_lat(i+1,1), dep_lat(i+1,2), dep_lat(i+1,3) ,dep_lat(i+1,4)],[dep_lon(i+1,1),dep_lon(i+1,2), dep_lon(i+1,3) ,dep_lon(i+1,4)]);
geoplot(shape1)
hold on
geoplot(shape2)
end
and this is what i tried.
for i = 1:length(dep_xl)-1
shape1 = geopolyshape([dep_lat(i,1),dep_lat(i,2),dep_lat(i,3),dep_lat(i,4)],[dep_lon(i,1),dep_lon(i,2),dep_lon(i,3),dep_lon(i,4)]);
shape2 = geopolyshape([dep_lat(i+1,1), dep_lat(i+1,2), dep_lat(i+1,3) ,dep_lat(i+1,4)],[dep_lon(i+1,1),dep_lon(i+1,2), dep_lon(i+1,3) ,dep_lon(i+1,4)]);
polyout = union(shape1,shap2)
geoplot(polyout)
hold on
end
Thanks!

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by