RObservations #40 : Packaging My Route Map Code! Introducting mapBliss. | R-bloggers

RObservations #40 : Packaging My Route Map Code! Introducting mapBliss. | R-bloggers

Around last year I started blogging about and how its possible to imitate their product in R with a some readily available packages and the MapBox API. Recently I managed to take some time and refine and organize the code I had to make the package I call .

I’m really happy with the package so far because it pretty much offers almost all the features for making the type of maps that you can find on and similar sites. In this blog I share some of the features available, basic usage and potential next steps for the development of the package.

The package allows users to to use their custom made MapBox templates and plot car, bike, walking and flight trips over them. It is also possible to get a city view without any trip plotted as well.

As of the time of this blog, there are are five functions. Four of them are used for plotting maps and one of them is used for rendering the maps created as .svg files.

I structured these functions so that they are pretty straight forward to use while allowing for some flexibility with styling. To get started with basic usage, all that’s needed is for you to supply the relevant locations for the plot functions and a file name for when you want to save your visuals with .

Since I wrote about in previous blogs for how to plot routes and flight paths and the usage for those functions have not changed significantly, I will not write about them here. The function is also pretty straight forward, so for a use case example I’ll use what I think is the most novel function – .

Suppose you are interested in plotting a flight from Nashville TN, to Seattle, followed by a road trip down to the San Diego ending with a return flight to Nashville. The code to do this is:

This is pretty good. But the default templating doesn’t look the greatest. With a custom MapBox template you can make it look alot better! To learn how to make your own custom MapBox template check out this video here:

With this as well as playing around with some of the default arguments in we can get quite a nice looking map:

Now that we have a beautiful map, if we want to save the visual as an .svg file for printing of all size we can use the function. Take your saved image to your favorite online printer and enjoy art that would’ve costed you up to $250.00 USD + shipping for a fraction of price.

Taking this to Canva and playing around with some templating I was able to design this poster with minimal effort.

And the cost to order this as a poster is much cheaper.

It goes without saying that was built with many of the pre-existing packages on CRAN. They are (to date):

Thank you to all the authors and maintainers of these packages whom made it possible for this package to come into existence.

This package is pretty good for making artistic maps, but there are some features which are presently lacking that I would be nice to have:

One of the wonderful things about putting this package in the open is enabling other R users to create their own beautiful maps of their journeys. With the MapBox API, number of possible templates and designs are endless. I have only made a few (which can be viewed on Github). If you do use this package and make a map. Please post in the comments of this blog the link to the visual you made!

in its present form is pretty much ready for submission to CRAN. I haven’t done it yet because its presently not a priority. For now, I am really happy with the progress I have made with this package and am happy with the form it is in now.

If you have any other ideas of what you would possibly want, feel free to open a Github issue on the repository and let me know!

Let me know what you think of the package! Thank you for reading!

Images Powered by Shutterstock