1

example of table[1]

I'm running into problems while trying to edit some data.

I'm trying to merge a number of land-use categories into less categories. So for example I have 5 types of "forest" which I want to merge into just one attribute.

All of this is in a single layer and thus in a single attribute table.

After I have my desired categories, I want to use another layer with the same categories to compare the difference over time.

Yet I can't figure out how to effectively combine the categories. Selecting by attribute and creating a new layer with that selection works, but it leaves me with a number of layers which still have different categories for the attributes when I only want one. For example, the layer "Forest" still has the separate polygons for different kinds of forests in the attribute table. I just want one big polygon for each category.

The image is an example of one of the layers, which is just arable land. I want to combine all of the polygons into one big one.

I also tried dissolving the separate layers I created by selecting by attribute, but on some layers it gives me the error:

Invalid Topology [incomplete void poly.]

  • If this was a geodatabase you could find the invalid polygon by looking for values of 0 in the area or length fields. Run the Check Geometry tool on the layers that give you an error. – Richard Fairhurst Apr 5 '18 at 20:29
  • Thanks for the suggestion! I did that, and found about 30 objects which have "self intersections". I'm not sure if that's a big issue or not. Repair Geometry seems to have fixed it. – Daniel Apr 6 '18 at 8:48
1

Use the dissolve tool on your "Type" category. This will dissolve all polygons with like attributes into larger polygons

  • That doesn't work, because I want one category for different 'types'. So I want grassland, hay land, fallow to be combined into one category "grassland". – Daniel Apr 5 '18 at 18:28
  • There is a difference between 'don't understand' and doesn't work. This is correct solution – FelixIP Apr 5 '18 at 18:40
  • That much is clear. Doesn't change the fact that I can't get it to work. I'm not doubting the theory is right, I just don't have the experience to understand the solution completely and to apply it. That's why I posted here. – Daniel Apr 5 '18 at 18:45
  • You are going to have to choose the category names you want and either calculate over the original categories to make them conform (destructive and not recommended) or create a new field and calculate the chosen names based on the other names and then create a derivative based on the new field only (non-destructive and gives you the opportunity to analyze based on multiple levels of resolution for the attribute). In the Field Calculator you can use Select Case calculation in VB or a series of if else clauses in Python to do this kind of reclassification. – Richard Fairhurst Apr 5 '18 at 20:24
0

So since I couldn't figure out how to combine the rows by within the attribute table itself, I did it the long way around.

I selected the categories I wanted with "Select by attribute" and created a new layer from the selection. After that I had to repair the geometry but was then able to dissolve the new layer and ended up with one large polygon.

Repeated that step a few times and then merged the resulting layers together. This gave me the result I wanted.

  • I'd summarise existing types first. Add text column to this table and populate it with broader categories. Join to original table using existing types and dissolve by categories. – FelixIP Apr 5 '18 at 21:01
  • I just don't quite know how to use the field calculator (which I believe is required?). I've hacked it together a bit by selecting the cases, creating a new layer, and then dissolving that layer based on a new field I created and just left empty so I could dissolve all the categories within the table into one. It would be way easier, I think, to use the field calculator but that's too much to learn right now. Can't do it manually either since the table has about 200k rows (national building data). – Daniel Apr 6 '18 at 8:27
  • My solution has nothing to do with Python and number of records play no role at all. Right click on oldtype field and pick summarise. You'll get a very small table contain in unique values etc. – FelixIP Apr 6 '18 at 9:28
0

You seem to have a solution, but I thought I would add two more.

Using the Dissolve Tool would be the best option, but requires some work upfront. First, you need to decide on the categories you want to define. So Grassland, Urban, Forest etc. Then you need to decide what categories in your current dataset will fit into each of these.

So the first method.

  1. Create a field called "Classes"
  2. Run the select by attributes, selecting all of the current attributes that match the categories you want - so "fallow land" , "Crops" etc. Once you have them selected, Right-click on your "Classes" field and assign the category name for this selection. Repeat this for all the categories.
  3. Run the dissolve tool, use the "Classes" field as the dissolve field.

The second method is similar to the first, except you use the "merge tool" in the editor toolbar.

  1. Follow the first step from the process above, except after adding the field, start editing the layer.
  2. Run the select by attributes as per step 2 above, except instead of running the field calculator, go to the editing toolbar and select "Merge...". This will collapse the selection into 1 feature. You can then edit the "Classes" field to what you want to call this category.

Both of these methods will give you one layer, with an attribute table of the re-classified categories.

  • Thank you so much for this explanation! What I did was similar to your first method but a lot less elegant because I didn't know how to populate the newly created field. Since I'm going to be using the same method for other projects, your explanation is really useful! – Daniel Apr 10 '18 at 11:43
  • Great. If this answered your question, click the little green tick. If you need more help feel free to ask a new question. Good luck. – Keagan Allan Apr 10 '18 at 11:46
  • Thank you. I did, but sub 15 reputation votes aren't shown sadly. – Daniel Apr 10 '18 at 12:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.