view: Visualize geojson

Description Usage Arguments Details Value Examples

View source: R/view.R

Description

Visualize geojson

Usage

1
2
3

Arguments

x

Input, a geojson character string or list.

...

Any geojson object, as list, json, or point, polygon, etc. class.

Details

view_ is a special interface to view to accept arbitrary input via ....

Value

Opens a map with the geojson object(s).

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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
## Not run: 
# from character string
view(lawn_data$polygons_average)
view(lawn_data$filter_features)
view(lawn_data$polygons_within)
view(lawn_data$polygons_count)

# from json (a jsonlite class)
library(jsonlite)
x <- minify(lawn_data$points_count)
class(x)
view(x)

# from a list (a single object)
library("jsonlite")
x <- fromJSON(lawn_data$polygons_average, FALSE)
view(x)

# From a list of many objects
x <- list(
 lawn_point(c(-75.343, 39.984), properties = list(name = 'Location A')),
 lawn_point(c(-75.833, 39.284), properties = list(name = 'Location B')),
 lawn_point(c(-75.534, 39.123), properties = list(name = 'Location C'))
)
view(x)

# Use view_ to pass in arbitrary objects that will be combined
view_(
 lawn_point(c(-75.343, 39.984), properties = list(name = 'Location A')),
 lawn_point(c(-75.833, 39.284), properties = list(name = 'Location B')),
 lawn_point(c(-75.534, 39.123), properties = list(name = 'Location C'))
)

## another eg, smile :)
l1 <- list(
   c(-69.9609375, 35.460669951495305),
   c(-78.75, 39.095962936305504),
   c(-87.1875, 39.36827914916011),
   c(-92.46093749999999, 36.03133177633189)
)
l2 <- list(
   c(-46.0546875, 8.7547947),
   c(-33.0468750, -0.7031074),
   c(-14.0625000, 0.0000000),
   c(-0.3515625,  9.4490618)
)
l3 <- list(
   c(-1.40625, 38.81152),
   c(14.76562, 45.33670),
   c(23.20312, 45.58329),
   c(33.04688, 39.63954)
)
view_(lawn_point(c(-30, 20)),
   lawn_linestring(l1),
   lawn_linestring(l2),
   lawn_linestring(l3)
)

# From a geo_list object from geojsonio package
# library("geojsonio")
# vecs <- list(c(100.0,0.0), c(101.0,0.0), c(101.0,1.0),
#  c(100.0,1.0), c(100.0,0.0))
# x <- geojson_list(vecs, geometry="polygon")
# view_(x)
# view_(x, lawn_point(c(101, 0)))

## End(Not run)

lawn documentation built on Jan. 6, 2021, 5:07 p.m.