cartopy.io.img_nest.Img#

class cartopy.io.img_nest.Img(*args, **kwargs)[源代码]#

代表简单的地理定位图像。

参数:
  • filename -- 图像磁贴的滤镜。

  • extent -- 图像的(x_lower,x_upper,y_lower,y_upper)范围,以原生投影为单位。

  • origin -- 原产地名称。

  • pixel_size -- (x_scale,y_scale)像素宽度,以每个像素的原生投影为单位。

备注

未来API可能会发生变化,以包括CRS。

bbox()[源代码]#

返回一个 Polygon 此图像范围的实例。

count(value, /)#

返回值出现的次数。

extent#

字段号1的收件箱

filename#

字段号0的收件箱

classmethod from_world_file(img_fname, world_fname)[源代码]#

从给定的图像文件名和worldfile文件名返回Img实例。

index(value, start=0, stop=9223372036854775807, /)#

返回值的第一个索引。

如果该值不存在,则引发Value错误。

origin#

字段2的收件箱

pixel_size#

字段号3的收件箱

static world_file_extent(worldfile_handle, im_shape)[源代码]#

返回范围 (x0, x1, y0, y1) 和像素尺寸 (x_width, y_width) 如给定的世界文件文件处理和关联的图像形状中定义的 (x, y) .

static world_files(fname)[源代码]#

确定潜在的世界文件名组合,而无需检查它们的存在。

例如是 '*.tif' 文件可能具有以下流行的世界文件扩展名惯例之一 '*.tifw' , '*.tfw' , '*.TIFW''*.TFW' .

给定可能的世界文件扩展名,也会生成大写字母组合。例如,文件“map. tif”将生成以下世界文件变体:“map. tifw”、“map. tfw”、“map. TIFW”、“map. TFW”、“MAP. tifw”、“MAP. tfw”、“MAP.TIFW”和“MAP. TFW”。

参数:

fname -- 获取所有可能的世界文件名组合的文件名称。

返回:

A list of possible world filename combinations.

示例

>>> from cartopy.io.img_nest import Img
>>> Img.world_files('img.png')[:6]
['img.pngw', 'img.pgw', 'img.PNGW', 'img.PGW', 'IMG.pngw', 'IMG.pgw']
>>> Img.world_files('/path/to/img.TIF')[:2]
['/path/to/img.tifw', '/path/to/img.tfw']
>>> Img.world_files('/path/to/img/with_no_extension')[0]
'/path/to/img/with_no_extension.w'