This topic describes the ST_ImportOSG function. This function imports an object storage-based oblique photography project in the OSGB format to a database.
Syntax
boolean ST_ImportOSGB(cstring table_name, cstring url, cstring options default '{}');Parameters
Parameter | Description |
table_name | The name of the osg table and the prefix of its tile table. |
url | The path of the file in an Object Storage Service (OSS) bucket. Note To ensure data access, make sure that the cluster and OSS are in the same region and that you use an internal endpoint for access. For more information, see Object storage service paths. |
options | The fields for the import.
|
Description
This function imports an object storage-based OSGB file to a database.
Import limits:
Only OSGB files are supported.
A file named
metadata.xmlmust exist in the specified directory. The file can be located in the root directory or a subdirectory.You must import the complete OSGB file. Otherwise, data loss occurs.
If you use a client to connect to the database and import a large amount of OSGB files, adjust the client timeout period to avoid import failure due to timeout errors.
After the import is successful, two tables are generated in the database:
If the degree of parallelism is not 1, automatic table creation is not supported. You must execute the following statement to manually create a table in advance:
# For this example, create a table named test_osgb in the default schema.
# Create a primary table.
CREATE TABLE IF NOT EXISTS test_osgb(
project_id uuid primary key,
project_name text,
srid integer,
ref_point geometry,
extent geometry,
aux text,
tiletable varchar(64) NOT null
);
# Create a tile table.
CREATE TABLE IF NOT EXISTS test_osgb_tile(
project_id uuid NOT NULL,
project_name text,
uid uuid NOT NULL,
lod integer,
precision float8,
parent uuid,
children uuid[],
aux jsonb,
tile scene NOT NULL,
PRIMARY KEY(project_id, uid)
);Example
-- Standard import
SELECT ST_ImportOSGB('test_osgb', 'OSS://<ak>:<ak_secret>@oss-cn-beijing-internal.aliyuncs.com/mybucket/path_to_oblique_project/');
---------
t
-- Parallel import
SELECT ST_ImportOSGB('test_osgb', 'OSS://<ak>:<ak_secret>@oss-cn-beijing-internal.aliyuncs.com/mybucket/path_to_oblique_project/', '{"parallel": 4}');
---------
t