geoshape: geoshape dsl

View source: R/geoshape.R

geoshapeR Documentation

geoshape dsl

Description

geoshape dsl

Usage

geoshape(.obj = list(), ..., field = NULL)

geoshape_(.obj = list(), ..., .dots, field = NULL)

Arguments

.obj

An index object. If nothing passed defaults to all indices, equivalent to doing e.g., localhost:9200/_search

...

Further args passed on

field

Explanation...

.dots

Explanation...

Examples

## Not run: 
elastic::connect(errors = "complete")

## point
index("geoshape") %>%
   geoshape(field = "location", type = "envelope", coordinates = list(c(-30, 50), c(30, 0))) %>%
   n()

## circle and radius
index("geoshape") %>%
   geoshape(field = "location", type = "circle", radius = "2000km",
            coordinates = c(-10, 45)) %>%
   n()

index("geoshape") %>%
   geoshape(field = "location", type = "circle", radius = "5000km",
            coordinates = c(-10, 45)) %>%
   n()

## polygon
coords <- list(c(80.0, -20.0), c(-80.0, -20.0), c(-80.0, 60.0), c(40.0, 60.0), c(80.0, -20.0))
index("geoshape") %>%
   geoshape(field = "location", type = "polygon", coordinates = coords) %>%
   n()

## End(Not run)

ropensci/elasticdsl documentation built on May 18, 2022, 9:53 a.m.