libgd-gis offers a powerful native GIS and map-rendering engine for Ruby, leveraging the capabilities of ruby-libgd. It simplifies the process of generating map images and geospatial visuals directly from latitude/longitude or GeoJSON data, eliminating dependence on external map services and image pipelines.
libgd-gis is a native GIS and map-rendering engine for Ruby that leverages the powerful libgd library. This tool enables developers to generate map images, tiles, and geospatial visualizations directly from latitude and longitude data or GeoJSON files, all without the need for external map servers or image processing pipelines.
To create a map using libgd-gis, the following Ruby code illustrates the basic setup:
require "gd/gis"
map = GD::GIS::Map.new(
bbox: [-58.45, -34.7, -58.35, -34.55],
zoom: 13,
basemap: :carto_light,
width: 1024,
height: 768
)
map.add_geojson("data/roads.geojson")
map.add_geojson("data/water.geojson")
map.render
map.save("map.png")
This code initializes a map centered on a specified bounding box, adds layers from GeoJSON data, and saves the rendered output.
libgd-gis comes with a wide range of predefined geographic areas that can be utilized directly within various functionalities. For example:
map = GD::GIS::Map.new(
bbox: :argentina,
zoom: 5,
width: 800,
height: 600,
basemap: :osm
)
libgd-gis is ideal for developers seeking a straightforward solution for integrating mapping capabilities within Ruby applications. With its robust feature set and ease of use, this library presents a powerful option for generating custom maps and geospatial visualizations.
No comments yet.
Sign in to be the first to comment.