How to crop a shapefile with a polyon?

6 visualizzazioni (ultimi 30 giorni)
Hajar
Hajar il 8 Mag 2018
Commentato: KSSV il 9 Mag 2018
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?

Risposte (1)

KSSV
KSSV il 8 Mag 2018
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 Commenti
Hajar
Hajar il 8 Mag 2018
Thank you very much for your feedback. But how can I include the radius of the circle?
KSSV
KSSV il 9 Mag 2018
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?

Accedi per commentare.

Categorie

Scopri di più su 3-D Scene Control in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by