Skip to content

Commit

Permalink
improve godocs
Browse files Browse the repository at this point in the history
  • Loading branch information
hisham waleed karam committed Oct 29, 2018
1 parent e155bd3 commit 767f2c3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
3 changes: 2 additions & 1 deletion datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package gismanager

import "fmt"

//DatastoreConfig configuration
type DatastoreConfig struct {
Host string `yaml:"host"`
Port uint `yaml:"port"`
Expand All @@ -11,7 +12,7 @@ type DatastoreConfig struct {
Name string `yaml:"name"`
}

//BuildConnectionString return gdal postgres connection as string
//BuildConnectionString return GDAL postgres connection as string
func (ds *DatastoreConfig) BuildConnectionString() string {
return fmt.Sprintf("PG: host=%s port=%d dbname=%s user=%s password=%s", ds.Host, ds.Port, ds.DBName, ds.DBUser, ds.DBPass)
}
Expand Down
10 changes: 5 additions & 5 deletions layer.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ type GdalLayer struct {
*gdal.Layer
}

//LayerField Field
//LayerField Layer Field
type LayerField struct {
Name string
Type string
}

//PublishGeoserverLayer publish Layer to postgis
//PublishGeoserverLayer Publish Layer to Geoserver instance
func (manager *ManagerConfig) PublishGeoserverLayer(layer *GdalLayer) (ok bool, err error) {
catalog := manager.GetGeoserverCatalog()
workspaceExists, _ := catalog.WorkspaceExists(manager.Geoserver.WorkspaceName)
Expand Down Expand Up @@ -89,6 +89,9 @@ func (layer *GdalLayer) LayerToPostgis(targetSource *gdal.DataSource, manager *M
func (layer *GdalLayer) GetGeomtryName() (geometryName string) {
geom := gdal.Create(layer.Layer.Type())
geometryName = geom.Name()
if len(geometryName) == 0 {
geometryName = "geom"
}
return
}

Expand All @@ -97,9 +100,6 @@ func (layer *GdalLayer) GetLayerSchema() (fields []*LayerField) {
if layer.Layer != nil {
layerDef := layer.Layer.Definition()
geomName := layer.Layer.GeometryColumn()
if len(geomName) == 0 {
geomName = "geom"
}
geomField := LayerField{
Name: geomName,
Type: layer.GetGeomtryName(),
Expand Down
6 changes: 3 additions & 3 deletions manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ type ManagerConfig struct {
logger *logrus.Logger
}

//GetGeoserverCatalog publish return geoserver Catalog
//GetGeoserverCatalog return geoserver Catalog instance to deal with geoserver
func (manager *ManagerConfig) GetGeoserverCatalog() *gsconfig.GeoServer {
gsCatalog := gsconfig.GetCatalog(manager.Geoserver.ServerURL, manager.Geoserver.Username, manager.Geoserver.Password)
return gsCatalog
}

//OpenSource open data source from path
//OpenSource open data source from a given Path and access permission 0/1
func (manager *ManagerConfig) OpenSource(path string, access int) (source *gdal.DataSource, ok bool) {
driver, err := manager.GetDriver(path)
if err != nil {
Expand All @@ -51,7 +51,7 @@ func (manager *ManagerConfig) OpenSource(path string, access int) (source *gdal.
return
}

//GetDriver return the proper driver based on file path
//GetDriver return the proper driver based on file path/database connection
func (manager *ManagerConfig) GetDriver(path string) (driver gdal.OGRDriver, err error) {
if pgRegex.MatchString(path) {
driver = gdal.OGRDriverByName(postgreSQLDriver)
Expand Down
2 changes: 1 addition & 1 deletion utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
yaml "gopkg.in/yaml.v2"
)

//FromConfig load geoserver config from yaml file
//FromConfig load GIS Manager config from yaml file
func FromConfig(configFile string) (config *ManagerConfig, err error) {
gpkgConfig := ManagerConfig{}
gpkgConfig.logger = GetLogger()
Expand Down

0 comments on commit 767f2c3

Please sign in to comment.