UPDATE: Our shape files now contain zones (0 to 5) and values from -1 to 1 in two new columns, this should make simplifying polygons easier.
In this article I am using QGIS (a free and open source software for manipulating geospatial data): http://www.qgis.org/
We currently provide the most verbose version of our VAR shapefiles to you. This means that for a 100 acre field, you could have thousands of polygons, each with a seemingly arbitrary value:
In this example, the file has 13060 polygons with seemingly random values. However, they can be classified into zones using the properties and style. To begin, right click on the layer and click "Properties". In the "Properties" window click on "Style" on the left hand side. Near the top you should see "Single Symbol" in a drop down menu, click it:
From this, select "Graduated". The display will repopulate, you'll want to select the column "DN" from the "Column" dropdown. Next, select a "Color Ramp" if you'd like, in this case, I selected the RdYlGn to have a Red->Yellow->Green ramp like the KMZ version of the VAR. Set the mode to "Quantile", this will match the output from our KMZs for the most part, however you can use any classification you'd like. Click "Classify", this is very important otherwise nothing will happen. Finally, click "Apply" to see it take effect, and if you're happy, click "OK":
You'll now be taken back to the map representation of your field. It'll show you the zones and their associated ranges, however if you want to simplify the polygons (since there are still thousands) you'll need to do a bit more work. Right click on the layer again and click "Open Attribute Table":
A new window will pop up with all the shapes and their associated values. Now you'll want to click the pencil at the top left of the window to begin editing the table. Next click the abacus/"Open Field Calculator" button:
Now you should be presented with the "Field Calculator" window. Make sure to check "Create new field" at the top. Input a name for your new field, in this case I used "zones". Finally, in the expression area you'll want to past and modify this code:
CASE
WHEN DN <= 2397 THEN 0
WHEN DN > 2397 AND DN <= 2510 THEN 1
WHEN DN > 2510 AND DN <= 2575 THEN 2
WHEN DN > 2575 AND DN <= 2638 THEN 3
WHEN DN > 2638 THEN 4
END
You may notice that these numbers match up with the styling we applied earlier. Here is an image illustrating all of the above:
You'll want to modify the code to match up to your ranges. When you click "OK", you'll be taken back to the attribute table and you'll see that your "zones" column now has the number associated with the expression. Next, click the pencil again at the top left to save your work.
If you just need the zones, you can stop here, otherwise we can go one step further and simplify the thousands of polygons into just 5 (matching our zones). To do that, click "Vector" from the top menu, "Geometry Tools", then "Singleparts to multipart". This will open a new window, you'll then want to select "zones" (the name of the field you created previously) for the "Unique ID field", and you can save the output to a file under the "Multipart" label by clicking the "Browse" or "..." button at the right:
Click "Run" and you'll then be presented with a 5 polygon version of your previous efforts that is uncolored. The attribute table will hold 5 rows, and zone 0 will map to the lowest vegetation and zone 4 will map to the higher vegetation (assuming you used the code above and modified accordingly). If you didn't select a file to save your new shapefile from the window above, you'll want to right click on the layer and click "Save as" to do so.
Comments
0 comments
Please sign in to leave a comment.