[英]How can I select specific regions from a shapefile?
I have the present shapefile我有现在的 shapefile
heitaly<- readOGR("ProvCM01012017/ProvCM01012017_WGS84.shp")
FinalData<- merge(italy, HT, by.x="COD_PROV", by.y="Domain")
But I'm interesting not on all Italy, but also same provinces.但我感兴趣的不是整个意大利,还有相同的省份。 How can I get them?
我怎样才能得到它们?
There are many ways to select a category into a shapefile.有多种方法可以将类别选择到 shapefile 中。 I don't know for what do you want.
我不知道你想要什么。 For example if it is to colour a specific region in a plot or to select a row from shapefile attribute table.
例如,如果要为绘图中的特定区域着色或从 shapefile 属性表中选择一行。
To plot:绘制:
plot(shape, col = shape$column_name == "element") # general example
plot(heitaly, col = heitaly$COD_PROV == "name of province") # your shapefile
To attribute table:到属性表:
df <- shape %>% data.frame
This will give you the complete attribute table df <- shape %>% data.frame
这将为您提供完整的属性表
row <- shape %>% data.frame %>% slice(1)
This will give you the first row with all columns.这将为您提供所有列的第一行。 If you change the number 1 to another number, for example 3, will give you the information for row number 3
如果您将数字 1 更改为另一个数字,例如 3,将为您提供第 3 行的信息
I hope have been useful我希望有用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.