After rendering a map, libgd-gis exposes the underlying GD::Image instance through
map.image. This allows you to post-process the rendered map using the full power of
ruby-libgd.
This design cleanly separates:
map.render
img = map.image
img is a GD::Image object and supports all ruby-libgd operations.
map.imageOnce you have access to the image, you can:
img = map.image
font = "../fonts/DejaVuSans-Bold.ttf"
img.filled_rectangle(24, 24, 264, 88, [0, 0, 0])
img.text(
"TOKYO",
x: 48,
y: 68,
size: 32,
color: [255, 255, 255],
font: font
)
img.save("tokyo.png")
map.image complements overlay methods such as:
add_pointsadd_linesadd_polygonsUse overlays for geographic data, and map.image for pure image manipulation.
map.image returns a GD::Image
