mapshaper: Mapshaper in R

Description Usage Arguments Examples

Description

Use mapshaper within R to analyze and simplify your spatial objects.

Usage

1
mapshaper(..., width = "100%", height = "100%")

Arguments

...

One or many input lists, data.frame, or spatial class. If input is not json, then automatic conversion will be attempted with geojson_json.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
library('geojsonio')
library('sp')
library('mapshaperWidget')

###  straight from geojson
alabama <- paste0(
  readLines(
    "https://raw.githubusercontent.com/glynnbird/usstatesgeojson/master/alabama.geojson"
  )
  ,collapse = " "
)
mapshaper(alabama)

###  example from geojsonio vignette
poly1 <- Polygons(
  list(
    Polygon(cbind(c(-100,-90,-85,-100), c(40,50,45,40)))
  )
  , "1"
)
poly2 <- Polygons(
  list(
    Polygon(cbind(c(-90,-80,-75,-90),c(30,40,35,30)))
  )
  , "2"
)
sp_poly <- SpatialPolygons(list(poly1, poly2), 1:2)

mapshaper( sp_poly )


### how to provide multiple spatial to mapshaper
calif <- geojson_read(
  system.file("examples", "california.geojson", package = "geojsonio")
)
mapshaper( sp_poly, calif )

timelyportfolio/mapshaper_htmlwidget documentation built on May 31, 2019, 1:51 p.m.