Dissolving feature/field by interval using ArcGIS Desktop?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
2
down vote

favorite












I have a huge dataset with flowpaths containing a catchment area for each line. The attribute table has ~ 780.000 rows, and thereby 780.000 features in the mapwindow.



Is it possible by using a field to merge the data in intervals, so you get a multi-part feature instead?



For instance merge all the features so those with a catchment area of 1-10.000 become one, from 10.001-20.000, 20.001-30000 and so on? The interval doesn't have to be 10.000 but can be another value.



I was messing around with the dissolve feature, but other than doing a manual population of a field and then dissolving by that attribute, I couldn't find another way to do it.



Basically I want what the symbology window does, but I want to do it to the dataset.



I have ArcGIS Desktop 10.5.1 with the Advanced License.










share|improve this question























  • @BERA ArcGIS Desktop 10.5.1 with Spatial Analyst and Advanced License.
    – FoolzRailer
    4 hours ago
















up vote
2
down vote

favorite












I have a huge dataset with flowpaths containing a catchment area for each line. The attribute table has ~ 780.000 rows, and thereby 780.000 features in the mapwindow.



Is it possible by using a field to merge the data in intervals, so you get a multi-part feature instead?



For instance merge all the features so those with a catchment area of 1-10.000 become one, from 10.001-20.000, 20.001-30000 and so on? The interval doesn't have to be 10.000 but can be another value.



I was messing around with the dissolve feature, but other than doing a manual population of a field and then dissolving by that attribute, I couldn't find another way to do it.



Basically I want what the symbology window does, but I want to do it to the dataset.



I have ArcGIS Desktop 10.5.1 with the Advanced License.










share|improve this question























  • @BERA ArcGIS Desktop 10.5.1 with Spatial Analyst and Advanced License.
    – FoolzRailer
    4 hours ago












up vote
2
down vote

favorite









up vote
2
down vote

favorite











I have a huge dataset with flowpaths containing a catchment area for each line. The attribute table has ~ 780.000 rows, and thereby 780.000 features in the mapwindow.



Is it possible by using a field to merge the data in intervals, so you get a multi-part feature instead?



For instance merge all the features so those with a catchment area of 1-10.000 become one, from 10.001-20.000, 20.001-30000 and so on? The interval doesn't have to be 10.000 but can be another value.



I was messing around with the dissolve feature, but other than doing a manual population of a field and then dissolving by that attribute, I couldn't find another way to do it.



Basically I want what the symbology window does, but I want to do it to the dataset.



I have ArcGIS Desktop 10.5.1 with the Advanced License.










share|improve this question















I have a huge dataset with flowpaths containing a catchment area for each line. The attribute table has ~ 780.000 rows, and thereby 780.000 features in the mapwindow.



Is it possible by using a field to merge the data in intervals, so you get a multi-part feature instead?



For instance merge all the features so those with a catchment area of 1-10.000 become one, from 10.001-20.000, 20.001-30000 and so on? The interval doesn't have to be 10.000 but can be another value.



I was messing around with the dissolve feature, but other than doing a manual population of a field and then dissolving by that attribute, I couldn't find another way to do it.



Basically I want what the symbology window does, but I want to do it to the dataset.



I have ArcGIS Desktop 10.5.1 with the Advanced License.







arcgis-desktop arcgis-10.5 dissolve






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 1 hour ago









PolyGeo♦

51.8k1777231




51.8k1777231










asked 4 hours ago









FoolzRailer

14710




14710











  • @BERA ArcGIS Desktop 10.5.1 with Spatial Analyst and Advanced License.
    – FoolzRailer
    4 hours ago
















  • @BERA ArcGIS Desktop 10.5.1 with Spatial Analyst and Advanced License.
    – FoolzRailer
    4 hours ago















@BERA ArcGIS Desktop 10.5.1 with Spatial Analyst and Advanced License.
– FoolzRailer
4 hours ago




@BERA ArcGIS Desktop 10.5.1 with Spatial Analyst and Advanced License.
– FoolzRailer
4 hours ago










1 Answer
1






active

oldest

votes

















up vote
3
down vote



accepted










Create a new field of intervals and assign an interval to each record. Then dissolve by interval field. This can be done with field calculator and many if-elif-elses or you can use pandas module (which is included in ArcGIS 10.5) and pandas.cut:




Use cut when you need to segment and sort data values into bins




Add a text field named Intervalfield, modify indicated lines and execute code in the python window of ArcMap. Then Dissolve by Intervalfield. If you want to use some other areafield instead of shapearea, replace SHAPE@AREA with the name of your field:



import pandas as pd
import arcpy

fc = r'C:data.gdbfeatureclass' #Change to match your data
bins = [-1,10,20,30,40,50,9999] #Add/remove bins

df = pd.DataFrame.from_records(data=arcpy.da.SearchCursor(fc,['OID@','SHAPE@AREA']),columns=['OID','Area'])
df['Interval'] = pd.cut(df['Area'], bins=bins).astype(str)

intervaldictionary = dict(zip(df.OID,df.Interval))

with arcpy.da.UpdateCursor(fc,['OID@','Intervalfield']) as cursor:
for row in cursor:
if row[0] in intervaldictionary:
row[1] = intervaldictionary[row[0]]
else:
row[1] = 'Unknown interval'
cursor.updateRow(row)


After code you will have output below, then dissolve.



enter image description here






share|improve this answer


















  • 1




    This works perfectly, thank you. As a bonus question out of curiosity and it isn't required as I can use this fine, but is it possible to put this into a toolbox, where you can choose your input file and intervals instead of "hardcoding" it?
    – FoolzRailer
    1 hour ago






  • 1




    @FoolzRailer nice! Im sure it is, but I dont have much exprience with toolboxes. You could post this as a new question including what you tried and why it did not work.
    – BERA
    1 hour ago











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "79"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f295929%2fdissolving-feature-field-by-interval-using-arcgis-desktop%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
3
down vote



accepted










Create a new field of intervals and assign an interval to each record. Then dissolve by interval field. This can be done with field calculator and many if-elif-elses or you can use pandas module (which is included in ArcGIS 10.5) and pandas.cut:




Use cut when you need to segment and sort data values into bins




Add a text field named Intervalfield, modify indicated lines and execute code in the python window of ArcMap. Then Dissolve by Intervalfield. If you want to use some other areafield instead of shapearea, replace SHAPE@AREA with the name of your field:



import pandas as pd
import arcpy

fc = r'C:data.gdbfeatureclass' #Change to match your data
bins = [-1,10,20,30,40,50,9999] #Add/remove bins

df = pd.DataFrame.from_records(data=arcpy.da.SearchCursor(fc,['OID@','SHAPE@AREA']),columns=['OID','Area'])
df['Interval'] = pd.cut(df['Area'], bins=bins).astype(str)

intervaldictionary = dict(zip(df.OID,df.Interval))

with arcpy.da.UpdateCursor(fc,['OID@','Intervalfield']) as cursor:
for row in cursor:
if row[0] in intervaldictionary:
row[1] = intervaldictionary[row[0]]
else:
row[1] = 'Unknown interval'
cursor.updateRow(row)


After code you will have output below, then dissolve.



enter image description here






share|improve this answer


















  • 1




    This works perfectly, thank you. As a bonus question out of curiosity and it isn't required as I can use this fine, but is it possible to put this into a toolbox, where you can choose your input file and intervals instead of "hardcoding" it?
    – FoolzRailer
    1 hour ago






  • 1




    @FoolzRailer nice! Im sure it is, but I dont have much exprience with toolboxes. You could post this as a new question including what you tried and why it did not work.
    – BERA
    1 hour ago















up vote
3
down vote



accepted










Create a new field of intervals and assign an interval to each record. Then dissolve by interval field. This can be done with field calculator and many if-elif-elses or you can use pandas module (which is included in ArcGIS 10.5) and pandas.cut:




Use cut when you need to segment and sort data values into bins




Add a text field named Intervalfield, modify indicated lines and execute code in the python window of ArcMap. Then Dissolve by Intervalfield. If you want to use some other areafield instead of shapearea, replace SHAPE@AREA with the name of your field:



import pandas as pd
import arcpy

fc = r'C:data.gdbfeatureclass' #Change to match your data
bins = [-1,10,20,30,40,50,9999] #Add/remove bins

df = pd.DataFrame.from_records(data=arcpy.da.SearchCursor(fc,['OID@','SHAPE@AREA']),columns=['OID','Area'])
df['Interval'] = pd.cut(df['Area'], bins=bins).astype(str)

intervaldictionary = dict(zip(df.OID,df.Interval))

with arcpy.da.UpdateCursor(fc,['OID@','Intervalfield']) as cursor:
for row in cursor:
if row[0] in intervaldictionary:
row[1] = intervaldictionary[row[0]]
else:
row[1] = 'Unknown interval'
cursor.updateRow(row)


After code you will have output below, then dissolve.



enter image description here






share|improve this answer


















  • 1




    This works perfectly, thank you. As a bonus question out of curiosity and it isn't required as I can use this fine, but is it possible to put this into a toolbox, where you can choose your input file and intervals instead of "hardcoding" it?
    – FoolzRailer
    1 hour ago






  • 1




    @FoolzRailer nice! Im sure it is, but I dont have much exprience with toolboxes. You could post this as a new question including what you tried and why it did not work.
    – BERA
    1 hour ago













up vote
3
down vote



accepted







up vote
3
down vote



accepted






Create a new field of intervals and assign an interval to each record. Then dissolve by interval field. This can be done with field calculator and many if-elif-elses or you can use pandas module (which is included in ArcGIS 10.5) and pandas.cut:




Use cut when you need to segment and sort data values into bins




Add a text field named Intervalfield, modify indicated lines and execute code in the python window of ArcMap. Then Dissolve by Intervalfield. If you want to use some other areafield instead of shapearea, replace SHAPE@AREA with the name of your field:



import pandas as pd
import arcpy

fc = r'C:data.gdbfeatureclass' #Change to match your data
bins = [-1,10,20,30,40,50,9999] #Add/remove bins

df = pd.DataFrame.from_records(data=arcpy.da.SearchCursor(fc,['OID@','SHAPE@AREA']),columns=['OID','Area'])
df['Interval'] = pd.cut(df['Area'], bins=bins).astype(str)

intervaldictionary = dict(zip(df.OID,df.Interval))

with arcpy.da.UpdateCursor(fc,['OID@','Intervalfield']) as cursor:
for row in cursor:
if row[0] in intervaldictionary:
row[1] = intervaldictionary[row[0]]
else:
row[1] = 'Unknown interval'
cursor.updateRow(row)


After code you will have output below, then dissolve.



enter image description here






share|improve this answer














Create a new field of intervals and assign an interval to each record. Then dissolve by interval field. This can be done with field calculator and many if-elif-elses or you can use pandas module (which is included in ArcGIS 10.5) and pandas.cut:




Use cut when you need to segment and sort data values into bins




Add a text field named Intervalfield, modify indicated lines and execute code in the python window of ArcMap. Then Dissolve by Intervalfield. If you want to use some other areafield instead of shapearea, replace SHAPE@AREA with the name of your field:



import pandas as pd
import arcpy

fc = r'C:data.gdbfeatureclass' #Change to match your data
bins = [-1,10,20,30,40,50,9999] #Add/remove bins

df = pd.DataFrame.from_records(data=arcpy.da.SearchCursor(fc,['OID@','SHAPE@AREA']),columns=['OID','Area'])
df['Interval'] = pd.cut(df['Area'], bins=bins).astype(str)

intervaldictionary = dict(zip(df.OID,df.Interval))

with arcpy.da.UpdateCursor(fc,['OID@','Intervalfield']) as cursor:
for row in cursor:
if row[0] in intervaldictionary:
row[1] = intervaldictionary[row[0]]
else:
row[1] = 'Unknown interval'
cursor.updateRow(row)


After code you will have output below, then dissolve.



enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited 1 hour ago

























answered 3 hours ago









BERA

11.3k41536




11.3k41536







  • 1




    This works perfectly, thank you. As a bonus question out of curiosity and it isn't required as I can use this fine, but is it possible to put this into a toolbox, where you can choose your input file and intervals instead of "hardcoding" it?
    – FoolzRailer
    1 hour ago






  • 1




    @FoolzRailer nice! Im sure it is, but I dont have much exprience with toolboxes. You could post this as a new question including what you tried and why it did not work.
    – BERA
    1 hour ago













  • 1




    This works perfectly, thank you. As a bonus question out of curiosity and it isn't required as I can use this fine, but is it possible to put this into a toolbox, where you can choose your input file and intervals instead of "hardcoding" it?
    – FoolzRailer
    1 hour ago






  • 1




    @FoolzRailer nice! Im sure it is, but I dont have much exprience with toolboxes. You could post this as a new question including what you tried and why it did not work.
    – BERA
    1 hour ago








1




1




This works perfectly, thank you. As a bonus question out of curiosity and it isn't required as I can use this fine, but is it possible to put this into a toolbox, where you can choose your input file and intervals instead of "hardcoding" it?
– FoolzRailer
1 hour ago




This works perfectly, thank you. As a bonus question out of curiosity and it isn't required as I can use this fine, but is it possible to put this into a toolbox, where you can choose your input file and intervals instead of "hardcoding" it?
– FoolzRailer
1 hour ago




1




1




@FoolzRailer nice! Im sure it is, but I dont have much exprience with toolboxes. You could post this as a new question including what you tried and why it did not work.
– BERA
1 hour ago





@FoolzRailer nice! Im sure it is, but I dont have much exprience with toolboxes. You could post this as a new question including what you tried and why it did not work.
– BERA
1 hour ago


















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f295929%2fdissolving-feature-field-by-interval-using-arcgis-desktop%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

What does second last employer means? [closed]

Installing NextGIS Connect into QGIS 3?

One-line joke