| Start |
|---|
| Create spatial points from XY data set When it comes to geographic data, R shows to be a powerful tool for data handling, analysis and visualisation. Often, spatial data is avaliable as an XY coordinate data set in tabular form. This example will show how to create a spatial data set from an XY data set. The packages This example uses data which can be downloaded at OpenGeocode (opens new window). At first, the working directory has to be set to the folder of the downloaded CSV data set. Furthermore, the package Afterwards, the CSV file storing cities and their geographical coordinates is loaded into R as a Often, it is useful to get a glimpse of the data and its structure (e.g. column names, data types etc.). This shows that the latitude and longitude columns are interpreted as character values, since they hold entries like "-33.532". Yet, the later used function Few of the values cannot be converted into numeric data and thus, Finally, the XY data set can be converted into a spatial data set. This requires the coordinates and the specification of the Coordinate Refrence System (CRS) in which the coordinates are stored. The basic plot function can easily be used to sneak peak the produced spatial points. |
Importing a shape file (.shp) rgdalESRI shape files can easily be imported into R by using the function It is important to know, that the rasterAnother possible way of importing shapefiles is via the Note how the path definition is different from the rgdal import statement. tmap
|
Read Article
https://develop.horje.com/learn/1434/reference