6

I am a R user and quite new in GIS.

From Adding Attribute data to shapefile? I know how to add/edit attribute data (say population) to shapefile using R.

Now, I have some shapefiles with attribute data, and I know how to make a static map, but I would like to know if there is a way to make an interactive map in R, e.g. allow zooming, hover a region will display the corresponding attribute data in R.

If not, I have heard of a free and open-source GIS software QGIS, is it possible to do it using that instead?

4

Yes with leaflet

3

Just to add a few more pointers to the links mentioned in @nebi's answer:

3

Please refer to this similar question posed at StackOverflow.

The mapview package has been developed for this particular purpose and allows you to interactively display any objects of class 'Spatial*' and 'Raster*'. Note that it also comes with a variety of background map layers for better spatial orientation. For a short introduction to what mapview is capable of, feel free to browse the package vignette. Here, for example, is some code that displays the widely applied 'meuse' dataset from sp and, at the same time, allows you to interactively retrieve information from all the single data points. Check out ?mapview to grow familiar with the numerous costumization options that the package offers.

## required packages
# install.packages("mapview")
library(mapview)
library(sp)

## import 'meuse' dataset
data("meuse")

coordinates(meuse) <- ~ x + y
proj4string(meuse) <- CRS("+init=epsg:28992")

## create viewer (background layer 'OpenTopoMap')
mapview(meuse)

enter image description here

2

QGIS is a GIS platform. Designed for you to do analytical computations on a spatial document. In short, you are making a map. In R, you can also create analytical computations based on GIS statistical analysis. The question is whether or not you are creating a spatial dashboard, or a mapping product. Here is a couple of websites that will give you R-based GIS:

http://www.maths.lancs.ac.uk/~rowlings/Teaching/UseR2012/index.html http://spatial-analyst.net/wiki/index.php?title=Main_Page http://spatial.ly/r/ (If you are educated on ggplot2, this is good).

For R functionality in QGIS: Resources on using R in QGIS for R users?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.