-
DataSource
的构造函数只需要一个参数:要读取的文件的路径。但是,OGR 还支持各种更复杂的数据源,包括数据库,可以通过传递特殊名称字符串而不是路径来访问这些数据源。有关详细信息,请参阅OGR Vector Formats 文档。DataSource
实例的name
可选的
encoding
参数允许您指定源中字符串的非标准编码。当您在读取字段值时获得DjangoUnicodeDecodeError
异常时,这通常很有用。创建
DataSource
后,您可以通过访问layer_count
len()
函数来了解它包含多少层数据。有关访问数据层本身的信息,请参阅下一节:>>> from django.contrib.gis.gdal import DataSource >>> ds = DataSource('/path/to/your/cities.shp') >>> ds.name '/path/to/your/cities.shp' >>> ds.layer_count # This file only contains one layer 1
本文介绍 django.contrib.gis.gdal.DataSource
的用法。
声明
class DataSource(ds_input, encoding='utf-8')
相关用法
- Python DataFrame.to_excel()用法及代码示例
- Python Tableau DatasourceItem用法及代码示例
- Python DataFrame.read_pickle()用法及代码示例
- Python Pandas DataFrame.fillna()用法及代码示例
- Python Datetime.replace()用法及代码示例
- Python Django DateDetailView用法及代码示例
- Python DateTime转integer用法及代码示例
- Python DateTime astimezone()用法及代码示例
- Python Django DateTimeField.input_formats用法及代码示例
- Python DateTime weekday()用法及代码示例
- Python Django DayArchiveView用法及代码示例
- Python Decimal shift()用法及代码示例
- Python Decimal rotate()用法及代码示例
- Python Decimal max_mag()用法及代码示例
- Python Decimal as_integer_ratio()用法及代码示例
- Python Decimal is_subnormal()用法及代码示例
- Python Decimal canonical()用法及代码示例
- Python Decimal from_float()用法及代码示例
- Python Decimal normalize()用法及代码示例
- Python Decimal radix()用法及代码示例
- Python Dictionary update()用法及代码示例
- Python Decimal copy_abs()用法及代码示例
- Python Decimal is_finite()用法及代码示例
- Python Decimal conjugate()用法及代码示例
- Python Django Distance用法及代码示例
注:本文由纯净天空筛选整理自djangoproject.com大神的英文原创作品 django.contrib.gis.gdal.DataSource。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。