How to crop a shapefile with a polyon?

조회 수: 5 (최근 30일)
Hajar
Hajar 2018년 5월 8일
댓글: KSSV 2018년 5월 9일
Is it possible to crop a shapefile with a polygon (potentially a circle) using Matlab. I have the coordinates of buildings in a shapefile (and in xlsx file as well), and would like to extract the buildings within a given circle. Is that possible with Matlab?

답변 (1개)

KSSV
KSSV 2018년 5월 8일
Read about inpolyon.
S = shaperead('my shape file') ;
S = [[S(:).X]' [S(:).Y]'] ;
idx = inpolygon(S(:,1),S(:,2),xc,yc) ; % where xc, yc are your circle coordinates
  댓글 수: 2
Hajar
Hajar 2018년 5월 8일
Thank you very much for your feedback. But how can I include the radius of the circle?
KSSV
KSSV 2018년 5월 9일
You should be knowing this......you said you have a polygon....any ways...to describe a circle..you need a radius r and center c. YOu decide it where you want a circle with what radius. Any more doubts?

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

카테고리

Help CenterFile Exchange에서 3-D Scene Control에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by