Segregate polygons in R

المشرف العام

Administrator
طاقم الإدارة
I have a set of polygons in a single esri shapefile. I want to create a regular point grid with equal spacing (for example 1 unit) inside each of this polygons and should be able to find out for each point where it lies ie: inside which polygon. How can i do that with R. here is how the polygons look.



So thats basically SpaitalPolygonDataFrame. then i used function fortify.

f = fortify(l) long lat order hole piece group id1 -1.540710 -0.2703857 1 FALSE 1 0.1 02 -1.359192 100.6333618 2 FALSE 1 0.1 03 100.814880 100.6333618 3 FALSE 1 0.1 04 100.996399 -2.4480591 4 FALSE 1 0.1 05 -1.540710 -0.2703857 5 FALSE 1 0.1 06 100.814880 100.6333618 1 FALSE 1 1.1 17 -1.296570 100.3238525 2 FALSE 1 1.1 18 -1.726257 163.8598022 3 FALSE 1 1.1 19 100.826538 163.8598022 4 FALSE 1 1.1 110 100.814880 100.6333618 5 FALSE 1 1.1 111 -1.359192 100.6333618 1 FALSE 1 2.1 212 -1.540710 -0.2703857 2 FALSE 1 2.1 213 -96.468506 -2.5105591 3 FALSE 1 2.1 214 -94.880981 101.6297607 4 FALSE 1 2.1 215 -1.359192 100.6333618 5 FALSE 1 2.1 2how can i segregate each polygon. The column "id" could be used identify polygons. And create point grid inside each polygon which would look something like this.

pnts_in_poly1 = expand.grid(x=seq(min(poly1$long),max(poly1$long),1),y=seq(poly1$lat),max(poly1$lat),1))Let me know if you need more info. Any help will be appreciated.



أكثر...
 
أعلى