bufferm works differently with the same data sets?
2 views (last 30 days)
Show older comments
Faez Alkadi
on 25 Nov 2021
Edited: Faez Alkadi
on 2 Dec 2021
I am using bufferm to find buffer arounf letters of a name. The letter are consisting of segments in both clockwise and anti_clockwise. first file with name Name works perfect while the other file named Name_Shifted doesn't.
Both files are attached
Here is what is did for the first file Name:
BufferSize=0.3;
Segments=Name;
%Segments=Name_Shifted;
for L=1:length(Segments(:, 1))
xyz=Segments{L, 1};
xyz1=[xyz;xyz(1,:)]; %To close the segment
xyz2=xyz1;
plot(xyz2(:,1),xyz2(:,2),'color',rand(1,3))
hold on
[x1,y1] = bufferm(xyz1(:,1),xyz1(:,2),BufferSize,'in');
xyz3=[x1,y1];
plot(xyz3(:,1),xyz3(:,2),'Color','k')
hold on
end
and this was the result:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/813524/image.png)
However, Here is what is did for the first file Name_Shifted :
BufferSize=0.3;
%Segments=Name;
Segments=Name_Shifted;
for L=1:length(Segments(:, 1))
xyz=Segments{L, 1};
xyz1=[xyz;xyz(1,:)]; %To close the segment
xyz2=xyz1;
plot(xyz2(:,1),xyz2(:,2),'color',rand(1,3))
hold on
[x1,y1] = bufferm(xyz1(:,1),xyz1(:,2),BufferSize,'in');
xyz3=[x1,y1];
plot(xyz3(:,1),xyz3(:,2),'Color','k')
hold on
end
and this was the result:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/815104/image.png)
0 Comments
Accepted Answer
Harikrishnan Balachandran Nair
on 1 Dec 2021
Hi Faiz,
I understand that you are trying to find the buffer zone inside your polygon using the 'bufferm' function. The 'bufferm' function expects the inputs to be in degrees, specifying the latitude and longitude.
However , In the 'Name_Shifted' mat file, i understand that you have shifted all the points in the 'x' and 'y' direction by a value of 200. when these values are given as input to the 'bufferm' function, it is perceived as latitudes and longitudes. This makes the latitude take values which is much more than 90 degree .This is the reason that the results are not as expected.
You can observe the issue by using 'geoplot' instead of 'plot' for plotting these polygons in the geographic co-ordinates.
1 Comment
More Answers (0)
See Also
Categories
Find more on Map Display in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!