The add_points method allows you to render point-based data (POIs, markers, labels)
directly on a map using Ruby hashes or objects, without requiring a GeoJSON file.
It is ideal for locations, places, annotations, and dynamic point overlays.
pois = [
{
"name" => "Home",
"lon" => HOME[0],
"lat" => HOME[1]
}
]
map.add_points(
pois,
lon: ->(r){ r["lon"] },
lat: ->(r){ r["lat"] },
label: ->(r){ r["name"] },
icon: nil,
font: "DejaVuSans.ttf",
size: 20
)
pois (required)An array of hashes or objects representing points of interest.
lonlon: ->(row){ row["lon"] }
Lambda used to extract longitude from each record.
latlat: ->(row){ row["lat"] }
Lambda used to extract latitude from each record.
labellabel: ->(row){ row["name"] }
Text label rendered next to the point.
iconicon: nil
Optional icon for the point. When nil, only the label (or default marker) is rendered.
fontfont: "/path/to/font.ttf"
Absolute path to a TrueType (.ttf) font file used for rendering labels.
sizesize: 20
Font size in pixels.
map.render
map.save("output/points.png")
add_points does not depend on YAML styles.