To import shapefiles you use the R function readOGR(). The first shapefile that you will open contains the point locations where trees have been measured at the study site. A point shapefile representing the location of field sites located at the San Joachin field site.A polygon shapefile representing your field site boundary.library ( rgdal ) library ( rgeos ) # for metadata/attributes- vectors or rasters library ( raster ) # set working directory to earth-analytics dir # setwd("pathToDirHere") # work with spatial data sp package will load with rgdal. You will also load the raster package so you can explore raster and vector spatial metadata using similar commands. Notice that the sp package automatically loads when rgdal is loaded. You will use the rgdal package to work with vector data in R. More about shapefiles can found on Wikipedia.For example, a line shapefile that contains the locations of streams, might contain the associated stream name, stream “order” and other information about each stream line object. Objects stored in a shapefile often have a set of associated attributes that describe the data. You will not find a mixture of point, line and polygon objects in a single shapefile. Because the structure of points, lines, and polygons are different, each individual shapefile can only contain one vector type (all points, all lines or all polygons). Geospatial data in vector format are often stored in a shapefile format. However, these boundaries, when represented as a line, will not create a closed object with a defined “area” that can be “filled”. Occasionally, a polygon can have a hole in the middle of it (like a doughnut), this is something to be aware of but not an issue you will deal with in this tutorial.ĭata Tip: Sometimes boundary layers such as states and countries, are stored as lines rather than polygons. Thus the outlines of plot boundaries, lakes, oceans, and states or countries are often represented by polygons. Polygons: A polygon consists of 3 or more vertices that are connected and “closed”.This line is composed of a series of segments, each “bend” in the road or stream represents a vertex that has defined x, y location. For instance, a road or a stream may be represented by a line.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |