wktview | R Documentation |
Visualize geojson from a character string or list
wktview(x, center = NULL, zoom = 5, fmt = 16)
x |
Input, a geojson character string or list |
center |
(numeric) A length two vector of the form:
|
zoom |
(integer) A number between 1 and 18 (1 zoomed out, 18 zoomed in) |
fmt |
Format string which indicates the number of digits to display after the decimal point when formatting coordinates. Max: 20 |
Opens a map with the geojson object(s) using leaflet
as_featurecollection()
## Not run:
# point
str <- "POINT (-116.4000000000000057 45.2000000000000028)"
wktview(str)
# multipoint
df <- us_cities[1:5,c('long','lat')]
str <- multipoint(df)
wktview(str, center = c(-100,40))
wktview(str, center = c(-100,40), zoom = 3)
# linestring
wktview(linestring(c(100.000, 0.000), c(101.000, 1.000), fmt=2),
center = c(100, 0))
# polygon
a <- polygon(list(c(100.001, 0.001), c(101.12345, 0.001), c(101.001, 1.001),
c(100.001, 0.001)))
wktview(a, center = c(100, 0))
wktview(a, center = c(100.5, 0), zoom=9)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.