3

I'm looking to integrate some awesome mapview interactive maps in a Jupyter Notebook with the IRkernel.

I would like to know if:

  • Is it possible? How can I achieve that?
  • Is there any workaround using Jupyter Notebook with IPython kernel using cell magics %%?

In a Jupyter Notebook cell, I tried:

# Load shapefile
shapefile <- sf::read_sf('../path/to/shapefile.shp')

# Plot mapview map
mapview::mapview(shapefile)

No luck, and no error message showed!

1

You can use:

  • the R package IRkernel and you are working in R

enter image description here

enter image description here

New

It works without problem (library(maptools))

enter image description here

with the result in another tab

enter image description here

3
  • Thanks for your help and effort but unfortunately, I couldn't run a mapview map using your trick. I tried loading the rpy2.ipython extension but It didn't work. I don't know If I'm missing something. Did you try using mapview?
    – Guzmán
    Jun 8 '17 at 3:21
  • It works without problem, look above in New
    – gene
    Jun 8 '17 at 15:05
  • thanks! Some problem don't let mapview work correctly: Warning in R_ut_init: Error parsing unit specification. Anyway, the question is answered.
    – Guzmán
    Jun 8 '17 at 15:14

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.