Register a polygon
The term "polygon" may be unfamiliar to you. This is a term used in the GeoJSON specification and represents the specific type of geometry that is used within the Vultus API. You might use different terminology such as "plot" or "field", or even "farm" to represent the same thing within your organization.
For the tutorial, we will use a polygon in southern Sweden, outside of Lund, near where Vultus is located.
[13.267485895061980, 55.66308798501626],
[13.283366709725641, 55.67968156822468],
[13.275276483396254, 55.68214803773702],
[13.263231035305807, 55.66396684416060],
[13.267485895061980, 55.66308798501626]
Polygon coordinates in GeoJSON are written as [longitude, latitude]
instead of the more familiar [latitude, longitude]
of a tool like Google Maps. This is becasue the GeoJSON format better represents an X,Y
coordinate system.
It is also important to "close" the polygon so the first and last set of coordinates must be identical.
You can use your own polygon coordinates for the tutorial. The geojson.io website is an excellent tool for drawing a polygon and generating coordinates in the correct format.
We will use the generatePolygon()
mutation to register our polygon.
mutation {
generatePolygon(
label: "Tutorial Polygon",
benefactor: "tutorial",
coordinates: [
[
[13.267485895061980, 55.66308798501626],
[13.283366709725641, 55.67968156822468],
[13.275276483396254, 55.68214803773702],
[13.263231035305807, 55.66396684416060],
[13.267485895061980, 55.66308798501626]
]
]
)
{
Message
Status
Result {
polygonId
acres
hectares
geometry
}
}
}
Copy and paste this mutation into the API Playground and press the RUN button. The API will return something like this.
{
"data": {
"generatePolygon": {
"Message": "Success",
"Status": 200,
"Result": {
"polygonId": "[AUTO-GENERATED POLYGON ID]",
"acres": "225.65",
"hectares": "91.32",
"geometry": "{\"type\":\"Polygon\",\"coordinates\":[[[13.26748589506198,55.66308798501626],[13.283366709725641,55.67968156822468],[13.275276483396254,55.68214803773702],[13.263231035305807,55.6639668441606],[13.26748589506198,55.66308798501626]]]}"
}
}
}
}
Now that the polygon is created, let's do something with it.