Geo Data FBFs

The Geo data fields can be used to derive new fields and data from, by using the following Field Build Functions:

area

FunctionDescriptionSourcesOutputArguments
areaA directive for calculating the area of polygon.
The input should be a polygon in the format of a
GeoJson (json or WKT) or a TopoJson.
The returned area will be in square meter (m^2).
Set convert_to_km to true in order to get the result in square kilometer(km^2)
polygon
convert_to_km

{
  "area_of_polygon": {
    "type": "numeric",
    "function": "area",
    "source": "polygon"
  }
}
<EXAMPLE INPUT 1>
{
    "polygon": {
        "type": "Polygon",
        "coordinates": [[[-50,-90],[-50,90],[50,90],[-50,-90]]]
    }
}
<EXAMPLE INPUT 2>
{
    "polygon": "POLYGON ((-50 -90, -50 90, 50 90, 50 -90, -50 -90))"
}
<EXAMPLE OUTPUT >
{
    "area_of_polygon": 18000.0
}

distance

FunctionDescriptionSourcesOutputArguments
distanceA directive for calculating the distance between two points.
The input should be two given Geopoints.
The returned distance will be in meters (m).
Set convert_to_km to true in order to get the result in kilometers (km)
point1

point2
convert_to_km

{
    "distance_between_two_points": {
    "function": "distance",
    "sources": ["point1", "point2"],
    "type": "numeric"
    }
  }
<EXAMPLE INPUT>
{
    [{
        "point1": {"location" : "POINT (-71.34 41.12)" },
        "point2": {"location" : "POINT (52.406374 16.9251681)" }
    }]
}
<EXAMPLE OUTPUT>
{
    "distance_between_two_points": 11365307.89
}

geo_intersect

FunctionDescriptionSourcesOutputArguments
geo_intersectA directive for calculating the intersection of two given polygons.
The input should be GeoJson or TopoJson format or WKT (as a json or a json string)
and the output will be returned as WKT string.
polygon1

polygon2
{
  "intersection_of_polygons": {
    "function": "geo_intersect",
    "sources": ["poly1", "poly2"],
    "type": "string"
  }
}
<EXAMPLE INPUT>
{
    [{
      "poly1": {
        "type": "Polygon",
        "coordinates": [[
          [-180,-90],
          [-180,90],
          [180,90],
          [180,-90],
          [-180,-90]
        ]]
      },
      "poly2": {
        "type": "Polygon",
        "coordinates": [[
            [-122.801742, 45.48565],
            [-122.801742, 45.60491],
            [-122.584762, 45.60491],
            [-122.584762, 45.48565],
            [-122.801742, 45.48565]
        ]]
      }
    }]
}
<EXAMPLE OUTPUT>
{
    ""intersection_of_polygons": POLYGON ((
  			-122.801742 45.60491,
  			-122.584762 45.60491,
  			-122.584762 45.48565,
  			-122.801742 45.48565,
  			-122.801742 45.60491
    ))"
}