I am trying to visualize a large sf dataframe with around 1000 rows containing linestrings with mapview::mapview() in R. Unfortunately a warning comes up when I perform the command:


Warning message:
In leaflet_sfc(sf::st_geometry(x), map = map, zcol = zcol, color = clrs,  :
  the supplied feature layer has more points/vertices than the set threshold.
  using special rendering function, hence things may not behave as expected from a standard leaflet map,
  e.g. you will likely need to zoom in to popup-query features

  to see the number of points/vertices of the layer use 'npts(x)'
  to see the threshold for the feature type use 'mapview:::getMaxFeatures(x)'
  to adjust the threshold use argument 'maxpoints'

And then I try to export as html and I get:

R code execution error

And the saved file is 0 kb.

Is there a fix or a workaround with some other function from the package?

1 Answer 1


I fixed the error by adding maxpoints argument:

mapview::mapview(data.frame, maxpoints = 1000000)

Seems this increased the previously set threshold for plotting maximum number of features.

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.