通过GeoServer发布Ganos中的栅格数据。

添加数据源

  1. 打开GeoServer,选择数据存储
  2. 单击添加新的数据存储,选择GanosRaster(PG/PolarDB)

    发布栅格数据_GeoServer_服务发布_时空数据库_云数据库PolarDB 阿里云技术文档 第1张
    发布栅格数据_GeoServer_服务发布_时空数据库_云数据库PolarDB 阿里云技术文档 第2张
  3. 填写Ganos数据库的连接信息。

    发布栅格数据_GeoServer_服务发布_时空数据库_云数据库PolarDB 阿里云技术文档 第3张

    参数说明如下。

    参数名称 描述 示例
    host 数据库地址(IP或RDS连接地址)。 xxxxxxx.pg.rds.aliyuncs.com
    port 数据库端口号。 3432
    database 数据库名称。 rasterdb
    username 数据库用户名。 pguser
    password 数据库密码。 123456
    schema 表所在的schema。 默认为public
    table 栅格所在表名。 raster_table
    column name 栅格列名称。 raster_column
    filter 栅格对象过滤条件,为SQL 语句中的where条件。 如果符合条件的栅格有多个,总是使用第一个。 id=1或name='srtm'
    name geoserver显示的栅格名称。 myraster

REST API

  • 接口:http://host:port/geoserver/rest/workspaces/{workspace}/coveragestores
  • 方法:POST
  • 参数:
    • workspace:已经创建好的workspace名称。
    • datastore body:示例如下,其中type为固定写法,url中填写阿里云pg/polardb的连接参数(json格式)。
      {
        "coverageStore": {
          "name": "<datasource_name>",
          "type": "GanosRaster(PG/PolarDB)",
          "enabled":"true",
          "workspace":"<wokrspace>",
          "url": "{\"column\":\"<raster_colunm>\",\"database\":\"<database_name>\",\"filter\":\"<raster_filter>\",\"host\":\"<pg_host>\",\"name\":\"<public_name>\",\"password\":\"<user_password>\",\"port\":<pg_port>,\"schema\":\"<schema_name>\",\"ssl\":false,\"table\":\"<raster_table_name>\",\"userName\":\"<user_name>\",\"valid\":true}"
        }
      }

创建数据源示例

{
  "coverageStore": {
    "name": "srtm",
    "type": "GanosRaster(PG/PolarDB)",
    "enabled":"true",
    "workspace":"test",
    "url": "{\"column\":\"rast\",\"database\":\"test_db\",\"filter\":\"name='srtm'\",\"host\":\"pgm-xxxxxxxx.pg.rds.aliyuncs.com\",\"name\":\"srtm_image\",\"password\":\"xxxx\",\"port\":3432,\"schema\":\"public\",\"ssl\":true,\"table\":\"raster_table\",\"userName\":\"raster_user\",\"valid\":true}"
  }
}