Share the Gallery !Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone

 

 

 

If you did not find the geographic information you need in the first propositions of the map section of the gallery, you need to find this information somewhere else, on the web.

 

The GeoJSON format is a popular format where all the informations are stored in one single file. You can easily read this kind of file with R. It will give you a spatial polygon data frame object. This kind object has several characteristics that make it super handy to work with.

 

So let’s start by reading a geoJSON file found on the web, giving the boundaries of every French communes.

 

 

 

 

Note that once you have a spatial object, there are a lot of manipulation you can do with it.  Here a a few manipulation that are often useful. At the end I select only a subset of the data for further plotting:

 

There are several ways to plot this spatial object. Here are 2 examples using the plot function and the ggplot2 library. Check the explanation of the map section of the gallery to go further!

 

 

Related


 

 


Leave a Reply

Be the First to Comment!

Notify of
avatar
wpDiscuz