Dissolving feature/field by interval using ArcGIS Desktop?
Clash 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.
arcgis-desktop arcgis-10.5 dissolve
add a comment |Â
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.
arcgis-desktop arcgis-10.5 dissolve
@BERA ArcGIS Desktop 10.5.1 with Spatial Analyst and Advanced License.
â FoolzRailer
4 hours ago
add a comment |Â
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.
arcgis-desktop arcgis-10.5 dissolve
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
arcgis-desktop arcgis-10.5 dissolve
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
add a comment |Â
@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
add a comment |Â
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.
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
add a comment |Â
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.
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
add a comment |Â
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.
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
add a comment |Â
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.
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.
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
add a comment |Â
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
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
@BERA ArcGIS Desktop 10.5.1 with Spatial Analyst and Advanced License.
â FoolzRailer
4 hours ago