Select to view content in your preferred language

Creating Multipart Objects

78
2
Thursday
JamesCarroll7
Occasional Contributor

Hi all,

I have a polyline shapefile layer in ArcGIS Pro which shows the road system of a proposed development. All of the roads are on this one layer, but I want to break it down into different selectable sectors for different parts of the development. I used the Multipart to Singlepart tool to break down the shapefile, but I can't find a tool to allow me to select certain polylines to group together (I essentially want to create the equivalent of a block in AutoCAD where all the roads in Sector 1 are grouped together, all the roads in Sector 2 are grouped together etc.). Is it possible to do this in GIS?

0 Kudos
2 Replies
DanPatterson
MVP Esteemed Contributor

not sure if you want the features to remain in the same layer or not.  If you want separate layers for each grouping see

Split By Attributes (Analysis)—ArcGIS Pro | Documentation

or if you want to split by using another geometry layer Split (Analysis)—ArcGIS Pro | Documentation

The opposite of multipart to singlepart is

Dissolve (Data Management)—ArcGIS Pro | Documentation


... sort of retired...
0 Kudos
DavidSolari
MVP Regular Contributor

Like Dan said, Dissolve with the "sector" field should be enough. If you need a more specific workflow, here's an arcpy function that'll condense a bunch of geometries into one multipart:

import ujson
def reduce_geoms(geoms: list[arcpy.Geometry]) -> arcpy.Geometry:
    iter_geom = iter(geoms)
    first = next(iter_geom)
    assert first.type != "point"
    retval = ujson.loads(first.JSON) 
    has_curves = "curvePaths" in retval
    path_key = "curvePaths" if has_curves else "paths"
    for g in iter_geom:
        gson = ujson.loads(g.JSON)
        paths = None
        if "curvePaths" in gson:
            paths = gson["curvePaths"]
            if not has_curves:
                retval["curvePaths"] = retval["paths"]
                del retval["paths"]
                path_key = "curvePaths"
        else:
            paths = retval["paths"]
        retval[path_key].extend(paths)
    return arcpy.AsShape(retval, True)
0 Kudos