# NOT RUN {
# skipping on cran
poly1 <- '{
"type": "Feature",
"properties": {
"fill": "#0f0"
},
"geometry": {
"type": "Polygon",
"coordinates": [[
[-46.738586, -23.596711],
[-46.738586, -23.458207],
[-46.560058, -23.458207],
[-46.560058, -23.596711],
[-46.738586, -23.596711]
]]
}
}'
poly2 <- '{
"type": "Feature",
"properties": {
"fill": "#00f"
},
"geometry": {
"type": "Polygon",
"coordinates": [[
[-46.650009, -23.631314],
[-46.650009, -23.5237],
[-46.509246, -23.5237],
[-46.509246, -23.631314],
[-46.650009, -23.631314]
]]
}
}'
lawn_difference(poly1, poly2)
# }
# NOT RUN {
lawn_featurecollection(list(poly1, poly2)) %>% view
lawn_difference(poly1, poly2) %>% view
fc <- lawn_featurecollection(list(
lawn_polygon(jsonlite::fromJSON(poly1)$geometry$coordinates),
lawn_polygon(jsonlite::fromJSON(poly2)$geometry$coordinates)
))
view(fc)
# }
Run the code above in your browser using DataLab