Spatial Data



Spatial Datalibrary(mdsr)## Loading required package: dplyr## ## Attaching package: 'dplyr'## The following objects are masked from 'package:stats':## ## filter, lag## The following objects are masked from 'package:base':## ## intersect, setdiff, setequal, union## Loading required package: lattice## Loading required package: ggformula## Loading required package: ggplot2## Loading required package: ggstance## ## Attaching package: 'ggstance'## The following objects are masked from 'package:ggplot2':## ## geom_errorbarh, GeomErrorbarh## ## New to ggformula? Try the tutorials: ## learnr::run_tutorial("introduction", package = "ggformula")## learnr::run_tutorial("refining", package = "ggformula")## Loading required package: mosaicData## Loading required package: Matrix## ## The 'mosaic' package masks several functions from core packages in order to add ## additional features. The original behavior of these functions should not be affected by this.## ## Note: If you use the Matrix package, be sure to load it BEFORE loading mosaic.## ## In accordance with CRAN policy, the 'mdsr' package ## no longer attaches## the 'tidyverse' package automatically.## You may need to 'library(tidyverse)' in order to ## use certain functions.library(sp)plot(CholeraDeaths)It is probably best to do this in an R Project.library(rgdal)## rgdal: version: 1.4-4, (SVN revision 833)## Geospatial Data Abstraction Library extensions to R successfully loaded## Loaded GDAL runtime: GDAL 2.1.2, released 2016/10/24## Path to GDAL shared files: /usr/share/gdal/2.1## GDAL binary built with GEOS: TRUE ## Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493]## Path to PROJ.4 shared files: (autodetected)## Linking to sp version: 1.3-1## ## Attaching package: 'rgdal'## The following object is masked from 'package:mosaic':## ## projectdownload.file(";, dest="SnowGIS.zip", mode="wb")unzip("SnowGIS.zip")getwd()## [1] "/home/esuess/classes/2019-2020/01 - Fall 2019/Stat651/Presentations/08_spatial"dsn <- paste0("./SnowGIS_SHP/")list.files(dsn)## [1] "Cholera_Deaths.dbf" "Cholera_Deaths.prj" ## [3] "Cholera_Deaths.sbn" "Cholera_Deaths.sbx" ## [5] "Cholera_Deaths.shp" "Cholera_Deaths.shx" ## [7] "OSMap_Grayscale.tfw" "OSMap_Grayscale.tif" ## [9] "OSMap_Grayscale.tif.aux.xml" "OSMap_Grayscale.tif.ovr" ## [11] "OSMap.tfw" "OSMap.tif" ## [13] "Pumps.dbf" "Pumps.prj" ## [15] "Pumps.sbx" "Pumps.shp" ## [17] "Pumps.shx" "README.txt" ## [19] "SnowMap.tfw" "SnowMap.tif" ## [21] "SnowMap.tif.aux.xml" "SnowMap.tif.ovr"ogrListLayers(dsn)## [1] "Pumps" "Cholera_Deaths"## attr(,"driver")## [1] "ESRI Shapefile"## attr(,"nlayers")## [1] 2ogrInfo(dsn, layer = "Cholera_Deaths")## Source: "/home/esuess/classes/2019-2020/01 - Fall 2019/Stat651/Presentations/08_spatial/SnowGIS_SHP", layer: "Cholera_Deaths"## Driver: ESRI Shapefile; number of rows: 250 ## Feature type: wkbPoint with 2 dimensions## Extent: (529160.3 180857.9) - (529655.9 181306.2)## CRS: +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +units=m +no_defs ## LDID: 87 ## Number of fields: 2 ## name type length typeName## 1 Id 0 6 Integer## 2 Count 0 4 IntegerCholeraDeaths <- readOGR(dsn, layer = "Cholera_Deaths")## OGR data source with driver: ESRI Shapefile ## Source: "/home/esuess/classes/2019-2020/01 - Fall 2019/Stat651/Presentations/08_spatial/SnowGIS_SHP", layer: "Cholera_Deaths"## with 250 features## It has 2 fieldssummary(CholeraDeaths)## Object of class SpatialPointsDataFrame## Coordinates:## min max## coords.x1 529160.3 529655.9## coords.x2 180857.9 181306.2## Is projected: TRUE ## proj4string :## [+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000## +y_0=-100000 +ellps=airy +units=m +no_defs]## Number of points: 250## Data attributes:## Id Count ## Min. :0 Min. : 1.000 ## 1st Qu.:0 1st Qu.: 1.000 ## Median :0 Median : 1.000 ## Mean :0 Mean : 1.956 ## 3rd Qu.:0 3rd Qu.: 2.000 ## Max. :0 Max. :15.000str(CholeraDeaths@data)## 'data.frame': 250 obs. of 2 variables:## $ Id : int 0 0 0 0 0 0 0 0 0 0 ...## $ Count: int 3 2 1 1 4 2 2 2 3 2 ...cholera_coords <- as.data.frame(coordinates(CholeraDeaths))cholera_coords## coords.x1 coords.x2## 1 529308.7 181031.4## 2 529312.2 181025.2## 3 529314.4 181020.3## 4 529317.4 181014.3## 5 529320.7 181007.9## 6 529336.7 181006.0## 7 529290.1 181024.4## 8 529301.0 181021.2## 9 529285.0 181020.2## 10 529288.4 181031.8## 11 529280.6 181026.6## 12 529264.7 181035.2## 13 529274.9 181008.0## 14 529278.3 181003.0## 15 529281.4 180997.1## 16 529259.6 181010.3## 17 529256.2 181001.8## 18 529309.8 181004.7## 19 529314.1 180997.4## 20 529318.0 180991.3## 21 529251.0 181032.5## 22 529248.0 181049.2## 23 529231.4 181027.7## 24 529236.7 181025.3## 25 529244.0 181028.9## 26 529251.0 181054.8## 27 529247.0 181060.5## 28 529243.6 181066.1## 29 529241.6 181058.4## 30 529217.4 181048.2## 31 529211.5 181056.2## 32 529212.3 181038.3## 33 529191.3 181046.7## 34 529184.2 181041.9## 35 529160.3 181014.2## 36 529228.3 181015.2## 37 529187.3 180983.3## 38 529213.1 180978.5## 39 529214.0 180970.6## 40 529222.8 180978.7## 41 529233.1 180985.7## 42 529221.1 180985.6## 43 529275.9 180965.2## 44 529262.1 180970.8## 45 529299.8 180931.9## 46 529304.2 180925.2## 47 529307.8 180921.2## 48 529302.2 180919.6## 49 529293.0 180929.9## 50 529319.5 180915.9## 51 529330.5 180923.9## 52 529335.4 180928.9## 53 529331.1 180915.7## 54 529345.1 180912.3## 55 529350.2 180915.2## 56 529353.7 180910.2## 57 529377.2 180935.5## 58 529362.9 180947.1## 59 529371.7 180952.2## 60 529326.3 180980.5## 61 529338.1 180959.4## 62 529346.0 180961.4## 63 529349.7 180955.4## 64 529352.8 180950.5## 65 529337.9 180976.0## 66 529335.4 180990.7## 67 529341.9 180993.9## 68 529347.4 180995.6## 69 529352.9 180999.5## 70 529367.8 181007.2## 71 529374.1 181010.4## 72 529383.5 181014.5## 73 529389.1 181017.1## 74 529394.1 181020.4## 75 529409.2 181005.2## 76 529420.9 180989.5## 77 529414.7 180978.8## 78 529407.8 180975.2## 79 529402.6 180971.6## 80 529395.8 180968.2## 81 529387.7 180962.6## 82 529377.1 180956.5## 83 529419.3 180973.1## 84 529400.9 180956.4## 85 529404.3 180948.8## 86 529415.3 180955.6## 87 529421.0 180944.9## 88 529414.9 180930.9## 89 529419.2 180926.4## 90 529431.7 180928.4## 91 529435.7 180922.8## 92 529438.6 180916.7## 93 529443.8 180907.2## 94 529424.2 180916.0## 95 529450.8 180876.2## 96 529456.3 180886.5## 97 529460.5 180880.9## 98 529466.4 180874.2## 99 529508.1 180865.5## 100 529505.9 180884.2## 101 529488.0 180906.0## 102 529487.2 180896.1## 103 529482.7 180901.6## 104 529461.3 180941.2## 105 529454.0 180941.3## 106 529446.5 180951.9## 107 529442.3 180957.8## 108 529436.4 180965.2## 109 529431.8 180970.9## 110 529438.4 180974.8## 111 529434.3 180981.3## 112 529491.1 180963.4## 113 529505.2 180972.5## 114 529539.2 180938.7## 115 529548.7 180901.7## 116 529517.8 180902.8## 117 529506.0 181007.0## 118 529555.2 180997.4## 119 529547.1 181009.3## 120 529552.0 181002.0## 121 529540.8 181017.3## 122 529537.3 181023.3## 123 529532.4 181032.8## 124 529528.9 181038.4## 125 529494.9 181042.4## 126 529519.2 181037.1## 127 529500.8 181048.5## 128 529488.0 181043.0## 129 529507.2 181056.0## 130 529457.0 181013.9## 131 529459.9 181008.7## 132 529461.5 181003.5## 133 529468.3 180994.3## 134 529471.5 180989.7## 135 529478.8 180976.1## 136 529454.7 181018.6## 137 529439.2 181039.2## 138 529432.9 181036.0## 139 529426.9 181032.6## 140 529514.4 180944.8## 141 529528.8 180944.3## 142 529521.7 180940.7## 143 529514.6 180936.8## 144 529618.1 181008.0## 145 529633.0 181018.5## 146 529631.0 181010.0## 147 529655.9 181022.4## 148 529581.2 181052.4## 149 529577.9 181061.4## 150 529570.0 181062.4## 151 529574.8 181050.0## 152 529561.4 181082.5## 153 529565.3 181071.9## 154 529531.8 181068.9## 155 529526.0 181082.9## 156 529509.9 181091.9## 157 529516.9 181056.6## 158 529518.3 181105.1## 159 529565.4 181090.6## 160 529571.1 181075.9## 161 529554.3 181109.6## 162 529548.4 181118.5## 163 529546.0 181124.5## 164 529533.5 181127.5## 165 529553.4 181137.8## 166 529566.3 181144.7## 167 529567.7 181142.5## 168 529573.9 181145.4## 169 529572.7 181147.6## 170 529590.7 181161.4## 171 529583.8 181158.5## 172 529588.9 181155.9## 173 529597.4 181159.6## 174 529595.9 181164.2## 175 529600.7 181166.0## 176 529608.4 181169.9## 177 529615.2 181168.6## 178 529620.2 181171.5## 179 529541.7 181306.2## 180 529489.0 181233.7## 181 529479.7 181228.3## 182 529437.2 181190.5## 183 529382.8 181191.9## 184 529398.0 181200.1## 185 529463.7 181155.2## 186 529468.2 181182.9## 187 529518.8 181153.5## 188 529530.7 181152.2## 189 529520.6 181195.5## 190 529460.5 181143.3## 191 529470.3 181144.7## 192 529464.4 181137.4## 193 529481.0 181125.5## 194 529469.8 181124.7## 195 529485.2 181116.8## 196 529477.1 181112.5## 197 529424.3 181139.0## 198 529417.3 181135.2## 199 529424.1 181159.6## 200 529431.3 181162.6## 201 529437.3 181164.6## 202 529420.8 181167.1## 203 529410.2 181162.7## 204 529374.7 181154.2## 205 529375.7 181128.3## 206 529384.7 181130.6## 207 529386.8 181104.6## 208 529392.3 181114.7## 209 529391.7 181094.0## 210 529432.4 181102.3## 211 529443.7 181108.0## 212 529448.9 181110.3## 213 529455.4 181114.8## 214 529451.4 181103.5## 215 529440.5 181099.1## 216 529434.3 181094.9## 217 529429.4 181093.1## 218 529477.3 181080.5## 219 529484.5 181100.5## 220 529470.6 181077.4## 221 529463.9 181074.1## 222 529454.7 181069.3## 223 529448.5 181065.4## 224 529442.5 181063.1## 225 529427.1 181054.9## 226 529402.3 181040.9## 227 529395.7 181038.1## 228 529389.6 181034.7## 229 529381.9 181031.7## 230 529376.7 181026.6## 231 529357.4 181028.2## 232 529396.3 181082.2## 233 529406.5 181084.7## 234 529347.4 181048.7## 235 529343.4 181054.3## 236 529339.6 181068.2## 237 529281.7 181086.4## 238 529347.1 181071.8## 239 529304.0 181040.6## 240 529293.4 181063.7## 241 529286.6 181055.9## 242 529284.2 181063.4## 243 529296.3 181102.6## 244 529306.3 181179.3## 245 529320.3 181184.8## 246 529362.7 181156.1## 247 529365.2 181176.1## 248 529274.2 180907.3## 249 529299.4 180873.2## 250 529324.8 180857.9cholera_coords %>% ggplot(aes(x = coords.x1, y = coords.x2)) + geom_point() + coord_quickmap() ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download