geoserver is a Go library for manipulating a GeoServer instance via the GeoServer REST API.

Overview

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.11.x 2.13.x ✔️
2 1.11.x 2.14.x ✔️
3 1.12.x 2.13.x ✔️
4 1.12.x 2.14.x ✔️
5 1.13.x 2.13.x ✔️
6 1.13.x 2.14.x ✔️

Documentation

Issues
  • A lot of missing methods was implemented including commands to control user, group, roles, acl etc

    A lot of missing methods was implemented including commands to control user, group, roles, acl etc

    Hello, this is PR where a lot of missing methods was implemented :

    • Methods to control users, groups, roles, and acl commands (create, delete)
    • Method to create new FeatureType (for datastorages like postgress etc)
    • Method to create Postgis JNDI datastorage connection
    • DatastoreConnection struct was expanded with Options field allowing set additional datastorage options like "max connections", "Expose primary keys" etc
    • Some broken tests were fixed or rewritten
    • Testing environment configuration was moved to .yml file
    opened by mandalorian-one 3
  • I have some problem,when i want to get layerGroups data by your api

    I have some problem,when i want to get layerGroups data by your api

    i can't find get layerGroup's method, in your code. but i have fix it now by learning your code, thank you very much

    `

        type Group struct {
            Type string `json:"@type,omitempty" xml:"type"`
            Name string `json:"name,omitempty" xml:"name"`
            Href string `json:"href,omitempty" xml:"href"`
        }
        type LayerGroup struct {
            Name      string `json:"name" xml:"name"`
            Mode      string `json:"mode" xml:"mode"`
            Title     string `json:"title" xml:"title"`
            Workspace struct {
    	        Name string `json:"name" xml:"name"`
            } `json:"workspace" xml:"workspace"`
            Publishables struct {
    	        Published []*Group `json:"published" xml:"published"`
            } `json:"publishables" xml:"publishables"`
            Styles struct {
    	        Style []*Group `json:"style" xml:"style"`
            } `json:"styles" xml:"styles"`
            Bounds struct {
    	        MinX float64 `json:"minx" xml:"minx"`
    	        MinY float64 `json:"miny" xml:"miny"`
    	        MaxX float64 `json:"maxx" xml:"maxx"`
    	        MaxY float64 `json:"maxy" xml:"maxy"`
    	        Crs  string  `json:"crs" xml:"crs"`
            } `json:"bounds" xml:"bounds"`
        }
    
        type LayerGroups struct {
            LayerGroup LayerGroup `json:"layerGroup" xml:"layerGroup"`
        }
        target := utils.Catalog.ParseURL("rest", "workspaces", workspace.Name, "layergroups", "xxxx")
    request := geoserver.HTTPRequest{
    	Method: "GET",
    	Accept: "application/json",
    	URL:    target,
    	Query:  nil,
    }
    response, code := utils.Catalog.DoRequest(request)
    if code != http.StatusOK {
    	utils.Logger.Error("get layer groups error", zap.Int("error code", code))
    	c.JSON(http.StatusInternalServerError, utils.BaseResponse(http.StatusInternalServerError, "internal server error", c.Request.RequestURI, nil))
    	return
    }
    var groups defs.LayerGroups
    utils.Catalog.DeSerializeJSON(response, &groups)
    server := &defs.Server{
    	BaseServiceUrl: utils.Catalog.ParseURL(workspace.Name, "wms?"),
    	Layers:         fmt.Sprintf("%s:%s", groups.LayerGroup.Workspace.Name, groups.LayerGroup.Name),
    	TilematrixSet:  groups.LayerGroup.Bounds.Crs,
    }
    

    `

    New Feature in-progress 
    opened by 0x2d3c 3
  • Allowed schema to be changed in DatastoreConnection

    Allowed schema to be changed in DatastoreConnection

    I have added a DBSchema field to the DatastoreConnection so created Datastores can use a specific schema.

    I've added some conditional logic in CreateDatastore such that if DBSchema is not set, it will default to public.

    I haven't implemented retrieving this information in GET requests etc. so may need some more consideration.

    opened by deltabrot 2
  • Cannot Customize http client

    Cannot Customize http client

    If I try to connect to a geoserver with a self-signed cert geoserver fails. I suggest a way to customize the http client that the Geoserver struct is using. Currently it is unexported and I dont see a way to use a custom client if needed.

    bug 
    opened by alienatorZ 2
  • i found you forgot a method about GetCoverageStore,right?

    i found you forgot a method about GetCoverageStore,right?

    func (g *GeoServer) GetCoverageStore(workspaceName, gridName string) (coverageStore *CoverageStore, err error) {
    	targetURL := g.ParseURL("rest", "workspaces", workspaceName, "coveragestores", gridName)
    	httpRequest := HTTPRequest{
    		Method: getMethod,
    		Accept: jsonType,
    		URL:    targetURL,
    		Query:  nil,
    	}
    	response, responseCode := g.DoRequest(httpRequest)
    	if responseCode != statusOk {
    		g.logger.Error(string(response))
    		coverageStore = nil
    		err = g.GetError(responseCode, response)
    		return
    	}
    	var coverageStoreResponse struct {
    		CoverageStore *CoverageStore
    	}
    	g.DeSerializeJSON(response, &coverageStoreResponse)
    	coverageStore = coverageStoreResponse.CoverageStore
    	return
    }
    
    enhancement in-progress 
    opened by 0x2d3c 2
  • Set of methods to work with raster layers (coverages)

    Set of methods to work with raster layers (coverages)

    There are a set of methods to work with raster layers, including:

    • get a list of raster layers (coverages): GetCoverages
    • get a list of raster layers in the coverageStore, including unpublished layers: GetStoreCoverages
    • get raster layer structure (coverage): GetCoverage
    • delete and update raster layer: DeleteCoverage, UpdateCoverage
    • publishing the raster layer from the coverageStore: PublishCoverage

    PublishGeoTiffLayer is refactored and moved from layers.go to coverages.go because this is a more suitable place for raster layers methods

    Tests for all these methods were also implemented

    opened by mandalorian-one 1
  • Implemented coveragestore coverages endpoint to allow the publishing of GeoTIFF layers

    Implemented coveragestore coverages endpoint to allow the publishing of GeoTIFF layers

    In fairness, this was a pretty rushed effort in an attempt to get some desired functionality out of your repo. However I've tried to stick to your conventions.

    opened by deltabrot 1
  • Updated error logging

    Updated error logging

    Background

    This PR contains small fixes for error logging.

    What have changed

    • Removed debug logging using fmt.Printf
    • Added status code logging into error message
    opened by FedorZaytsev 1
  • AMP changes

    AMP changes

    I'm afraid this PR is a bit messy. At this point I am mostly hoping to get an indication of interest for the changes in here. If there is interest we can work on cleaning things up and creating a a set of smaller PRs for individual changes.

    This PR is a collection of changes that have been made by the AMP team in Woven Planet to help us configure geoserver clusters. The changes include:

    • support for additional endpoints
    • a couple of bugfixes
    • some code cleanup (gitignore, use stdlib http status, use of go modules
    • simpify the docker container
    opened by wichert 4
Releases(v1)
Owner
Hisham waleed karam
A highly focused software developer. Organised, methodical and a keen eye for detail results in solid coding and trustworthy software programmes.
Hisham waleed karam
Geometry/geography library in Go, DEPRECATED, use ->

go.geo (deprecated) Go.geo is a geometry/geography library in Go. The primary use case is GIS geometry manipulation on the server side vs. in the brow

Paul Mach 319 Jun 24, 2022
Go bindings for the Cartographic Projections Library PROJ.4

The Go package proj provides a limited interface to the Cartographic Projections Library PROJ. For PROJ version 5 and beyond, see also: https://github

Peter Kleiweg 41 Dec 8, 2021
General purpose library for reading, writing and working with OpenStreetMap data

osm This package is a general purpose library for reading, writing and working with OpenStreetMap data in Go (golang). It has the ability to read OSM

Paul Mach 213 Jun 23, 2022
Go (golang) wrapper for GDAL, the Geospatial Data Abstraction Library

------------- About ------------- The gdal.go package provides a go wrapper for GDAL, the Geospatial Data Abstraction Library. More information about

null 223 Jul 1, 2022
S2 geometry library in Go

Overview S2 is a library for spherical geometry that aims to have the same robustness, flexibility, and performance as the best planar geometry librar

Go 1.4k Jun 27, 2022
A library provides spatial data and geometric algorithms

Geoos Our organization spatial-go is officially established! The first open source project Geoos(Using Golang) provides spatial data and geometric alg

spatial-go 527 Jun 22, 2022
Efficient 2D geometry library for Go.

geometry An efficient 2D geometry library for Go. Features Point, Rect, Line, and Polygon geometry types Operations such as Intersects, Contains, and

Josh Baker 27 Mar 30, 2022
geoserver is a Go library for manipulating a GeoServer instance via the GeoServer REST API.

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/g

Hisham waleed karam 74 Jun 16, 2022
Lxc instance launcher and lxc instance management

This project consists of two components: lxc instance launcher. lxc instance management.

zhangjianjun 0 Dec 13, 2021
A simple and lightweight library for creating, formatting, manipulating, signing, and validating JSON Web Tokens in Go.

GoJWT - JSON Web Tokens in Go GoJWT is a simple and lightweight library for creating, formatting, manipulating, signing and validating Json Web Tokens

Toby 5 Feb 7, 2022
Webserver I built to serve Infura endpoints. Deployable via k8s and AWS EKS. Load testable via k6 tooling, and montiorable via prometheus and grafana

Infura Web Server Welcome to my verion of the take home project. I've created a webserver written in go to serve Infura api data over 3 possible data

Jacob Elias 2 Jun 2, 2022
CLI tool for manipulating GitHub Labels across multiple repositories

takolabel Installation Mac $ brew install tommy6073/tap/takolabel Other platforms Download from Releases page in this repository. Usage Set variables

Takayuki NAGATOMI 9 Feb 16, 2022
CLI tool for manipulating Ceph's upmap exception table.

pgremapper When working with Ceph clusters, there are actions that cause backfill (CRUSH map changes) and cases where you want to cause backfill (movi

DigitalOcean 21 Jun 14, 2022
jt is a CLI tool for viewing and manipulating JIRA issues.

jt - jira-tool jt is a CLI tool for viewing and manipulating JIRA issues. One common example usage to transition an issue to a new status: jt "In Prog

Steve Coffman 13 May 9, 2022
A GREAT GUI Offline Tool for manipulating/seeking resolver list of repique and dnscrypt proxy.

Intro A GUI Offline Tool for decrypting and manipulating *.md files used by repique and dnscrypt proxy It's targeted for creating your own DoT, DoH an

null 4 Feb 4, 2022
Publish Your GIS Data(Vector Data) to PostGIS and Geoserver

GISManager Publish Your GIS Data(Vector Data) to PostGIS and Geoserver How to install: go get -v github.com/hishamkaram/gismanager Usage: testdata fol

Hisham waleed karam 45 Jun 16, 2022
Publish Your GIS Data(Vector Data) to PostGIS and Geoserver

GISManager Publish Your GIS Data(Vector Data) to PostGIS and Geoserver How to install: go get -v github.com/hishamkaram/gismanager Usage: testdata fol

Hisham waleed karam 45 Jun 16, 2022
Books-rest api - Simple CRUD Rest API architecture using postgresql db with standard Library

books-rest_api Simple CRUD Rest API architecture using postgresql db with standa

Edho Guntur Adhitama 2 Feb 8, 2022
Simple mock program to set charging rate of a battery instance based on the national grid intensity api

Charger Simple mock program to set charging rate of a battery instance based on the national grid intensity api. Steps to get up and running I have cr

Taj 0 Nov 16, 2021
Go (Golang) API REST with Gin FrameworkGo (Golang) API REST with Gin Framework

go-rest-api-aml-service Go (Golang) API REST with Gin Framework 1. Project Description Build REST APIs to support AML service with the support of exte

Tony Aizize 1 Nov 21, 2021
Lightweight Cloud Instance Contextualizer

Flamingo Flamingo is a lightweight contextualization tool that aims to handle initialization of cloud instances. It is meant to be a replacement for c

Tamer Tas 36 Jun 18, 2022
CLI for exploring AWS EC2 Spot inventory. Inspect AWS Spot instance types, saving, price, and interruption frequency.

spotinfo The spotinfo is a command-line tool that helps you determine AWS Spot instance types with the least chance of interruption and provides the s

Alexei Ledenev 62 Jun 21, 2022
Spin up a local instance of an Avalanche network to interact with the standard APIs or to test a custom VM

ava-sim ava-sim makes it easy for anyone to spin up a local instance of an Avalanche network to interact with the standard APIs or to test a custom VM

Ava Labs 26 May 19, 2022
Freaking simple AWS Reserved Instance and Usage coverage report

richeck This tool allows you to simply see the EC2 and ElastiCache nodes you have reserved on amazon. Motivation: How many instances are currently res

Oğuzhan YILMAZ 10 Oct 17, 2021
A Micro-UTP, plug-able sanity checker for any on-prem JFrog platform instance

hello-frog About this plugin This plugin is a template and a functioning example for a basic JFrog CLI plugin. This README shows the expected structur

rdar 0 Dec 7, 2021
This is a simple test application that sends fake video data from one pion instance to another

Pion test app for BWE This is a simple test application that sends fake video data from one pion instance to another. It is a modified version of the

Mathis Engelbart 2 Jun 8, 2022
Launch & use a graviton instance in 5 seconds.

gravitonctl Launch & use a graviton instance in 5 seconds. Usage: To start (and connect to) a Graviton instance: gravitonctl start {name} To connect

Mathis Van Eetvelde 2 Feb 16, 2022
This plugin will analyse the JFrog Platform instance and provide the non conformance against the best practices based on the predefines rules.

hello-frog About this plugin This plugin is a template and a functioning example for a basic JFrog CLI plugin. This README shows the expected structur

null 0 Nov 30, 2021
Simulate which EC2 instances applied reserved instance.

Go - Reserved Instance Simulator (gori-simulator) Usage $ env AWS_PROFILE=YOUR_PROFILE ./gori-simulator Notices Convertible only (not Standard) Regio

Kazuki Ueki 0 Dec 5, 2021