BYTETOOLS

KML Polygon Best Practices and Pitfalls to Avoid

The secret to a clean KML polygon is entering vertices in strict perimeter order, letting the tool close the ring for you, and using low-opacity aabbggrr fills so the boundary reads over the map. Most broken polygons trace back to just a handful of avoidable errors. This is a best-practices reference for people who already build polygons and want them to render correctly the first time in Google Earth, My Maps or QGIS.

Vertex order is everything

A polygon is defined by the sequence of its corners, so the single most important habit is entering vertices in the order you would walk the perimeter β€” all the way around, without jumping across the shape. Skip that order and you get a self-intersecting "bow-tie": two lobes that cross in the middle and fill unpredictably, with parts of the interior left blank.

  • Walk the boundary. Pick a starting corner and add each neighboring corner in turn, clockwise or counter-clockwise, until you return to the start.
  • Prefer counter-clockwise for outer rings. The KML spec and most GIS conventions expect the outer boundary counter-clockwise. Google Earth is forgiving, but staying consistent avoids surprises when you later convert to GeoJSON.
  • Don't repeat the first point manually. This generator closes the ring automatically per the KML spec. Adding the closing vertex yourself creates a duplicate that some strict parsers flag.

Color and opacity done right

KML colors are eight hex digits in aabbggrr order β€” alpha, blue, green, red β€” the reverse of the web's rrggbb. The classic mistake is a fully opaque fill that hides the imagery you are annotating.

ElementSuggested aabbggrrWhy
Outlineff0000ffSolid red line, fully visible boundary
Fill4d00ff00~30% green, map shows through
Highlight zone66ff0000~40% blue for emphasis

Keep the outline opaque and the fill translucent. For overlays that stack (zones inside zones), lower the fill alpha further so intersections stay legible.

Coordinate precision and common data errors

Boundaries are only as good as the coordinates you feed them. Watch for these:

  • Swapped lat/lon. If the polygon lands in the wrong country, you likely transposed the values. Latitude is the Β±90 number, longitude the Β±180 number.
  • Truncated decimals. Dropping decimal places moves corners meters or more. For property lines keep at least five to six decimal places of precision.
  • Mixed formats. The tool accepts decimal degrees and DMS, but be consistent within a survey. When copying DMS from a document, include the hemisphere letters so a southern or western point isn't read as positive.

When you have dozens of dense vertices, hand-typing invites transcription errors β€” converting an existing file with the GeoJSON to KML tool is safer than retyping a long outline.

Troubleshooting a polygon that renders wrong

If the fill looks scrambled, you almost certainly have an out-of-order vertex creating a self-intersection β€” reorder the offending corner. If the shape is invisible, check that the fill alpha isn't 00 and that at least three distinct vertices were entered. If My Maps shows nothing after import, confirm you used the layer's Import option and selected the .kml itself, and that its extension wasn't changed to .kml.txt on download. For a polygon that looks right in Earth but breaks elsewhere, run it through a KML-to-GeoJSON conversion and validate β€” strict tools surface ring problems Earth silently tolerates.

Try the KML Polygon Generator β€” free and 100% in your browser.

FAQ

Why does my polygon fill only part of the shape?

That's the signature of a self-intersecting ring. One vertex is out of perimeter order, so the outline crosses itself and the fill algorithm can't decide what's inside. Reorder vertices to follow the boundary continuously.

Should outer rings be clockwise or counter-clockwise?

Convention and the KML spec favor counter-clockwise for outer boundaries. Google Earth renders either direction, but staying counter-clockwise avoids ambiguity when you later convert to GeoJSON or load into strict GIS tools.

How many decimal places should coordinates have?

Five decimals give roughly one-meter precision and six give about ten centimeters. For property or survey boundaries keep five to six; fewer than that visibly shifts corners.

My colors look wrong β€” what's the fix?

You probably wrote the color in web rrggbb order. KML wants aabbggrr, so reverse the color bytes and put the two alpha digits first: opaque red is ff0000ff, not ffff0000.

Related free tools

Built by ByteVancer

ByteTools is a free product of ByteVancer, a software and web development studio building web apps, SaaS and custom software. If your team needs custom mapping, boundary management or geospatial tooling, explore how ByteVancer can build it.