Field Boundary Automation

Hi everyone - I am wondering if it would be helpful to have farmOS users have the ability to use free and open source services from The Linux Foundaiton’s AgStack project. e.g., one such service (in alpha) is an “asset registry” project where a user can get the boundary of their field (provided it is pre-registered), by simply clicking on a map (lat-lon input) and getting a poly_wkt (boundary string of lat-lon pairs in geojson). This will enable users to “share” field boundaries in a secure and easy way.

In addition, each field boundary comes with its own unique geo-id key which also can be used to get other geospatial services like weather (past and forecast) and soil info.

What does everyone think?

3 Likes

That sounds very useful @sumerjohal! Is there a working example or demo of this?

Perhaps relevant here: Existing tools for drawing geometries in bulk? - #3 by paul121

1 Like

Yes. There is an ALPHA install running. Needs lots of new APIs, but you can register your field like:

http://143.198.58.1:5000/registerField?format=html&wkt=POLYGON+((73.68698420863304+20.0106567268068%2C+73.68780600712554+20.01053805752598%2C+73.68793928031467+20.01080257197401%2C+73.68765075073819+20.01118695923357%2C+73.68715341216802+20.01129991173918%2C+73.68698420863304+20.0106567268068))

and see the json of the registry with:
http://143.198.58.1:5000/registerField?format=json&wkt=POLYGON+((73.68698420863304+20.0106567268068%2C+73.68780600712554+20.01053805752598%2C+73.68793928031467+20.01080257197401%2C+73.68765075073819+20.01118695923357%2C+73.68715341216802+20.01129991173918%2C+73.68698420863304+20.0106567268068))

replace the field boundary with your own

1 Like

Hi @sumerjohal - welcome to the farmOS forum!

I love this idea! I imagine it would be pretty easy to implement in a “farmOS AgStack” module, which could provide some UI features that integrate with AgStack APIs. This field boundary / asset registry integration feels like a great first step / MVP!

a user can get the boundary of their field (provided it is pre-registered), by simply clicking on a map (lat-lon input) and getting a poly_wkt (boundary string of lat-lon pairs in geojson)

That could be pretty easy!

farmOS usually represents these boundaries as “Land assets”, and it provides a few different methods of entering these boundaries already (including drawing them individually in a map, individual KML import, bulk KML import, @Symbioquine’s WFS module, etc). I love the idea of simply clicking a point on a map and pulling a known geometry from AgStack.

I imagine a simple “AgStack Asset Import” form (or something to that effect) with a map that asks for a GPS point. On submit, it would send the coordinate to the AgStack API, get the polygon geometry in return, and provide options for saving that as a new Land Asset in farmOS.

I also wonder: would it ever be useful to go in the other direction? Would the AgStack API accept “pushes” of new boundaries as well? Or do you think it would be unidirectional?

2 Likes

Forgot to link to the module: GitHub - symbioquine/farmOS_wfs: WFS module for farmOS

(And of course @Symbioquine’s land drawing tool is also worth mentioning: GitHub - symbioquine/farmOS_land_drawing_tool: A land drawing tool module for farmOS - adds a tool for more quickly creating land assets. - check out the GIF in the link @paul121 shared above…)

Yes and eys.
The API allows for botha push and pull. That is what I sent in the email to Paul also.

Here is the code to push (change the coordinate list to your own coordinates)

poly_coords_list = [[-119.9430984648081, 36.75327891019119],
[-119.9431487248413, 36.74985270619865],
[-119.9414901561806, 36.74986390689096],
[-119.9414797608043, 36.75043835959973],
[-119.9409662752797, 36.75044048517574],
[-119.9409622444647, 36.74987248109456],
[-119.9387565705818, 36.74989053456138],
[-119.9387183323567, 36.75332074147946],
[-119.9430984648081, 36.75327891019119]]
poly_wkt = shapely.geometry.Polygon(poly_coords_list).wkt
urlStr = ‘http://143.198.58.1:5000/registerField
payload = {
‘wkt’: poly_wkt,
‘soilinfo’: True,
}
payload = {
‘format’: formatType,
‘wkt’: poly_wkt,
}#URL TO CUT AND PAST TO VISUALIZE THE FIELDS

2 Likes