This topic describes how to publish raster data in a Ganos database by using GeoServer.

Add a data store

  1. Run GeoServer. In the left-side navigation pane, click Stores.
  2. On the Stores page, click Add new Store. On the page that appears, select GanosRaster(PG/PolarDB) in the Raster Data Sources section.
  3. Set the connection information about the database.

    The following table describes the parameters.

    Parameter Description Example
    host The IP address of the database or the endpoint of the ApsaraDB for Relational Database Service (RDS) instance. xxxxxxx.pg.rds.aliyuncs.com
    port The port number of the database. 3432
    database The name of the database. rasterdb
    username The username used to log on to the database. pguser
    password The password used to log on to the database. 123456
    schema The schema in the database. Default value: public.
    table The name of the table that stores the raster data. raster_table
    column name The name of the raster column. raster_column
    filter The filter condition specified by the WHERE clause in the SQL statement to filter the raster data. If multiple raster objects meet the condition, the first one is used. id=1 or name='srtm'
    name The name of the raster object displayed in GeoServer. myraster

Use the RESTful API

  • Request URL: http://host:port/geoserver/rest/workspaces/{workspace}/coveragestores
  • Method: POST
  • Request parameters:
    • workspace: the name of the created workspace.
    • datastore body: the information about the data store. Keep the default value of the type parameter, and set the url parameter to the connection information about the RDS for PostgreSQL or POLARDB instance in JSON format. The following code provides an example:
      {
        "coverageStore": {
          "name": "<datasource_name>",
          "type": "GanosRaster(PG/PolarDB)",
          "enabled":"true",
          "workspace":"<workspace>",
          "url": "{\"column\":\"<raster_column>\",\"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}"
        }
      }