CI Coverage Status

Simple client for publishing Shapefiles and GeoTIFFs to Geoserver.


Add this line to your application's Gemfile:

gem 'geoserver-publish'

And then execute:

$ bundle

Or install it yourself as:

$ gem install geoserver-publish



Geoserver::Publish.geotiff(workspace_name: "public", file_path: "file:///path/on/geoserver/raster.tif", id: "1234", title: "GeoTiff Title")


Because of a limitation in GeoServer, the layer id must be the same name as the shapefile without the extenstion. For example, if the file name is 1234.shp, the id must be 1234.

Geoserver::Publish.shapefile(workspace_name: "public", file_path: "file:///path/on/geoserver/1234.shp", id: "1234", title: "Shapefile Title")


Geoserver::Publish.delete_geotiff(workspace_name: "public", id: "1234")
Geoserver::Publish.delete_shapefile(workspace_name: "public", id: "1234")


For users wanting to publish styles, this can be done using the GeoServer styles API. "raster_layer", filename: "raster_layer.sld")
sld ="./spec/fixtures/files/payload/raster_layer.sld") "raster_layer", filename: "raster_layer.sld", payload: sld)


The GeoWebCache REST API can also be used. Note: there is usually a different url that is used.

c ={"url" => "http://localhost:8080/geoserver/gwc/rest", "user"=>"admin",
"password"=>"geoserver"}) 'nurc:Pk50095')



To use the default GeoServer connection parameters, no further configuration is needed. These are useful for testing and development against a local GeoServer instance.

Environment Variables

GeoServer Connection parameters can be set using environment variables.


Connection Object

A connection object can be instantiated with a parameter hash and passed into publishing methods.

new_conn ={"url"=> "", "user" => "admin_user", "password" => "supersecret"})
Geoserver::Publish.geotiff(connection: new_conn, workspace_name: "public", file_path: "file:///path/on/geoserver/raster.tif", id: "1234", title: "GeoTiff Title")


After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.


Bug reports and pull requests are welcome on GitHub at

If you're working on a PR for this project, create a feature branch off of main.

This repository follows the Samvera Community Code of Conduct and language recommendations. Please do not create a branch called master for this repository or as part of your pull request; the branch will either need to be removed or renamed before it can be considered for inclusion in the code base and history of this repository.