Skip to main content

Circle

Enrich Elastic Compatible

Synopsis

Converts circle shape definitions to approximate polygons.

Schema

circle:
error_distance: <numeric>
field: <ident>
shape_type: <shape>
description: <text>
if: <script>
ignore_failure: <boolean>
ignore_missing: <boolean>
on_failure: <processor[]>
on_success: <processor[]>
tag: <string>
target_field: <ident>

Configuration

FieldRequiredDefaultDescription
error_distanceYThe difference between the polygon's center to the sides and the circle's radius. This is measured in meters with geo_shape, but unitless for shape
fieldYField containing the circle to be converted. A WKT string or a GeoJSON map
shape_typeYField mapping type to use for conversion: geo_shape or shape
descriptionN-Explanatory text
ifN-Condition to run
ignore_failureNfalseSee Handling Failures
ignore_missingN
on_failureN-See Handling Failures
on_successN-See Handling Success
tagN-Identifier
target_fieldN-Field to assign the converted shape to. If omitted, the circle is converted in place

Details

The radius can be specified in the following units: cm ft in km m (default) mi mm nmi yd

The processor automatically calculates the optimal number of points to use when approximating the circle as a polygon based on the radius and error_distance parameters. The number of points is capped at 1000 for performance.

attention

Circles containing poles cannot be converted.

Examples

Custom

Center coordinates and radius...

{
"vmetric": {
"center": "40.7128,-74.0060",
"radius": "40m"
}
}
circle:
field: vmetric
error_distance: 28.0
shape_type: geo_shape
target_field: geo_shape.vmetric

are converted to a polygon:

{
"geo_shape": {
"vmetric": {
"type": "Polygon",
"coordinates": [[[
[-74.00564067388635, 40.7128],
[-74.00588896212435, 40.71314404260343],
[-74.00629070093247, 40.7130126300225],
[-74.00629070093247, 40.712587369977506],
[-74.00588896212435, 40.71245595739657],
[-74.00564067388635, 40.7128]
]]]
}
}
}

WKT

WKT circle definition...

{
"circle": "CIRCLE (30 10 40)"
}
circle:
field: circle
error_distance: 28.0
shape_type: geo_shape
target_field: polygon

is converted to a GeoJSON polygon:

{
"polygon": {
"type": "Polygon",
"coordinates": [[[
[30.00035932611365, 10.0],
[30.00011103787564, 10.000344042603427],
[29.999709299067536, 10.000212630022496],
[29.999709299067536, 9.999787369977504],
[30.00011103787564, 9.999655957396573],
[30.00035932611365, 10.0]
]]]
}
}

GeoJSON

GeoJSON circle definition...

{
"circle": {
"type": "circle",
"radius": "40m",
"coordinates": [30.0, 10.0]
}
}
circle:
field: circle
error_distance: 28.0
shape_type: geo_shape
target_field: polygon

is converted to a GeoJSON polygon:

{
"polygon": {
"type": "Polygon",
"coordinates": [[[
[30.00035932611365, 10],
[30.00011103787564, 10.000344042603427],
[29.999709299067536, 10.000212630022496],
[29.999709299067536, 9.999787369977504],
[30.00011103787564, 9.999655957396573],
[30.00035932611365, 10]
]]]
}
}

Different Units

Kilometers for large circles...

{
"vmetric": {
"center": "40.7128,-74.0060",
"radius": "40km"
}
}
circle:
field: vmetric
error_distance: 28000.0
shape_type: geo_shape
target_field: geo_shape.vmetric

are converted to a large polygon:

{
"geo_shape": {
"vmetric": {
"type": "Polygon",
"coordinates": [[[
[-73.64667388635219, 40.7128],
[-73.89496212436013, 41.05684260342746],
[-74.29670093246378, 40.92543002249617],
[-74.29670093246378, 40.50016997750383],
[-73.89496212436013, 40.36875739657254],
[-73.64667388635219, 40.7128]
]]]
}
}
}