library(gePoints)
library(readr)
labeled <- read_csv(
"text, lat, lon
Summit, 35.4, -111.6
Base camp, 35.2, -111.6
Trailhead, 35.0, -111.6"
)
create_kml(labeled, "labeled_points.kml")3 Text Labels
Every marker in Google Earth can display a text label — the name that floats next to the icon on the map. gePoints controls labels through the text, text_color, and text_scale columns.
3.1 The text column
The text column provides the visible label. If omitted, markers appear without labels — useful for dense point clouds where labels would overlap, though less common in practice.
3.2 Text color
The text_color column sets label color. The default is white, which reads well against dark terrain and satellite imagery. Available colors are the same as marker colors (see Chapter 2).
Against light backgrounds — snow, sand, urban areas — white labels disappear. Switching to black or a dark color solves this:
contrast <- read_csv(
"text, lat, lon, text_color
On dark terrain, 35.0, -111.5, white
On light terrain, 35.1, -111.3, black"
)
create_kml(contrast, "text_colors.kml")In KML, colors are specified in ABGR (alpha-blue-green-red) hex format. The gePoints package handles this conversion internally through get_abgr_color(), so you work with color names rather than hex codes.
3.3 Text scaling
The text_scale column controls label size. The default is 1.0. Smaller values (0.6–0.8) reduce clutter when many points are close together. Larger values (1.2–1.5) make labels legible at wider zoom levels.
scaling <- read_csv(
"text, lat, lon, text_scale
Small label, 35.0, -111.6, 0.6
Normal label, 35.2, -111.6, 1.0
Large label, 35.4, -111.6, 1.5"
)
create_kml(scaling, "text_scales.kml")3.4 Combining text and marker styles
Text and marker styling are independent. You can set colors, scales, and symbol types for both markers and labels in the same data frame:
combined <- read_csv(
"text, lat, lon, color, symbol, symbol_scale, text_color, text_scale
Primary, 35.0, -111.6, red, pushpin, 1.5, yellow, 1.2
Secondary, 35.2, -111.6, blue, pushpin, 1.2, white, 1.0
Reference, 35.4, -111.6, green, paddle, 1.0, green, 0.8"
)
create_kml(combined, "full_styling.kml")The resulting KML file encodes site hierarchy visually: the primary site has a large red pushpin with a bold yellow label, secondary sites are standard blue pushpins with white text, and reference points are small green paddles with subdued labels.