ProductPromotion
Logo

Go.Lang

made by https://0x3d.site

GitHub - hishamkaram/geoserver: geoserver is a Go library for manipulating a GeoServer instance via the GeoServer REST API.
geoserver is a Go library for manipulating a GeoServer instance via the GeoServer REST API. - hishamkaram/geoserver
Visit Site

GitHub - hishamkaram/geoserver: geoserver is a Go library for manipulating a GeoServer instance via the GeoServer REST API.

GitHub - hishamkaram/geoserver: geoserver is a Go library for manipulating a GeoServer instance via the GeoServer REST API.

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

Geoserver

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


How to install:

  • go get -v gopkg.in/hishamkaram/geoserver.v1
    • now you can import the package from gopkg.in/hishamkaram/geoserver.v1, example:
      import (
        ...
        "gopkg.in/hishamkaram/geoserver.v1"
        ...
      )
      

usage:

  • 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)
      }
      fmt.Println(strconv.FormatBool(created))
      
      output if created:
      INFO[31-03-2018 16:26:35] url:http://localhost:8080/geoserver13/rest/workspaces	response Status=201  
      true
      
      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;} a.name {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> 
      
      Error:Unauthorized
      false
      
  • 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)
    }
    
    output:
    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)
    }
    
    output:
    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

TESTING

Go Version Geoserver Version Tested
1 1.13.x 2.13.x :heavy_check_mark:
2 1.13.x 2.14.x :heavy_check_mark:
3 1.14.x 2.13.x :heavy_check_mark:
4 1.14.x 2.14.x :heavy_check_mark:
5 1.15.x 2.13.x :heavy_check_mark:
6 1.15.x 2.14.x :heavy_check_mark:

Documentation

Articles
to learn more about the golang concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

Queries
or most google FAQ's about GoLang.

mail [email protected] to add more queries here ๐Ÿ”.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory