这需要一个小脚本。为了使其可重现,我将尝试在R中完成它。通过在Sextante模型中使用批处理(在功能上单击鼠标右键),QGis和Sextante也应该可行。在这里,您可以先使用矢量交集工具,然后再使用某种空间连接。
在R中,我会这样尝试。您可能需要修改代码,因为我不知道您的数据结构和变量。
library(raster);library(rgdal);library(sp) # Load in required packages
vegetation <- readOGR("H:/Examplefolder", # To load a vegetation polygon shape here
"vegi") # called vegi.shp
setwd(harddriveD) # Now, switch to the directory containing your species shapes
# and use the following code
species_files <- grep( ".shp", # to extract all shape names
dir(),
ignore.case=T,
value=T)
# Now read in your speciesfiles in a loop
for(name in species_files){ # and do a vegetation data
# overlay with your basename
spec_name <- strsplit(name,split=".shp")[[1]] # to get only the load in
# your species name shape.
spec_shp <- readOGR(".",spec_name) # I assume that you have point data. Otherwise change the code.
ov <- over(spec_shp,vegetation) # Make a overlay with your vegetation data,
# returns a dataframe of the overlaying vegetation shape attributes,
# which are within your species shape.
# This dataframe has the same number of rows as your input species shape.
cd <- coordinates(spec_shp); # Therefore you could just append the needed information to your species shape.
proj <- proj4string(spec_shp) # save coordinates and proj.
# Append your vegetation data to your species shape
spec_shp$Vegetation <- ov$ShrubSpecies # Or whatever you want to get.
spp <- SpatialPointsDataFrame( # In the end export your shape again.
coords=cd, # I would advise you to use a different folder.
data=as.data.frame(spec_shp), # In case you have polygons instead of Point data
proj4string=CRS(proj) ) # use the SpatialPolygonDataFrame function. -> help ?SpatialPolygonDataFrame
writeOGR(spp, #Should result in a new shape
"foldername", # which has your species name.
spec_name,
driver="ESRI Shapefile")
}
我对您的目标和数据集的结构做出了许多假设。在尝试之前,您很可能必须根据需要更正代码。