Skip to content
geoserver is a Go library for manipulating a GeoServer instance via the GeoServer REST API.
Branch: master
Clone or download
Latest commit 13d3743 Nov 21, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
docker improve layergroups test Nov 20, 2018
scripts improve layergroups test Nov 20, 2018
testdata fix docker-compose file Jul 28, 2018
wms add GetCapabilities Sep 18, 2018
.gitignore add get coverage store Nov 20, 2018
.travis.yml remove geoserver 2.12 Nov 20, 2018
Gopkg.lock add dep files Oct 30, 2018
Gopkg.toml add dep files Oct 30, 2018
LICENSE update license Apr 4, 2018 fix format Nov 21, 2018
about.go refactor utils DoGet DoPost,.... Apr 29, 2018
about_test.go improve test coverage part1 Apr 26, 2018
capabilities.go add GetCapabilities Sep 18, 2018
capabilities_test.go add GetCapabilities Sep 18, 2018
catalog.go remove setLogger func and add utils interface Nov 21, 2018
catalog_test.go check if geoserver implemet catalog interface Apr 3, 2018
configuration.go remove extra space from godoc Oct 30, 2018
configuration_test.go improve configuration test Aug 27, 2018
coverage_stores.go add get coverage store Nov 20, 2018
coverage_stores_test.go add get coverage store Nov 20, 2018
datastores.go fix go report card Aug 27, 2018
datastores_test.go improve datastores testing May 15, 2018
docker-compose.yml improve layergroups test Nov 20, 2018
feature_types.go fix bounding box embedding May 10, 2018
feature_types_test.go rename test sample folder May 10, 2018
geoserver.go remove setLogger func and add utils interface Nov 21, 2018
geoserver_test.go remove setLogger func and add utils interface Nov 21, 2018
layergroups.go add delete layer group Nov 20, 2018
layergroups_test.go add delete layer group Nov 20, 2018
layers.go add PublishPostgisLayer Jul 28, 2018
layers_test.go improve PublishPostgisLayer test Jul 28, 2018
logging.go add geoserver logger Mar 31, 2018
styles.go create style if not exists in UploadStyle Aug 27, 2018
styles_test.go create style on styleUpload Aug 27, 2018
utils.go remove setLogger func and add utils interface Nov 21, 2018
utils_test.go improve testing May 25, 2018
vars.go refactor code and return error message in details Apr 29, 2018
workspaces.go fix geoserver workspace service implementation May 11, 2018
workspaces_test.go fix workspace testing May 13, 2018

Go Report Card GitHub license GitHub issues Coverage Status Build Status Documentation GitHub forks GitHub stars Twitter


geoserver Is a Go Package For Manipulating a GeoServer Instance via the GeoServer REST API.

How to install:

  • go get -v
    • now you can import the package from, example:
      import (


  • Create new Catalog (which contains all available operations):
    • gsCatalog := geoserver.GetCatalog("http://localhost:8080/geoserver13/", "admin", "geoserver")
  • Use catalog Methods to Perform a Geoserver REST Operation:
    • Create New workspace:
      created, err := gsCatalog.CreateWorkspace("golang")
      if err != nil {
        fmt.Printf("\nError:%s\n", err)
      output if created:
      INFO[31-03-2018 16:26:35] url:http://localhost:8080/geoserver13/rest/workspaces	response Status=201  
      output if error:
      INFO[31-03-2018 16:26:37] url:http://localhost:8080/geoserver13/rest/workspaces	response Status=401  
      WARN[31-03-2018 16:26:37] <!doctype html><html lang="en"><head><title>HTTP Status 401 – Unauthorized</title><style type="text/css">h1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} h2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} h3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} body {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} b {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} p {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;} a {color:black;} {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 401 – Unauthorized</h1><hr class="line" /><p><b>Type</b> Status Report</p><p><b>Message</b> Workspace &#39;golang&#39; already exists</p><p><b>Description</b> The request has not been applied because it lacks valid authentication credentials for the target resource.</p><hr class="line" /><h3>Apache Tomcat/9.0.6</h3></body></html> 
  • Get Layers through GetLayers take workspace as paramter if empty workspace will be ignored and geoserver will return all public layers
    layers, err := gsCatalog.GetLayers("")
    if err != nil {
      fmt.Printf("\nError:%s\n", err)
    for _, lyr := range layers {
      fmt.Printf("\nName:%s  href:%s\n", lyr.Name, lyr.Href)
    INFO[31-03-2018 19:04:44] url:http://localhost:8080/geoserver13/rest/layers	response Status=200  
    Name:tiger:giant_polygon  href:http://localhost:8080/geoserver13/rest/layers/tiger%3Agiant_polygon.json
    Name:tiger:poi  href:http://localhost:8080/geoserver13/rest/layers/tiger%3Apoi.json
    Name:tiger:poly_landmarks  href:http://localhost:8080/geoserver13/rest/layers/tiger%3Apoly_landmarks.json
    Name:tiger:tiger_roads  href:http://localhost:8080/geoserver13/rest/layers/tiger%3Atiger_roads.json
    Name:nurc:Arc_Sample  href:http://localhost:8080/geoserver13/rest/layers/nurc%3AArc_Sample.json
    Name:nurc:Img_Sample  href:http://localhost:8080/geoserver13/rest/layers/nurc%3AImg_Sample.json
    Name:nurc:Pk50095  href:http://localhost:8080/geoserver13/rest/layers/nurc%3APk50095.json
    Name:nurc:mosaic  href:http://localhost:8080/geoserver13/rest/layers/nurc%3Amosaic.json
  • Get Specific Layer from Geoserver:
    layer, err := gsCatalog.GetLayer("nurc", "Arc_Sample")
    if err != nil {
      fmt.Printf("\nError:%s\n", err)
    } else {
      fmt.Printf("%+v\n", layer)
    INFO[31-03-2018 20:12:07] url:http://localhost:8080/geoserver13/rest/workspaces/nurc/layers/Arc_Sample	response Status=200  
    {Name:Arc_Sample Path:/ Type:RASTER DefaultStyle:{Class: Name:rain Href:http://localhost:8080/geoserver13/rest/styles/rain.json} Styles:{Class:linked-hash-set Style:[{Class: Name:raster Href:http://localhost:8080/geoserver13/rest/styles/raster.json}]} Resource:{Class:coverage Name:nurc:Arc_Sample Href:http://localhost:8080/geoserver13/rest/workspaces/nurc/coveragestores/arcGridSample/coverages/Arc_Sample.json} Queryable:false Opaque:false Attribution:{Title: Href: LogoURL: LogoType: LogoWidth:0 LogoHeight:0}}
  • You can find more examples by check testing files
  • You can find all supported operations on Godocs


Go Version Geoserver Version Tested
1 1.9.x 2.13.x ✔️
2 1.9.x 2.14.x ✔️
3 1.10.x 2.13.x ✔️
4 1.10.x 2.14.x ✔️
5 1.11.x 2.13.x ✔️
6 1.11.x 2.14.x ✔️


You can’t perform that action at this time.