Issue with dissolve in Python

4494
9
03-04-2015 09:31 AM
BradGawron
New Contributor

 

The above screenshot shows the result of a dissolve function on some data in New York.  The dissolve scripting is set such that it should dissolve into one single feature, but as you can see above, there is a geographic division going on. Anything with any part north of a line is one feature. When I run the dissolve tool in the Map interface it dissolves into one feature with no issue, any idea why I am getting a split?  Even when I try to dissolve twice, in case its a batch issue, it returns this. 

Tags (2)
0 Kudos
9 Replies
DarrenWiens2
MVP Honored Contributor

May get some hints if you post your script.

0 Kudos
BradGawron
New Contributor

mergeBuffer = "mergeBuffer"

out = "newBuffer"

arcpy.Dissolve_management(mergeBuffer, out, "Id", "", "MULTI_PART", "DISSOLVE_LINES")

That's the scripting which is driving the dissolve, nothing fancy.  Everything up until this point is not generating any problems.

0 Kudos
DarrenWiens2
MVP Honored Contributor

I assume you've checked that "mergeBuffer" is what you think it is. Can't do much else than inspect your data.

0 Kudos
IanMurray
Frequent Contributor

Few thoughts.

First, you are dissolving based on the ID field, do the north and south parts have different ID numbers?

Second you are running this as part of a larger script it sounds like, perhaps you have a selection that was not cleared from an earlier operation which is only dissolving selected features?  If you could post more of your script, perhaps that could be helpful in finding the issue.

0 Kudos
BradGawron
New Contributor

I considered the ID field difference, to mitigate that I inserted an extra line of text that reset the Id field just prior to this step.  No go.  I tried by using no dissolve field.  No go.

To test and see if it was an issue of selection, I created a script that just dissolves the penultimate shapefile.  Again, this is the outcome.  And, to make matters worse, the north/south division shifts upwards and downwards randomly each time it is run.  Maybe it is an issue of the system parsing it out to make the processing easier?

0 Kudos
IanMurray
Frequent Contributor

Kinda sounds like its not processing all of your polygons in the dissolve each time.  How many do you have to dissolve?

Also I'm guessing that it has nothing to do with North vs South, but more based on it processing X number of polygons, in order of FID or OID and stops at a certain point.  Are you working with a shapefile or GDB Feature Class?

0 Kudos
BradGawron
New Contributor

I think a lot has to do with the number of vertices.  It's around 70000.

I tried running the process using both shapefiles and GDB feature classes and neither made a difference.  The script seems to be doing a Dice automatically.

0 Kudos
IanMurray
Frequent Contributor

Here is an older topic for you to take a look at about the problems with Dissolve with medium to large datasets.  It could be useful.

Solution to: Dissolve tool does not fully dissolve medium-size dataset

0 Kudos
BradGawron
New Contributor

Well, so when I import the script as a tool in arcMap, it runs without a hitch.  This problem only happens when the tool runs in IDLE or command line.  So, it would seem the script is fine.  Anybody?

0 Kudos