All Projects → hishamkaram → gismanager

hishamkaram / gismanager

Licence: MIT license
Publish Your GIS Data(Vector Data) to PostGIS and Geoserver

Programming Languages

go
31211 projects - #10 most used programming language
shell
77523 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to gismanager

Geography for hackers
Geography for Hackers - Teaching all how to hack geography, use GIS, and think spatially
Stars: ✭ 25 (-44.44%)
Mutual labels:  gis, postgis, gdal
Geotrek-admin
Paths management for National Parks and Tourism organizations
Stars: ✭ 103 (+128.89%)
Mutual labels:  gis, postgis
GeoFuse
Thematic Engine for Dynamic CSV or Tab Delimited Data
Stars: ✭ 15 (-66.67%)
Mutual labels:  gis, geoserver
geoserver-rest
Python library for management for geospatial data in GeoServer. The geoserver-rest docs is available here,
Stars: ✭ 119 (+164.44%)
Mutual labels:  geoserver, gdal
mapserver-docker
Mapserver OGR GDAL PostGIS WMS WCS WFS with Lighttpd in Docker
Stars: ✭ 18 (-60%)
Mutual labels:  postgis, gdal
deegree3
Official deegree repository providing geospatial core libraries, data access and advanced OGC web service implementations
Stars: ✭ 118 (+162.22%)
Mutual labels:  gis, osgeo
mergin-db-sync
A tool for two-way synchronization between Mergin and a PostGIS database
Stars: ✭ 29 (-35.56%)
Mutual labels:  gis, postgis
Earthenterprise
Google Earth Enterprise - Open Source
Stars: ✭ 2,425 (+5288.89%)
Mutual labels:  gis, gdal
twkb
A small GO parser for the TWKB format
Stars: ✭ 17 (-62.22%)
Mutual labels:  gis, postgis
geosapi
R interface to GeoServer REST API
Stars: ✭ 26 (-42.22%)
Mutual labels:  gis, geoserver
osm-export-tool-python
command line tool + Python library for exporting OSM in various file formats.
Stars: ✭ 32 (-28.89%)
Mutual labels:  gis, gdal
QWAT
TEKSI Water module (project QWAT) - QGIS project
Stars: ✭ 52 (+15.56%)
Mutual labels:  gis, postgis
GeoArrays.jl
Simple geographical raster interaction built on top of ArchGDAL, GDAL and CoordinateTransformations
Stars: ✭ 42 (-6.67%)
Mutual labels:  gis, gdal
lopocs
Migrated to: https://gitlab.com/Oslandia/lopocs
Stars: ✭ 78 (+73.33%)
Mutual labels:  gis, postgis
krawler
A minimalist (geospatial) ETL
Stars: ✭ 51 (+13.33%)
Mutual labels:  postgis, gdal
batyr
Microservice for on-demand synchronization of geographical vector datasources to a PostgreSQL/PostGIS database. The service provides an HTTP API for easy integration into other applications.
Stars: ✭ 25 (-44.44%)
Mutual labels:  gis, gdal
cloud-tileserver
Serve mapbox vectortiles via AWS stack
Stars: ✭ 48 (+6.67%)
Mutual labels:  gis, postgis
Rioxarray
geospatial xarray extension powered by rasterio
Stars: ✭ 148 (+228.89%)
Mutual labels:  gis, gdal
Agstoshapefile
Convert ArcGIS Server Dynamic Map Service to GeoJSON and Shapefile
Stars: ✭ 172 (+282.22%)
Mutual labels:  gis, gdal
geojson-to-wfs-t-2
A lightweight javascript module to format WFS-T-2 statements from GeoJSON features
Stars: ✭ 21 (-53.33%)
Mutual labels:  gis, geoserver

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

GISManager

Publish Your GIS Data(Vector Data) to PostGIS and Geoserver

  • How to install:
    • go get -v github.com/hishamkaram/gismanager
  • Usage:
    • testdata folder content:
      ./testdata/
      ├── neighborhood_names_gis.geojson
      ├── nested
      │   └── nyc_wi-fi_hotspot_locations.geojson
      ├── sample.gpkg
      
    • create ManagerConfig instance:
      manager:= gismanager.ManagerConfig{
        Geoserver: gismanager.GeoserverConfig{WorkspaceName: "golang", Username: "admin", Password: "geoserver", ServerURL: "http://localhost:8080/geoserver"},
        Datastore: gismanager.DatastoreConfig{Host: "localhost", Port: 5432, DBName: "gis", DBUser: "golang", DBPass: "golang", Name: "gismanager_data"},
        Source:    gismanager.SourceConfig{Path: "./testdata"},
        logger:    gismanager.GetLogger(),
      }
      
    • get Supported GIS Files:
      files, _ := gismanager.GetGISFiles(manager.Source.Path)
      for _, file := range files {
        fmt.Println(file)
      }
      
      • output:
        <full_path>/testdata/neighborhood_names_gis.geojson
        <full_path>/testdata/nested/nyc_wi-fi_hotspot_locations.geojson
        <full_path>/testdata/sample.gpkg
        
    • read files and get layers Schema:
        for _, file := range files {
          source, ok := manager.OpenSource(file, 0)
          if ok {
            for index := 0; index < source.LayerCount(); index++ {
              layer := source.LayerByIndex(index)
              gLayer := gismanager.GdalLayer{
                Layer: &layer,
              }
              fmt.Println(layer.Name())
              for _, f := range gLayer.GetLayerSchema() {
                fmt.Printf("\n%+v\n", *f)
              }
            }
          }
        }
      
      • output sample:
        neighborhood_names_gis
        
        {Name:geom Type:POINT}
        
        {Name:stacked Type:String}
        
        {Name:name Type:String}
        
        {Name:annoline1 Type:String}
        
        {Name:annoline3 Type:String}
        
        {Name:objectid Type:String}
        
        {Name:annoangle Type:String}
        
        {Name:annoline2 Type:String}
        
        {Name:borough Type:String}
        ...
        
    • add your gis data to your database:
        for _, file := range files {
            source, ok := manager.OpenSource(file, 0)
            targetSource, targetOK := manager.OpenSource(manager.Datastore.BuildConnectionString(), 1)
            if ok && targetOK {
              for index := 0; index < source.LayerCount(); index++ {
                layer := source.LayerByIndex(index)
                gLayer := gismanager.GdalLayer{
                  Layer: &layer,
                }
                newLayer, postgisErr := gLayer.LayerToPostgis(targetSource, manager, true)
                if postgisErr != nil {
                  panic(postgisErr)
                }
                logger.Infof("Layer: %s added to you database", newLayer.Name())
              }
            }
        }
      
      • output:
        INFO[14-10-2018 17:28:37] Layer: neighborhood_names_gis added to you database 
        INFO[14-10-2018 17:28:38] Layer: nyc_wi_fi_hotspot_locations added to you database 
        INFO[14-10-2018 17:28:38] Layer: hwy_patrol added to you database
        
    • update the previous code to publish your postgis layers to geoserver
       for _, file := range files {
         source, ok := manager.OpenSource(file, 0)
         targetSource, targetOK := manager.OpenSource(manager.Datastore.BuildConnectionString(), 1)
         if ok && targetOK {
           for index := 0; index < source.LayerCount(); index++ {
             layer := source.LayerByIndex(index)
             gLayer := gismanager.GdalLayer{
               Layer: &layer,
             }
             if newLayer, postgisErr := gLayer.LayerToPostgis(targetSource, manager, true); newLayer.Layer != nil || postgisErr != nil {
               ok, pubErr := manager.PublishGeoserverLayer(newLayer)
               if pubErr != nil {
                 logger.Error(pubErr)
               }
               if !ok {
                 logger.Error("Failed to Publish")
               } else {
                 logger.Info("published")
               }
             }
      
           }
         }
       }
      
      • output:
       INFO[14-10-2018 17:37:07] url:http://localhost:8080/geoserver/rest/workspaces/golang  Status=404  
       ERRO[14-10-2018 17:37:07] No such workspace: 'golang' found            
       INFO[14-10-2018 17:37:07] url:http://localhost:8080/geoserver/rest/workspaces  Status=201  
       INFO[14-10-2018 17:37:07] url:http://localhost:8080/geoserver/rest/workspaces/golang/datastores/gis?quietOnNotFound=true  Status=404  
       INFO[14-10-2018 17:37:07] url:http://localhost:8080/geoserver/rest/workspaces/golang/datastores  Status=201  
       ERRO[14-10-2018 17:37:07] {"featureType":{"name":"neighborhood_names_gis","nativeName":"neighborhood_names_gis"}} 
       INFO[14-10-2018 17:37:07] url:http://localhost:8080/geoserver/rest/workspaces/golang/datastores/gis/featuretypes  Status=201  
       INFO[14-10-2018 17:37:07] published                                    
       INFO[14-10-2018 17:37:08] url:http://localhost:8080/geoserver/rest/workspaces/golang  Status=200  
       INFO[14-10-2018 17:37:08] url:http://localhost:8080/geoserver/rest/workspaces/golang/datastores/gis?quietOnNotFound=true  Status=200  
       ERRO[14-10-2018 17:37:08] {"featureType":{"name":"nyc_wi_fi_hotspot_locations","nativeName":"nyc_wi_fi_hotspot_locations"}} 
       INFO[14-10-2018 17:37:08] url:http://localhost:8080/geoserver/rest/workspaces/golang/datastores/gis/featuretypes  Status=201  
       INFO[14-10-2018 17:37:08] published                                    
       INFO[14-10-2018 17:37:08] url:http://localhost:8080/geoserver/rest/workspaces/golang  Status=200  
       INFO[14-10-2018 17:37:08] url:http://localhost:8080/geoserver/rest/workspaces/golang/datastores/gis?quietOnNotFound=true  Status=200  
       ERRO[14-10-2018 17:37:08] {"featureType":{"name":"hwy_patrol","nativeName":"hwy_patrol"}} 
       INFO[14-10-2018 17:37:08] url:http://localhost:8080/geoserver/rest/workspaces/golang/datastores/gis/featuretypes  Status=201  
       INFO[14-10-2018 17:37:08] published 
      
      • done check you geoserver or via geoserver rest api url http://localhost:8080/geoserver/rest/layers.json :
         {
           "layers": {
             "layer": [..., {
               "name": "golang:hwy_patrol",
               "href": "http:\/\/localhost:8080\/geoserver\/rest\/layers\/golang%3Ahwy_patrol.json"
             }, {
               "name": "golang:neighborhood_names_gis",
               "href": "http:\/\/localhost:8080\/geoserver\/rest\/layers\/golang%3Aneighborhood_names_gis.json"
             }, {
               "name": "golang:nyc_wi_fi_hotspot_locations",
               "href": "http:\/\/localhost:8080\/geoserver\/rest\/layers\/golang%3Anyc_wi_fi_hotspot_locations.json"
             }]
           }
         }
        

Todo:

  • backup postgis as geopackage
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].