arcuser

# Mapping Complex Data with Multipart Geometries

Do you have an application that requires mapping complex geometries and data, such as a network of interconnected pipes, a complex railroad system, lakes within islands, or multiple islands, but don’t know where to start?

Termed multipart geometries, these are a collection of simpler geometries combined to form a more complex shape. This article explores multipart geometries using ArcGIS Maps SDKs for Native Apps and describes multipart geometry types, how to create and apply them, and the benefits of using them. Although the code snippets are written using ArcGIS Maps SDK for Kotlin, all the concepts described apply to the other ArcGIS Maps SDKs for .NET, Qt, Java, and Swift.

Let’s get started with the terminology used in this article. The ArcGIS Developer Glossary defines a feature as a single record that represents a real-world geographic entity. A feature will store its geographic representation—which could be a point, line, or polygon—as both geometry and attribute data.

Geometry refers to the spatial aspects of a feature (e.g., length if it is a line or area if it is a polygon) and is used to define the shape and position of the feature. Attribute data is data associated with that feature, such as the number of people or the temperature. An ArcGIS-hosted table contains information about a set of geographic features. Each row represents a feature, and each column represents one feature attribute.

### What Are Multipart Geometries?

Multipart geometries allow users to represent complex spatial features using simpler geometry types. These complex features can be composed of multiple points, lines, or polygons that are combined to form a more complex shape. Multipart geometries are categorized as multipoints, multipart lines, and multipart polygons. These geometries, which are composed of multiple simpler geometries grouped into one complex geometry, can be represented as a single entry in a hosted table, instead of having multiple entries for each single geometry.

### Multipoint Geometry

Multipoint geometry is a type of geometry that represents features that consist of clusters of points, such as weather station networks, lidar point clusters, or a collection of trees in a forest. For example, each individual tree in a collection of trees of the same species could be represented as a single point feature on a map, or each point could be represented in a multipoint geometry that represents the entire collection of trees.

Choosing a single multipoint geometry, which uses a single row in the database, has many advantages over using many single point geometries. It allows efficient management and analysis of spatial data such as the location and characteristics of individual trees. In addition, calculating the density of trees in different areas or determining the distance between trees can be performed on multipoint geometry. Such analysis helps with planning and development.

The code snippet in Listing 1 demonstrates the creation of a multipoint geometry using ArcGIS Maps SDK for Kotlin. Each individual tree is a point feature that is combined to form a multipoint geometry. View the complete code for all examples on GitHub.

### Multipart Line Geometry

Multipart line geometry is a type of geometry that represents a set of two or more individual line features combined to form a more complex feature. It is used to represent linear features that cannot be shown as a single line feature. These individual line features can be disconnected, which means that they do not share endpoints with adjacent line features.

Examples of multipart line geometry features would be a braided river composed of multiple river channels that form part of the same river, a complex railroad system, or a pipeline network. An aerial image of the Brahmaputra River in Bangladesh (figure 1), shows that the many channels that form this river share the same attribute since collectively they make up the Brahmaputra River.

Representing this complex river system as a single multipart line geometry helps in efficient data analysis. An example of this would be computing the length and width of the complete river system. One can easily manage, analyze, and visualize the spatial data for the entire system, rather than having to work with individual segments of the river.

The code snippet in Listing 2 illustrates how to create complex multipart polylines using ArcGIS Maps SDK for Kotlin. This code creates different river streams that connect to the main river. The four river streams constituting a single river that eventually connects to the ocean are represented as one multipart polyline feature.

### Multipart Polygon Geometry

In GIS, when a path encloses an area, it is called a ring. The ring starts and ends at the same place. A collection of one or more such rings make a polygon. A multipart polygon is composed of many such individual polygons that combine to form a complex shape. Each polygon in the multipart polygon is termed as a part. Each part has its own size and shape. Parts also represent areas that are completely contained within another area, like an island in a lake.

For example, agricultural fields with complex shapes and multiple sections can be represented as a multipart polygon geometry that permits farmers to understand and analyze agricultural output. Complex geologic formations, such as mountains, ridges, and canyons, can be represented as multipart polygons to help geologists analyze the structure of the Earth’s crust and its formation process.

The state of Hawaii can be represented as a multipart polygon. It is made of eight main islands, each with its own shape and size. Hawaii can be stored as a single multipart polygon feature in the database table. This allows for a detailed and accurate representation of the state’s geography in GIS applications such as land-use planning or disaster response.

The code snippet in Listing 3 creates complex multipart polygons by adding a couple of islands and a lake within an island on the map using ArcGIS Maps SDK for Kotlin.

### Applications of Multipart Geometries

Multipart geometries can be used to represent complex road and transportation networks, such as highways with multiple lanes, ramps, and intersections, and help analyze the connections between different parts of the network. Complex urban features, such as city blocks, neighborhoods, and complex building structures, can be represented as multipart geometries. This can help users understand the relationship between different city zones.

Multipart geometries can also be used to represent complex environmental features, such as national forests, nature conservancy land, wildlife sanctuaries, and various water bodies, when performing environmental assessments and planning.

### Benefits of Multipart Geometries

Using multipart geometry over multiple individual geometries has many benefits. One of the important benefits is enhanced performance. The amount of memory required to store these geometries is reduced significantly when multiple related parts or features are stored as a single multipart geometry object, which in turn boosts the efficiency of spatial queries and analysis.
Multipart geometries help simplify data management. If a map feature consists of multiple polylines, it can be stored as a single multipart polyline geometry and updated as a single geometry object, instead of many individual geometries. This makes it easier to update and maintain data integrity.

Another benefit of multipart geometries is increased flexibility in representing complex spatial features. By representing features as a single multipart geometry, it is easier to visualize and analyze the feature as a whole, rather than treating each part as a separate feature.

### Conclusion

In summary, using multipart geometries in your mapping applications is an efficient way of representing a wide range of complex features in geographic data. From water bodies and land masses to buildings and transportation networks, multipart geometries allow for a detailed representation of complex features, which is helpful in urban and town planning, environmental resource planning, and other applications.

This article showcased examples using ArcGIS Maps SDK for Kotlin to map complex features. To learn more about adding attributes to a feature, look at this sample code  on the ArcGIS Developers site, which creates and adds features with attribute values that satisfy a predefined set of contingencies. Also, see the Kotlin samples on the Esri GitHub repository.

If you’re new to developing ArcGIS Maps SDKs for Native Apps, the SDKs for .NET, Qt, Java, Kotlin, and Swift each have guides, documentation, API references, tutorials, and samples. Sign up for a free ArcGIS Developer account at developers.arcgis.com and access everything you need to develop your apps.