28

From a more formal point of view, I report the definition for both a polygon and a multipolygon (the following text and images come from this document of the OGC® Standards, all credits to the cited source). Polygon A Polygon is a planar Surface defined by 1 exterior boundary and 0 or more interior boundaries. Each interior boundary defines a hole in the ...


26

Under "Advanced Editing" there is a Button for "Explode Multi-Part features". Worked just fine!


18

You can use the Multipart To Singlepart (Data Management) tool which: Creates a feature class containing singlepart features generated by separating multipart input features.


18

The Multipart Split plugin can do this during the Edit session and saves the results in the current layer instead of creating a new one. You can download this from the toolbar: Plugins > Manage and Install Plugins When enabled, it will appear in the Edit menu and should also appear as an icon in the toolbar:


11

Shapefiles have no type MultiPolygon (type = Polygon), but they support them anyway (all rings are stored in one polygon = list of polygons, look at GDAL: ESRI Shapefile) It is easier with Fiona and Shapely: import fiona from shapely.geometry import shape, mapping # open the original MultiPolygon file with fiona.open('multipolygons.shp') as source: # ...


11

from GDAL mailing list using python import os from osgeo import ogr def multipoly2poly(in_lyr, out_lyr): for in_feat in in_lyr: geom = in_feat.GetGeometryRef() if geom.GetGeometryName() == 'MULTIPOLYGON': for geom_part in geom: addPolygon(geom_part.ExportToWkb(), out_lyr) else: addPolygon(...


11

You need to understand the Shapely binary predicates: 1) If the two polygons intersects the result of union or unary_union (in red) is a Polygon therefore you can computes the exterior 2) If the two polygons are disconnected, the result is necessary a MultiPolygon (in red with two polygons) And if you work with Shapefiles, without topology, this may ...


11

You can wrap the polygon in a list and pass that as an argument to the MultiPolygon constructor. Demo: from shapely.geometry.multipolygon import MultiPolygon from shapely import wkt p = wkt.loads(u'POLYGON((0 0,0 1,1 1,0 0))') m = MultiPolygon([p]) print(m.wkt) # prints 'MULTIPOLYGON (((0 0, 0 1, 1 1, 0 0)))'


11

Shapefile polygons are constructed from one or more closed rings. If a shape has multiple rings, they can be exterior and interior (e.g., form a doughnut), or multiple exterior (e.g., island chain). Of course, having multiple exteriors doesn't prevent having one or more interior rings on each shape. The shapefile specification does state that: Exterior ...


10

The output you are receiving is correct. Assuming you have two polygons, one without a hole, and one with a hole, then each of these shapes is single-part. Polygon geometry has two levels of construction - parts and rings. Each part must have one exterior ring, but may contain additional interior rings (aka "holes"). The partCount property returns the ...


9

Shapefiles support four fundamental data types: Point, Polyline, Polygon, and Multipoint. Points are simple {X,Y} features. Polylines are ordered sets of points, and Polygons are the areas encompassed by closed simple lines. Polylines and Polygons can be multi-part to model discontinuous features, like a surface street separated by a highway, or a ...


7

Dissolve may or may not create multi-part features. Features which share common geometry (such as two separate lines with a common endpoint, or two adjacent polygons with a common edge) will be combined regardless of whether multi-part creation is allowed. Multi-parts (if allowed) will result from any non-connected geometry. You will probably still end up ...


7

I seem to have found the answer. Within ArcToolbox, Feature to Point seems to do the trick. Converts 1 multipoint to 1 singlepoint.


7

Starting with some random points, in an attept to imitate those in the OP's image, where the first two spatially intersect, then the 2nd and 3rd have the same attribute id (2), with a couple of other points that neither spatially intersect nor have the same attribute, the following query produces 3 clusters: WITH temp (id, geom) AS (VALUES (1, ...


6

I would make a new layer by buffering your polygons by x-meters and checking the 'dissolve' option. Make sure your new layer is singlepart geometry and then give each of your buffered polygons a unique ID. Next perform a spatial join of your buffers on your original polygons to attribute the originals with the ids from your buffers. Finally dissolve your ...


6

I solved it using this code: arr1 = arcpy.Array([a,b,c]) arr2 = arcpy.Array([d,e,f]) resArr = arcpy.Array([arr1,arr2]) pL = arcpy.Polyline(resArr)


5

Yes, it's called a multi-part shape and is perfectly normal. At the simplest, they can be created by selecting a bunch of different polygons and using the Merge tool. Whether they are desirable is a different story. You would need to describe in much more detail what your process is trying to accomplish and whether you want one row for each shape or not for ...


5

I think this is an ideal candidate for an ArcGIS Idea (if there is not already one). The Online Help for Multipart Polygons says (with my bolding): Keep in mind that parts in a multipart polygon are spatially separated. They can touch each other at vertices, but they cannot share edges or overlap. When you are sketching a multipart polygon, any ...


5

This feature is currently being evaluated to be integrated with QGIS 2.16 (and has good chances that it will be) will be part of QGIS with the 2.16 release and present on master builds from after Apr, 29 2016. For a solution compatible with 2.14 see below. Or if you want to use QGIS 2.14, use a Geometry Generator symbol layer. CASE WHEN @geometry_part_num ...


5

For ArcGIS v. 10.1 and older I'd create new field of integer type and populate it using: !Shape!.partCount Note parser is set to Python. It is much faster with Add Geometry Attributes tool available in newer versions of ArcGIS. Tool creates required field for you. This is how attributes on offer look like for multipart point input: I found this tool ...


5

The reason why you cannot choose the embedded piece alone is that your layer has multipart polygons. Try Vector | Geometry Tools | Multipart to singleparts to break them apart. Or you may want to try an excellent plugin Multipart Split. It enables us to split only aimed poygon and the splitted polygons are written directly onto the same layer, so your task ...


5

This is an easier alternative. layer = iface.activeLayer() expr = QgsExpression( "num_geometries( $geometry ) > 1" ) it = layer.getFeatures( QgsFeatureRequest( expr ) ) ids = [i.id() for i in it] Now you can know how many features are multi-part: print 'There are {} multipart features in this layer'.format(len(ids)) And even select multi-...


5

Putting the comments together: import arcpy arcpy.env.workspace = "c:/esripress/python/data" fc = "Hawaii.shp" with arcpy.da.SearchCursor(fc, ["OID@","SHAPE@"]) as cursor: for row in cursor: shape = row[1] # shape is the 2nd value in the row print "Total area: {}".format(shape.area) partnum = 0 for part in shape: ...


5

If you are using the sf classes then you cast it from MULTIPOLYGON to POLYGON. Example using data from spData package: ncsf = st_read(system.file("shapes/sids.shp", package = "spData")[1]) > dim(ncsf) [1] 100 23 100 features there. Some are MULTIPOLYGON, so let's split: > ncmp = st_cast(ncsf,"POLYGON") Warning message: In st_cast.sf(ncsf, "POLYGON")...


4

I am not sure if the following will not do the same thing as dissolve, but if I'm correct, it should not. You can use a SearchCursor() to loop through the polygons, get each polygon's geometry, add these as parts on a new polygon geometry object, and use an InsertCursor() to insert this new record. sc = arcpy.SearchCursor("c:/temp/fishnet2.shp") ic = ...


4

Dissolve tool creates multipart features. With the field option, you are grouping the features that are going to be the geometry parts of a new feature, according to an attribute. That's fine. The result is a Dissolved layer with a feature for each occurrence of that attribute. But each feature has many parts (as many as original features with that ...


3

Reason is probably in accuracy of numeric computing. Removing the last decimal from the Y coordinate of the connecting points is enough for making the query to return LINESTRING SELECT ST_AsText(ST_LineMerge( ST_GeomFromText('MULTILINESTRING( (-70.52570888 -33.48112668,-70.52552472 -33.4811641), (-70.52552472 -33.4811641,-70.52453208 -33.48121471,-70....


3

A multipart layer is a simple list of singlepart layers: You can use: 1) Fiona and Shapely from shapely.geometry import shape import fiona multis = fiona.open("multipolygons.shp") # first feature of the shapefile first = multis.next() print first {'geometry': {'type': 'MultiPolygon', 'coordinates': [[[(244697.45179524383, 1000369.2307574936), (244827....


3

There is an option (in QGIS 2.6.1 anyway) where you can select a Unique ID Field: Select your desired features Access the Field Calculator Create a new field and check the option to update your selected features Enter a value and save the edits (this will give the selected features the same value and leaves the value for the non-selected features as NULL) ...


3

Someone may be able to provide a better workflow, but here's mine: 1) Your polygons up to now probably look something like this. 2) Explode or use the Multipart to Singlepart tool to convert them into singlepart polygons. 3) Select by Location the exploded (singlepart) polygons that intersect the points and export as a new feature class. 4) With the ...


Only top voted, non community-wiki answers of a minimum length are eligible