1

I have a python script that merges 12 shapefiles into 1 shapefile with about 75k total records. I want to dissolve the latter shapefile on a particular field, and SUM another field, so my final shapefile has 12 records in it based on the dissolve field.

I can do this in ArcMap 10.2 with no problem, but when I do it from my python script outside of ArcMap, my final shapefile, instead of having 12 dissolved records, has about 20 (some are repeats). The field I dissolve on is a text field with distance such as 1000mile.shp, 2000mile.shp, etc...

Anyone know a workaround to make this work out of my python script?

arcpy.Dissolve_management(fc, "dissolvetracts.shp", "dist_band", [["LGH001","SUM"], ["Shape_area","SUM"]], "MULTI_PART", "DISSOLVE_LINES")
  • If you've gotten it to work manually through the UI, then I would suggest to create a model via ModelBuilder (MB), set up the tool in there, run it, (if it works) then export out the python script from MB to see the proper statement syntax. – artwork21 Nov 18 '15 at 12:55
  • That is a great idea. I'll try that later today. – Dane Nov 18 '15 at 13:14
  • 2
    Alternatively to what artwork21 suggests, you can open the Results window in ArcMap and right-click the tool result and choose copy as Python snippet. Look at syntax there. – Alex Tereshenkov Nov 18 '15 at 14:12
  • 1
    Still no luck. The dissolve starts at line 136 of my code, and from what I've read, the dissolve gets a little crazy after a lot of memory is used...thanks for the thoughts! I will just dissolve each shapefile individually, and then merge those together. – Dane Nov 20 '15 at 2:26
  • 1
    Dissolve is just crazy. Apparently it tiles large datasets, regardless of parameters, so it'll separate the data in pieces, which is the opposite of what I want to do. I'm now running my python script out of ArcMap, and it works, and seems to be more stable. – Dane Nov 21 '15 at 19:04

Your Answer

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

Browse other questions tagged or ask your own question.