Mapping farm importing kml file, type of areas

Hi,

I am starting now to get familiarized with FarmOs. I am mapping my farm now importing some KML files I created in Qgis from a DWG file, and I got a little confused:

1 - I see that the area is only displayed in the metrics if I I import my polygon as an field area type. This does not happened with plantation, for example. Ok, this is documented in the docs. But if I do want to have my plantation area displayed, should I import it twice, first as plantation, then as field?

2 - I noticed some kml files (with Linestring objects) are imported as a closed line, but in this case no area is calculated, only the perimeter. If I convert it to Solid Polygon in Qgis, than I get the opposite, the area is displayed in the map, but not the perimiter lenght. I ended up adding 2 field objects so I see both perimeter and area displayed.

So I ended with 4 objects imported. Two fields (one for area, other for perimeter) and two plantations (cause I was not sure which one I wanted, perimeter or area), what is for obvious reasons wrong…

What should I do?

2 Likes

Hi @rafaeltcc welcome to the farmOS community! :smiley:

1 - I see that the area is only displayed in the metrics if I I import my polygon as an field area type. This does not happened with plantation, for example. Ok, this is documented in the docs. But if I do want to have my plantation area displayed, should I import it twice, first as plantation, then as field?

I assume you are referring to the “Plantation” area type that is provided by the Forest Management module? https://github.com/farmOS/farm_forest

If so, those should show up on your map just like Field types. They all work the same, in that regard. Are you sure you have the “Area Type” field set to “Plantation”? Areas are only displayed on the map if their “Area Type” is set.

2 - I noticed some kml files (with Linestring objects) are imported as a closed line, but in this case no area is calculated, only the perimeter. If I convert it to Solid Polygon in Qgis, than I get the opposite, the area is displayed in the map, but not the perimiter lenght. I ended up adding 2 field objects so I see both perimeter and area displayed.

That’s correct - farmOS will only show one or the other, depending on what type of geometry it is. Polygons show area, LineStrings show perimeter. I could see it being useful to have the perimeter alongside the area for Polygons. Would you like to open a feature request for that? https://github.com/farmOS/farmOS/issues

I can point you to the code that is currently generating those measurements, if you would like to try implementing it and contributing back a patch or pull request.

Hi @mstenta,

Plantations do show in my map. But in the metrics widget I can’t see the total area summed for this. Only Field and Paddocks show.

Also, I have created the issue and I am willing to help.

1 Like

Ah you’re right! This is a separate bug, but I think easy to fix.

Basically, when I added the “Metrics”, I figured we wouldn’t want to include ALL area types… just the “big” ones (Fields, Paddocks, Beds), and they would need to be separated out so you didn’t have confusion around “Total field area and total bed area combined even though they are child areas of the field”. So that’s why they are split out by type, and only some types are included (eg: not including “Building” area or “Landmark” area).

To enable the calculated area to show up as a metric, you need to add 'dashboard_metric' => TRUE, to the area type definition. For example, here is the “Field” area type definition: https://github.com/farmOS/farmOS/blob/e40270ea48400e02b3dcf4454a1b5b35209414af/modules/farm/farm_area/farm_area_types/farm_area_types.farm_area.inc#L18

So, I think we just need to add the same to this file in the forest module: https://github.com/farmOS/farm_forest/blob/7.x-1.x/farm_forest.farm_area.inc

Would you like to give that a try, and if it works open a pull request?

Hi,

I have commited the modified file enabling the metrics for both plantation and natural stand as they fall in the category big areas.

Hope everything went well with my first commit in this project!

Rafael

2 Likes

@rafaeltcc Great! Are you familiar with the process for contributing changes like this back to the project? It sounds like you created the commit in your local repository, so the next step would be to push that to a fork on Github and open a Pull Request so it can be reviewed/included in the main project. If you’d like some help with this process I’d be happy to in chat! https://app.element.io/#/room/#farmOS:matrix.org