Building a Complete GIS Stack in Rails: ruby-libgd + libgd-gis + map_view

Building a Complete GIS Stack in Rails: 
ruby-libgd + libgd-gis + map_view
Building a Complete GIS Stack in Rails: ruby-libgd + libgd-gis + map_view

April 10, 2026

Over the past few months I’ve been working on a small GIS-oriented stack in Ruby, focused on a simple goal: rendering maps from GeoJSON directly on the server.

It started at a low level, building bindings around libgd:

Article content
  • ruby-libgd (MIT)
  • libgd-gis (MIT)

From there, I added a higher-level layer designed for Rails applications:

  • map_view

The idea is straightforward: take GeoJSON as input and generate a map image as output.

No browser, no JavaScript runtime, and no dependency on external APIs — just rendering maps directly from Ruby.


Where This Fits

In many applications, maps are not limited to interactive frontends.

They often need to appear in:

  • emails with embedded maps
  • PDFs and generated reports
  • API responses
  • background jobs

In these cases, server-side rendering becomes a natural fit.


Working Alongside Existing Tools

Article content


This approach is not meant to replace tools like PostGIS.

If you’re already using it for spatial queries, this can sit on top as a rendering layer:

  • query your data
  • convert it to GeoJSON
  • render the result as an image

Each layer focuses on a specific responsibility.


A Minimal Example

map = MapView.render(
geojson_data,
basemap: :osm,
width: 800,
height: 600
)

The result is an image that can be embedded anywhere: HTML, emails, PDFs, or API responses.


Demo

Article content

A small demo is available here:

You can paste GeoJSON and see how it renders.


Source

ruby-libgd https://github.com/ggerman/ruby-libgd

libgd-gis https://github.com/ggerman/libgd-gis

map_view https://github.com/ggerman/map_view


Conclusion

If you try it and something looks off, feel free to report it — feedback is always welcome.

You can explore the demo to see how it works in practice, and use the gem in your own Rails projects if it fits your needs.

It can also be used as a rendering layer behind an API, with custom styles, basemaps, or branding depending on your use case.

At this stage, it’s a flexible approach to generating maps from GeoJSON — especially when you need full control on the server side.


Article content

Leave a comment