@@ -163,6 +163,7 @@ secret_access_key
163163isvirtual= {true|false}
164164layer
165165subdataset
166+ tile_size
166167```
167168
168169** resource_URI** 资源url路径,必须以 "** oss://** "作为开始。
@@ -173,23 +174,51 @@ subdataset
173174
174175** subdataset** 创建外部表格式为** NETCDF** 时使用,subdataset 表示外部表导入的子数据集。
175176
177+ ** tile_size** 创建外部表格式为** RASTER** 时使用,tile_size 表示对栅格数据分片的大小。
178+
176179#### 导入栅格数据格式
177180
178- 外部表导入栅格数据格式,这里提供一个简单示例。
181+ 由于有些TIFF文件像素很大无法直接导入到数据库中,这里会对栅格数据分片处理。tile_size 是设置切分数据的大小,如果在oss_parameters中没有设置其大小默认按照512x512处理。切分数据分片最大值不能大于10000x10000,如果大于按照最大值10000来进行分片处理。
182+
183+ 这里提供一个简单示例。
179184
180185``` sql
181186-- Import Gis raster data to table:
182- CREATE READABLE EXTERNAL TABLE osstbl_example(filename text , rast raster, metadata text ) LOCATION(' oss://ossext-example.sh1a.qingstor.com/raster oss_type=QS access_key_id=xxx secret_access_key=xxx' ) FORMAT ' raster' ;
187+ CREATE READABLE EXTERNAL TABLE osstbl_example(filename text , rast raster, metadata text ) LOCATION(' oss://ossext-example.sh1a.qingstor.com/raster tile_size=100x100 oss_type=QS access_key_id=xxx secret_access_key=xxx' ) FORMAT ' raster' ;
183188
184189SELECT filename, st_value(rast, 3 , 4 ) from osstbl_example order by filename;
185190
186191-- Results of the raster
187- filename | st_value
188- -- -----------------------+------------------
189- raster/ test_input .tiff | 260 .100006103516
190- raster/ test_output .tiff | 260 .100006103516
192+ -- filename列说明
193+ -- icg/gis/raster/test_input.tiff 是对象存储的文件路径。
194+ -- tilenum 是当前切分的第几个瓦片。
195+ -- xtile 表示坐标系x第几个瓦片。
196+ -- ytile 表示坐标系y第几个瓦片。
197+ -- tile_size 是当前切片大小。
198+ filename | st_value
199+ -- ---------------------------------------------------------------------------+------------------
200+ icg/ gis/ raster/ test_input .tiff tilenum:0 xtile:0 ytile:0 tile_size:100x100 | 260 .100006103516
201+ icg/ gis/ raster/ test_input .tiff tilenum:1 xtile:1 ytile:0 tile_size:100x100 | 252 .389999389648
202+ icg/ gis/ raster/ test_input .tiff tilenum:2 xtile:2 ytile:0 tile_size:100x100 | 255 .429992675781
203+ icg/ gis/ raster/ test_input .tiff tilenum:3 xtile:3 ytile:0 tile_size:100x100 | 288 .690002441406
204+ icg/ gis/ raster/ test_input .tiff tilenum:4 xtile:1 ytile:1 tile_size:100x100 | 280 .169982910156
205+ icg/ gis/ raster/ test_input .tiff tilenum:5 xtile:2 ytile:1 tile_size:100x100 | 284 .72998046875
206+ icg/ gis/ raster/ test_input .tiff tilenum:6 xtile:3 ytile:1 tile_size:100x100 | 301 .100006103516
207+ icg/ gis/ raster/ test_input .tiff tilenum:7 xtile:1 ytile:2 tile_size:100x100 | 297 .639984130859
208+ icg/ gis/ raster/ test_input .tiff tilenum:8 xtile:2 ytile:2 tile_size:100x100 | 301 .940002441406
209+ icg/ gis/ raster/ test_output .tiff tilenum:0 xtile:0 ytile:0 tile_size:100x100 | 260 .100006103516
210+ icg/ gis/ raster/ test_output .tiff tilenum:1 xtile:1 ytile:0 tile_size:100x100 | 252 .389999389648
211+ icg/ gis/ raster/ test_output .tiff tilenum:2 xtile:2 ytile:0 tile_size:100x100 | 255 .429992675781
212+ icg/ gis/ raster/ test_output .tiff tilenum:3 xtile:3 ytile:0 tile_size:100x100 | 288 .690002441406
213+ icg/ gis/ raster/ test_output .tiff tilenum:4 xtile:1 ytile:1 tile_size:100x100 | 280 .169982910156
214+ icg/ gis/ raster/ test_output .tiff tilenum:5 xtile:2 ytile:1 tile_size:100x100 | 284 .72998046875
215+ icg/ gis/ raster/ test_output .tiff tilenum:6 xtile:3 ytile:1 tile_size:100x100 | 301 .100006103516
216+ icg/ gis/ raster/ test_output .tiff tilenum:7 xtile:1 ytile:2 tile_size:100x100 | 297 .639984130859
217+ icg/ gis/ raster/ test_output .tiff tilenum:8 xtile:2 ytile:2 tile_size:100x100 | 301 .940002441406
191218```
192219
220+
221+
193222#### 导入矢量数据格式
194223
195224查看矢量数据详细信息: 创建SQL函数Ogr_Fdw_Info并执行该方法,创建成功后用户可获取shapefile建表SQL语句。
0 commit comments