Hello,
I would like to dissolve large polygon feature data set(25000 units) based on 2 conditions:
1- by attribute value partially matched, (UNIT field)
for example
id | Unit |
---|---|
1 | CLAY BROWN UNIT 2 |
2 | CLAY BROWN UNIT 3 |
3 | CLAY BROWN UNIT 4 sub unit 6 |
4 | CLAY BROWN UNIT 5 |
2- only adjacent polygon should be dissolved. ( warning topology is not clean 100% , small gaps may appear)
example only rows 1,2,3 are adjacent polygon.
I would appreciate any suggestion.
Thank you
Hi,
The dissolve will only dissolve adjacent features so condition 2 will be met anyway.
Regards gaps I would look at the integrate tool but be warned this will alter the existing data. I highly recommend making a copy before u do anything with it. It will also probably destroy and topology u have set up.
If u mean a partial field match I would probably add a new field such as higher level soil unit etc. And run a field calculator with a python code block to get the matches. I can write this when I get some time
Thank for your your helpful information,
The dissolve will only dissolve adjacent features so condition 2 will be met anyway.
Yes I mean partial field match, from the example table (Clay Brown Unit) is partial match. another Example
1- East Soil corrected 6th addition
2- East Soil corrected 5th addition
3- East Soil corrected 5th sub plat
only 1,2 should be dissolved.
I would love to get that python script, to test,
Thank you.
defining multiple flags in code block is a challenge, do I need to use regex.
How many entries are there to match to? If you list them I'll put them in the code to match. If theres hundreds I'll think of a better solution
Thanks, I am afraid they are hundreds. I have 25000 records, (10 feature classes).
Is there an identifiable pattern to break/group the string by? If not I cant really see a solution.
Yes that is the problem, there is no identifiable pattern,
Thank you very much.
If there is no pattern, you may have to break them into groups and process accordingly. Sometimes there is no one-solves-all. You indicate that you have 10 featureclasses but 25000 records. It appears you are looking for a substring within a string. If it were you could use that information to parse the data first prior to determining whether to dissolve.
cases = ['East Soil corrected 6th addition',
'East Soil corrected 5th addition',
'East Soil corrected 5th sub plat']
for c in cases:
if 'East Soil corrected' in c and 'addition' in c:
print("dissolve")
else:
print("don't dissolve")
dissolve
dissolve
don't dissolve
Thank you, using Case statement is not an option, keeping up with it for anything new may be a pain.