mapview 1.0.0 now on CRAN

[This article was first published on metvurst, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

we are happy to announce that mapview 1.0.0 has been released on CRAN.
Together with Florian Detsch (R, Rcpp), Christoph Reudenbach (js) and
Stefan Woellauer (js) we have put together a powerful tool for
on-the-fly mapping of spatial data during the workflow.

In addition to the existing functionality described in my earlier mail,
we have:

1) made the whole code a lot faster, so rendering should be much quicker
now.

2) added “big data” support for vector data.
It is now possible to view even very large vector objects without any
hassle.
This is possible due to the inclusion of special .js functionality. This
means that when working with large Spatial* objects mapview does not use
leaflet for R, but its own functions. This also means that leaflet
integration is not possible for big data. In a nutshell, big data
support is achieved by separating drawing of the geometries and parsing
of the underlying data. This means that in order to query the attributes
of your objects you will need to zoom in a bit. For polygons and lines
the features will turn magenta once they are queryable, for points the
query-radius around the points is restricted quite a bit.
As an example, on my machine (ubuntu 14.04 64-bit, 7.5 GB RAM, Intel®
Core™ i5-4300U CPU @ 1.90GHz × 4, 500GB SSD) 2.1 Mio. points take about
30 sec. to render and the interactive behavior of zooming and panning
is smooth and feels just like dealing with only a handful of points.

For those who are interested in trying yourself, here's a bit of code to
create an artificial SpatialPointsDataFrame with a bit more than 2.1
Mio. points (to change the size simply change the number of repeats in
the first line.

BE AWARE THAT FROM ABOUT 5 MIO POINTS THINGS MAY WELL BREAK!!

library(ggplot2)
library(rgdal)
library(mapview)

data(diamonds)

### blow diamonds up a bit
big <- diamonds[rep(seq_len(nrow(diamonds)), 40), ]
big$cut <- as.character(big$cut)
big$color <- as.character(big$color)
big$clarity <- as.character(big$clarity)

### provide some random positions
big$x <- rnorm(nrow(big), 0, 10)
big$y <- rnorm(nrow(big), 0, 10)
coordinates(big) <- ~x+y
proj4string(big) <- CRS("+init=epsg:4326")

### view it
mapview(big)

3) added a spplot() method to produce a static version of the
interactive map. Note, this feature is in its infancy so only has very
limited flexibility at the moment.

4) added mapviewOptions(), similar to rasterOptions() to set and
retrieve options session-wide. This means you can now easily set your
favorite background maps or color schemes (among other things) permanently.

5) added a couple of convenience functions:

  • slideview() – to compare two images in a before-after fashion
    (similar to wxGUI Map Swipe in GRASS). See below for a static example.
  • plainview() – an image viewer to view Raster* objects without the
    map background. This means that you can view rather large rasters with arbitrary CRS without too much hassle as no re-projection is necessary.

6) added an alias function mapview() with a small “v” as typing was
quite confusing before. Now it's mapview with a small v all the way from
loading the package to viewing the data.

Unfortunately we have also BROKEN BACKWARD-COMPATIBILITY.
Due to the inclusion of lattice (levelplot) logic when dealing with
col.regions, we decided to make argument naming more similar to existing
spatial graphics standards. Therefore, some argument names have changed:

  • layer.opacity is now alpha.regions
  • weight is now cex for points and lwd for lines

We hope this does not cause too many inconveniences.

These are the major enhancement/changes of mapview in this release.

We have also updated the demo at

http://environmentalinformatics-marburg.github.io/web-presentations/20150723_mapView.html

As always, don't hesitate to contact us for questions, feedback and/or
suggestions.

Formal bug reports and feature requests should be filed at
https://github.com/environmentalinformatics-marburg/mapview/issues

Best,
Tim, Flo, Chris and Stefan

To leave a comment for the author, please follow the link and comment on their blog: metvurst.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.