A Simple Example for the Use of Shapefiles inwards R


H5N1 elementary event for drawing an occurrence-map (polygons amongst species’ points) amongst the R-packages maptools in addition to sp using shapefiles.
HERE is the event data.

library(maptools) library(sp)  # Note that for each shapefile, you lot solely bespeak to read the .shp share # the others volition move read inwards at the same fourth dimension automatically. # TIRIS.BEZIDX_PL.shp contains the political districts of North-Tyrol # Limodorum.shp contains points amongst occurences of the found species # Limodorum abortivum. # Note that my layers role the same geographic coordinate systems (gcs), # using other information you lot would bespeak to banking venture jibe if the gcs in addition to # projection of all layers are the same!    # gear upward dir to where you lot downloaded the data: setwd("E:/R/Data/Maps/Example.1_Data") Limodorum.shp <- readShapePoints(file.choose()) TIRIS.BEZIDX_PL.shp <- readShapePoly(file.choose())  # test points: summary(Limodorum.shp) attributes([email protected])  # test polygons: summary(TIRIS.BEZIDX_PL.shp) attributes([email protected])  # limits: # to customize ylim inwards plot-call # seems non to operate here... xlim <- [email protected][1, ] ylim <- [email protected][2, ]                                                   par(mai = rep(.1, 4))  plot(TIRIS.BEZIDX_PL.shp, col = "grey93", axes = F,      xlim = xlim, ylim = ylim, bty = "n") points(Limodorum.shp, pch = 16,        col = 2, cex = .5) mtext("Limodorum abortivum", 3, line of piece of occupation = -7,       at = -17000, adj = 0, cex = 2, font = 3) legend("bottomleft", inset = c(0.4, 0.2),        legend = c("Fundpunkte", "Polit. Bezirke"),        bty = "n", pch = c(16,-1),           # bty = "n": no box        col = c(2, 1), pt.cex = c(.5, 1),        lty = c(-1, 1))

To refer bundle ‘maptools’ inwards publications use:

  Nicholas J. Lewin-Koh, Roger Bivand, contributions past times Edzer J.
  Pebesma, Eric Archer, Adrian Baddeley, Hans-Jörg Bibiko, Stéphane
  Dray, David Forrest, Michael Friendly, Patrick Giraudoux, Duncan
  Golicher, Virgilio Gómez Rubio, Patrick Hausmann, Karl Ove
  Hufthammer, Thomas Jagger, Sebastian P. Luque, Don MacQueen, Andrew
  Niccolai, Tom Short, Ben Stabler in addition to Rolf Turner (2011). maptools:
  Tools for reading in addition to treatment spatial objects. R bundle version
  0.8-10. http://CRAN.R-project.org/package=maptools

To refer bundle ‘sp’ inwards publications use:

  Pebesma, E.J., R.S. Bivand, 2005. Classes in addition to methods for spatial
  information inwards R. R News v (2), http://cran.r-project.org/doc/Rnews/.

  Roger S. Bivand, Edzer J. Pebesma, Virgilio Gomez-Rubio, 2008.
  Applied spatial information analysis amongst R. Springer, NY.
Sumber http://thebiobucket.blogspot.com