Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

wktview

Visualize geojson from a character string or list


Description

Visualize geojson from a character string or list

Usage

wktview(x, center = NULL, zoom = 5, fmt = 16)

Arguments

x

Input, a geojson character string or list

center

(numeric) A length two vector of the form: longitude, latitude

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

Value

Opens a map with the geojson object(s) using leaflet

See Also

Examples

## 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)

wellknown

Convert Between 'WKT' and 'GeoJSON'

v0.7.2
MIT + file LICENSE
Authors
Scott Chamberlain [aut, cre] (<https://orcid.org/0000-0003-1444-9135>), Os Keyes [aut] (author of code in src/)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.