Skip to content
Aanish Amir Waseem edited this page Jan 24, 2023 · 6 revisions

APIs

Register Field Boundary POST PRIVATE

url: <baseUrl>/register-field-boundary

Register a field boundary (polygon) against a Geo Id

  • Headers:

Content-Type > application/json

  • Request:

JSON body

{
    "wkt": "POLYGON((74.37392830848694 31.477080541856836,74.3768572807312 31.478022995170008,74.37714695930481 31.47740079404731,74.37631011009216 31.477016491287213,74.37425017356873 31.47641258376136,74.37392830848694 31.477080541856836))",
    "s2_index": "8,13,15,18,19,20"
}

Polygon is defined using a Well Known Text (wkt) string

s2_index defines which S2 index cell tokens to be returned in the response

  • Response:
{
	"GEO ID": "25686161443f925abc76093b143b4806352fdf9b4181e4d26f149b9319ebe982",
	"Message": "Field Boundary registered successfully.",
	"S2 Cell Tokens": "{\"8\": [\"39191\"], \"13\": [\"391905e4\"], \"15\": [\"391905e3c\"], \"18\": [\"391905e385\", \"391905e38f\", \"391905e391\", \"391905e397\", \"391905e399\", \"391905e39b\"], \"19\": [\"391905e384c\", \"391905e3854\", \"391905e38e4\", \"391905e38fc\", \"391905e3904\", \"391905e390c\", \"391905e3914\", \"391905e391c\", \"391905e3964\", \"391905e396c\", \"391905e3974\", \"391905e397c\", \"391905e3984\", \"391905e398c\", \"391905e3994\", \"391905e399c\", \"391905e39a4\", \"391905e39ac\", \"391905e39b4\", \"391905e39bc\"], \"20\": [\"391905e384d\", \"391905e384f\", \"391905e3851\", \"391905e3853\", \"391905e3855\", \"391905e3857\", \"391905e38e1\", \"391905e38e3\", \"391905e38e5\", \"391905e38e7\", \"391905e38f9\", \"391905e38fb\", \"391905e38fd\", \"391905e38ff\", \"391905e3901\", \"391905e3903\", \"391905e3905\", \"391905e3907\", \"391905e3909\", \"391905e390b\", \"391905e390d\", \"391905e390f\", \"391905e3911\", \"391905e3913\", \"391905e3915\", \"391905e3917\", \"391905e3919\", \"391905e391b\", \"391905e391d\", \"391905e391f\", \"391905e3965\", \"391905e3967\", \"391905e3969\", \"391905e396b\", \"391905e396d\", \"391905e396f\", \"391905e3971\", \"391905e3973\", \"391905e3975\", \"391905e3977\", \"391905e3979\", \"391905e397b\", \"391905e397d\", \"391905e397f\", \"391905e3981\", \"391905e3983\", \"391905e3985\", \"391905e3987\", \"391905e3989\", \"391905e398f\", \"391905e3991\", \"391905e3997\", \"391905e3999\", \"391905e399b\", \"391905e399d\", \"391905e399f\", \"391905e39a1\", \"391905e39a3\", \"391905e39a5\", \"391905e39a7\", \"391905e39a9\", \"391905e39ab\", \"391905e39ad\", \"391905e39af\", \"391905e39b1\", \"391905e39b3\", \"391905e39bb\", \"391905e39bd\"]}"
}

Tokens: JSON string, with key as S2 resolution level and values are the S2 cell tokens.


S2 Resolution Level / S2 Cell Tokens


Fetch Overlapping Fields POST Private

url: <baseUrl>/fetch-overlapping-fields

Fetch the overlapping fields for a certain threshold, returning the field’s geo json.

  • Headers:

Content-Type > application/json

  • Request:

JSON body

{
	"wkt": "POLYGON ((74.35855950604382 31.479723509875665,74.36619843731823 31.473830840390207,74.37044705639782 31.47968691058925,74.35855950604382 31.479723509875665))",
	"resolution_level": 13,
	"threshold": 90,
        "domain": "test.com"
}

Polygon is defined using a Well Known Text (wkt) string

domain is an optional string, filter fields by a specific domain

  • Response:
{
	"GEO Ids": [ "da2504ff0e16a77ad5d86d0c4bd6f21fcd33c69ce78cb6c03d0245ab719c22b5"],
	"Message": "The field Geo Ids with percentage match of the given threshold."
}

Fetch a Field GET PUBLIC

url: <baseUrl>//fetch-field/<geo_id>?s2_index=8,13,15,18,19,20

Received in query param a geo_id, fetch the relevant geo JSON

  • Headers:

none

s2_index defines which S2 index cell tokens to be returned in the response

  • Response:
{
	"GEO ID": "25686161443f925abc76093b143b4806352fdf9b4181e4d26f149b9319ebe982",
	"Message": "Field Boundary registered successfully.",
	"S2 Cell Tokens": "{\"8\": [\"39191\"], \"13\": [\"391905e4\"], \"15\": [\"391905e3c\"], \"18\": [\"391905e385\", \"391905e38f\", \"391905e391\", \"391905e397\", \"391905e399\", \"391905e39b\"], \"19\": [\"391905e384c\", \"391905e3854\", \"391905e38e4\", \"391905e38fc\", \"391905e3904\", \"391905e390c\", \"391905e3914\", \"391905e391c\", \"391905e3964\", \"391905e396c\", \"391905e3974\", \"391905e397c\", \"391905e3984\", \"391905e398c\", \"391905e3994\", \"391905e399c\", \"391905e39a4\", \"391905e39ac\", \"391905e39b4\", \"391905e39bc\"], \"20\": [\"391905e384d\", \"391905e384f\", \"391905e3851\", \"391905e3853\", \"391905e3855\", \"391905e3857\", \"391905e38e1\", \"391905e38e3\", \"391905e38e5\", \"391905e38e7\", \"391905e38f9\", \"391905e38fb\", \"391905e38fd\", \"391905e38ff\", \"391905e3901\", \"391905e3903\", \"391905e3905\", \"391905e3907\", \"391905e3909\", \"391905e390b\", \"391905e390d\", \"391905e390f\", \"391905e3911\", \"391905e3913\", \"391905e3915\", \"391905e3917\", \"391905e3919\", \"391905e391b\", \"391905e391d\", \"391905e391f\", \"391905e3965\", \"391905e3967\", \"391905e3969\", \"391905e396b\", \"391905e396d\", \"391905e396f\", \"391905e3971\", \"391905e3973\", \"391905e3975\", \"391905e3977\", \"391905e3979\", \"391905e397b\", \"391905e397d\", \"391905e397f\", \"391905e3981\", \"391905e3983\", \"391905e3985\", \"391905e3987\", \"391905e3989\", \"391905e398f\", \"391905e3991\", \"391905e3997\", \"391905e3999\", \"391905e399b\", \"391905e399d\", \"391905e399f\", \"391905e39a1\", \"391905e39a3\", \"391905e39a5\", \"391905e39a7\", \"391905e39a9\", \"391905e39ab\", \"391905e39ad\", \"391905e39af\", \"391905e39b1\", \"391905e39b3\", \"391905e39bb\", \"391905e39bd\"]}"
}

Get percentage overlap of two Fields POST PUBLIC

url: <baseUrl>/get-percentage-overlap-two-fields

Passed in 2 Geo Ids, determine what is the percentage overlap of the two fields

  • Headers:

Content-Type > application/json

  • Request:

JSON body

{
	"geo_id_field_1": "7af4d1ddb9fb20e5cfe4544afab435c74e82a76024c1b8abaf9dd33163fc984b",
	"geo_id_field_2": "7b02942a48b934ed20854e9e4339be84c241c0b2770739b65c334649921a48ca"
}

Polygon is defined using a Well Known Text (wkt) string

  • Response:
{
	"Percentage Overlap": "4.943656852053799 %"
}

Fetch fields for a Point POST PRIVATE

url: <baseUrl>/fetch-fields-for-a-point

Fetch all the fields containing the point Latitude and Longitude provided Check for Resolution level 13 and 20 Two stage search

  • Headers:

Content-Type > application/json

  • Request:

JSON body

{
	"latitude": 31.47704430446457,
	"longitude": 74.37510786779589,
        "s2_index": "8,13,15,18,19,20",
        "domain": "test.com"
}

Polygon is defined using a Well Known Text (wkt) string

domain is an optional string, filter fields by a specific domain

s2_index defines which S2 index cell tokens to be returned in the response

  • Response:
{
	"Fetched fields": [
		{
			"37d63ebdd421fb7fcb966002ea78ad1df2d4a555105eb31fe12ac7fa6f329930": {
                                "8": [ "39191" ],
				"13": [ "391905d4", "391905dc", "391905e4", "3919060c", "39190674", "3919067c" ],
				"15": [ "391905d74", "391905d7c", "391905d84", "391905d8c", ... ],
                                "18": [...],
                                "19": [...],
                                "20": [...],
                             
			}
		},
		{
			"37d63ebdd421fb7fcb966002ea78ad1df2d4a555105eb31fe12ac7fa6f329930": {
                                "8": [ "39191" ],
				"13": [ "391905d4", "391905dc", "391905e4", "3919060c", "39190674", "3919067c" ],
				"15": [ "391905d74", "391905d7c", "391905d84", "391905d8c", ... ],
                                "18": [...],
                                "19": [...],
                                "20": [...],
                             
			},
		}
	]
}

Fetch Bounding Box Fields POST PRIVATE

url: <baseUrl>/fetch-bounding-box-fields

Fetch the fields intersecting the Bounding Box 4 vertices are provided

  • Headers:

Content-Type > application/json

  • Request:

JSON body

{
	"latitudes": "31.477779423633137 31.478602920901388 31.474320655972566 31.47543699178076",
	"longitudes": "74.3729835582561 74.38032208212084 74.37404571302599 74.38112674482531",
        "s2_index": "8,13,15,18,19,20"
}

s2_index defines which S2 index cell tokens to be returned in the response

  • Response:
{
	"Fetched fields": [
		{
			"37d63ebdd421fb7fcb966002ea78ad1df2d4a555105eb31fe12ac7fa6f329930": {
                                "8": [ "39191" ],
				"13": [ "391905d4", "391905dc", "391905e4", "3919060c", "39190674", "3919067c" ],
				"15": [ "391905d74", "391905d7c", "391905d84", "391905d8c", ... ],
                                "18": [...],
                                "19": [...],
                                "20": [...],
                             
			}
		},
		{
			"37d63ebdd421fb7fcb966002ea78ad1df2d4a555105eb31fe12ac7fa6f329930": {
                                "8": [ "39191" ],
				"13": [ "391905d4", "391905dc", "391905e4", "3919060c", "39190674", "3919067c" ],
				"15": [ "391905d74", "391905d7c", "391905d84", "391905d8c", ... ],
                                "18": [...],
                                "19": [...],
                                "20": [...],
                             
			},
		}
	]
}

Clone this wiki locally