Skip to main content

Merge Tool

The Merge tool combines two adjacent features on the same layer into a single feature. Pick a feature, tap a second feature on the same layer, choose which side keeps its row ID and attributes, confirm. The geometry is computed by JTS (Java Topology Suite); the kept row's geometry is updated to the union, the other row is deleted in the same step.

Pro+ feature

Merge is part of the Advanced Editing Pro+ feature set. Free and Pro users can see the master toggle in Settings > Advanced Editing but turning it on opens the subscription paywall.

When to use Merge

  • Cadastral consolidation - combining two adjacent parcels under a single owner.
  • Forestry stand re-classification - dissolving two adjacent stands that have become a single management unit.
  • Utility network simplification - joining two end-to-end pipe segments after a renumbering pass.
  • Duplicate cleanup - removing a stray duplicate feature drawn over an existing one.

Before you start

To use Merge you need:

  • A Mapit Pro Plus subscription.
  • The Advanced Editing master toggle on in Settings > Advanced Editing.
  • Two existing features on the same layer. Both must be single-part polygons or single-part polylines; multipart features (multipolygon, multilinestring) are not supported in v1.

The two features must be adjacent in a way that produces a clean single-part result. For polygons that means sharing at least an edge; for polylines that means sharing an endpoint. See Validity rules below.

The flow

1. Open the first feature for editing

Long-press an existing polygon or polyline feature to start an edit session on it. This becomes feature A - the visual reference for the merge.

2. Open the editing-tools sheet

The right-side toolbar shows the usual edit FABs plus a Tools chip near the top. Tap Tools to open the editing-tools bottom sheet. The sheet lists Split, Buffer, and Merge. Tap Merge.

3. Pick feature B

The vertex handles and midpoint markers on feature A disappear; A is re-drawn in purple with the letter A at its centroid so you can see your starting feature. A compact bar appears above the bottom navigation: "Tap a feature to merge" with a Cancel button.

Tap a second feature on the same layer. Mapit looks up the full-precision GeoPackage geometry for the picked feature and validates the union:

  • Tapping a feature on a different layer is silently ignored, with a brief "Same-layer features only" snackbar.
  • Tapping feature A itself is silently ignored; the bar reads "Pick a different feature".
  • Tapping a multipart feature is rejected with the same hint.

If validation passes, you advance to step 4. If validation fails for a geometric reason (disjoint polygons on a single-polygon table, T-junction polylines), a snackbar names the reason and you stay in pick mode so you can try another feature.

4. Pick which side keeps the row + attributes

A confirmation card slides up. The headline shows the merged area or length; below it two pills show A and B with their individual magnitudes. The merged geometry is drawn on the map in purple, and the A / B labels appear at the centroid of each input feature. The kept side's label renders larger with a thicker purple halo; the other side's label renders smaller and dimmer.

By default the larger piece keeps the row (configurable via the Largest piece keeps original attributes setting). Tap the other pill to swap. The kept-side highlight on the map flips to match.

5. Apply or Cancel

  • Apply updates the kept row's geometry to the merged shape and deletes the other row in the same step. The full GeoPackage rendered layer is rebuilt so both row changes appear on the map at once. A toast confirms with "Merged".
  • Cancel discards the preview without writing. Both rows are unchanged; the regular edit toolbar is restored on feature A so you can keep editing it.

Validity rules

The Merge tool refuses to write a merge result that would silently introduce a degenerate topology. In each rejection case a snackbar explains why and you stay in pick mode for another try.

ReasonWhenSurfaced message
Disjoint polygonsTwo polygons that do not share any boundary, on a single-polygon table. The JTS union would be a multipolygon, but the destination table is declared as POLYGON."Cannot merge: features are not adjacent"
Vertex-touch onlyTwo polygons that share exactly one corner vertex (a "bowtie"). JTS union returns a self-touching polygon that is not a valid simple-features geometry."Cannot merge: features only touch at a point"
T-junction linesTwo polylines that touch at an interior point (a midpoint of one line meets the endpoint of the other). The lines are not end-to-end mergeable."Cannot merge: lines do not connect end-to-end"
Empty resultDefensive case: union returned no geometry. Should not happen in practice."Cannot merge: result is empty"

For tables declared as MULTIPOLYGON or MULTILINESTRING, the disjoint / T-junction rules relax automatically: the merge succeeds and stores a multi-part geometry. Mapit reads the active layer's geometry-type declaration to decide.

Z values

JTS' union does not preserve Z (elevation) values along the merged boundary. Mapit writes the merged geometry as XY into the GeoPackage row, even when the source table declares XYZ. This matches the Buffer tool's behaviour. Z restoration along the merged boundary is on the roadmap.

Limitations in v1

  • Multipart features (multipolygon, multilinestring) are not supported as inputs. The Merge entry stays visible in the tools sheet but the chosen pair must be single-part.
  • Three-or-more feature dissolve is not supported in v1. Pick two features at a time. Multi-feature dissolve is on the roadmap as a follow-on.
  • Cross-layer merge is not supported. Both features must be on the same layer (and so share schema and projection).
  • Attribute conflict resolution is one-or-the-other. Field-by-field attribute merging is not in scope.
  • Z restoration along the merged boundary is dropped to XY in v1.
  • WFS layers as sources never see Merge - they are read-only.

Requirements

  • A Mapit Pro Plus subscription (Android).
  • Advanced Editing master toggle on in Settings > Advanced Editing.
  • Two existing single-part features on the same polygon or polyline layer.