Open:DataSource

2022/3/9

  下载 示例矢量

import gma
VO = gma.Open('China_Province_2022.shp')
1
2

  打开的 矢量数据 具有如下所列的 方法/属性:

# Driver


功能:【矢量驱动】。类属性,获取矢量数据驱动。

返回:str

VO.Driver
1

>>> 'ESRI Shapefile'


# GetLayer(ID)


功能:【打开图层】。打开某一图层。

参数:

 ID:int。矢量图层的编号。从 0 开始。

返回:Layer

LY = VO.GetLayer(0)
print(LY)
1
2

>>> <gma.algorithm.core.dataio.Layer at 0x......>


# GetOGRDataSource()


功能:【获取 DataSource】。读取矢量数据为 ogr.DataSource。

返回:osgeo.ogr.DataSource

OGRDS = VO.GetOGRDataSource()
print(OGRDS)
1
2

>>> <osgeo.ogr.DataSource; proxy of <Swig Object of type 'OGRDataSourceShadow *' at 0x......> >


# LayerCount


功能:【图层数】。类属性,获取矢量数据的图层数量。

返回:int

VO.LayerCount
1

>>> 1


# LayerNames


功能:【图层名】。类属性,获取矢量数据每个图层的名称。

返回:list

VO.LayerNames
1

>>> ['China_Province_2022']


# Metadata


功能:【元数据】。类属性,获取矢量数据的元数据。

返回:dict

VO.Metadata
1

>>> {}