GIS Tools

Language

Made withfor the GIS community

Polygon to Lines Converter

Convert polygon boundaries to line features

Geoprocessing

Drop files here or click to browse

Supported formats: GeoJSON

GeoJSON
Examples:

About Polygon to Lines

  • Extracts the boundary of each polygon as a line
  • Holes (inner rings) can be extracted separately
  • MultiPolygons create multiple lines
  • Useful for network analysis or edge extraction

What Is Polygon to Lines Conversion?

Polygon to Lines conversion extracts the boundary rings of polygon features and outputs them as line (LineString or MultiLineString) geometries. Every polygon has an exterior ring and may have one or more interior rings (holes); the conversion produces line features for each ring, preserving the parent polygon's attributes. The operation is conceptually the inverse of polygon creation from closed lines.

The Polygon to Lines Converter on gis.tools runs in your browser and handles GeoJSON, Shapefile, and KML inputs. Drop a polygon layer, click Convert, and get a clean line layer you can style, buffer, or analyze as linear features. There's no upload, no account, and no server.

This operation is essential whenever you need to work with polygon boundaries as lines β€” for styling, length calculations, network analysis, or feeding into tools that require line inputs.

How Polygon to Lines Works

For each polygon feature, the tool extracts:

  1. The exterior ring as a closed LineString (first and last vertex coincide)
  2. Each interior ring (hole) as a separate closed LineString
  3. For MultiPolygons, all rings from all parts

The output can be configured in two ways:

  • One feature per ring: each ring becomes a separate LineString feature
  • One feature per polygon: all rings from a polygon are combined into a MultiLineString

Attribute preservation means each output line carries the parent polygon's attributes, letting you identify which ring came from which polygon.

Inner vs Outer Ring Tagging

Optionally, the tool can add a ring type field to distinguish exterior rings (outer boundaries) from interior rings (holes). This is useful when you need to treat holes differently downstream, such as buffering only outer boundaries.

Key Parameters and Options

Output Structure

Choose one-feature-per-ring or one-feature-per-polygon.

Include Holes

Toggle whether interior rings (holes) are extracted. Set to false if you only want the outer boundaries.

Add Ring Type Field

Optionally append a column identifying each line as an outer or inner ring.

Practical Applications

Boundary Styling

Map designers sometimes need to style polygon borders with effects (dashed lines, variable width, glow) that work better on line features than on polygon strokes. Converting polygons to lines first gives more styling control.

Perimeter Measurement

Compute perimeter lengths by converting polygons to lines and using a length calculator. While some GIS tools compute perimeter directly, the line-based approach is clearer when you need per-ring lengths (external vs. holes separately).

Network Analysis

Treat administrative boundaries as potential barriers or edges in a network analysis. Converting to lines makes them compatible with line-based routing tools.

Buffer Around Borders

Buffering a line produces a symmetric corridor centered on the border. Buffering a polygon creates an outward-only offset. When you need a symmetric band on both sides of a boundary (e.g., a 100-meter transboundary zone), convert to lines first, then buffer.

Topology Checking

Boundary lines can be fed into intersection and overlap tools to detect topology issues at parcel or administrative seams.

Cartographic Outlines

Extract just the outer rings for a clean country outline layer that draws faster than the full polygon set.

Survey Route Planning

Treat parcel boundaries as routes for field survey crews to walk, converting them to lines for GPS track loading.

Step-by-Step Workflow in gis.tools

  1. Open the Polygon to Lines Converter
  2. Drag a polygon layer (GeoJSON, KML, Shapefile) onto the drop zone
  3. Preview the layer on the map
  4. Choose the output structure (ring-level or polygon-level)
  5. Toggle "Include holes" and "Add ring type field"
  6. Click "Convert"
  7. Inspect the resulting line layer
  8. Export as GeoJSON, KML, or Shapefile

Worked Example

A city GIS analyst needs to produce a map layer of all parcel boundaries so she can style them with a dashed gray line over a satellite basemap. She loads the parcel polygon shapefile (47,000 features) into the Polygon to Lines tool, selects one-feature-per-polygon output, and clicks Convert. The output is 47,000 line features (mostly LineString, some MultiLineString for multipart parcels). She exports to GeoJSON and styles with the Layer Styler to produce the final basemap layer.

Common Pitfalls and Gotchas

  • Ring direction matters for topology: GeoJSON convention is CCW for exterior rings and CW for interior rings. Outputs preserve this, but downstream tools may be confused if the convention is wrong.
  • Closed vs open lines: output rings are closed (first and last vertex identical); some consumers prefer open lines.
  • MultiPolygon handling: all parts produce rings; the output may have more features than the input count.
  • Self-intersecting polygons produce invalid or misleading line output. Fix with Geometry Repair first.
  • Attribute bloat: each output ring duplicates the parent polygon's attributes.
  • Shared boundaries between adjacent polygons produce duplicated lines in the output β€” one line per polygon ring, even if two polygons share it. Dedupe if needed.
  • Very detailed polygons produce very detailed lines; simplify with GeoJSON Simplifier if you only need schematic boundaries.

Tips for Best Results

  • Use one-feature-per-polygon output for the simplest attribute mapping
  • Dedupe shared boundaries if you want a true boundary-edge layer with no duplicates
  • Pair with the GIS Buffer Tool to create symmetric corridors around the converted boundaries
  • Use Simplify Preserving Topology if you need to simplify while keeping shared edges consistent
  • Validate output with GeoJSON Validator & Fixer before exporting

Comparison with Other GIS Approaches

QGIS offers Polygons to Lines under Vector > Geometry Tools. ArcGIS Pro has Feature to Line in Data Management (which also handles shared-edge deduplication). PostGIS has ST_Boundary and ST_ExteriorRing. Turf.js has turf.polygonToLine. The browser-based gis.tools converter is the fastest path for interactive work without a GIS install.

Performance Considerations

The conversion is O(n) where n is total vertex count. Even large layers convert in milliseconds. Memory use scales linearly with input size, so multi-hundred-megabyte GeoJSON files may be slower to load than to convert.

Data Privacy and Browser-Based Processing

Your polygon data never leaves your browser. The conversion is computed locally and exported locally.

Related GIS Concepts

Boundary is the formal term for the edge of a polygon β€” the output of ST_Boundary in PostGIS. Rings are the closed linestrings that make up a polygon; a polygon has one exterior ring and zero or more interior rings (holes). Topology tracks shared edges between adjacent polygons so they can be edited consistently. Feature to line with shared-edge detection is ArcGIS's dedup-aware variant.

Frequently Asked Questions

Do I get one line per polygon or one per ring?

Both modes are available β€” the default is one feature per polygon with a MultiLineString for multipart outputs.

Can I skip interior holes?

Yes β€” toggle "Include holes" off to produce only outer boundaries.

Will adjacent polygons produce duplicate boundary lines?

Yes by default; use a dedupe step or a topology-aware converter to eliminate duplicates.

Does the conversion preserve attributes?

Yes β€” each output line carries the parent polygon's attributes.

Related Tools on gis.tools

100% client-side processing - your data stays private and never leaves your device