未提供项目说明

tilebench的Python项目详细描述


平底骨

Packaging statusCircleCIcodecov

使用光栅获取列表/获取请求统计信息。在

注意:这将在下一个GDAL版本中介绍https://github.com/OSGeo/gdal/pull/2742

API

fromtilebenchimportprofileimportrasterio@profile()definfo(src_path:str):withrasterio.open(src_path)assrc_dst:returnsrc_dst.metameta=info("https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/2020/S2A_34SGA_20200318_0_L2A/B05.tif")>2020-07-13T16:59:05.685976-0400|TILEBENCH|{"LIST":{"count":0},"HEAD":{"count":1},"GET":{"count":1,"bytes":16384,"ranges":["0-16383"]},"Timing":0.8030309677124023}
^{pr2}$

CLI

$ tilebench --help
Usage: tilebench [OPTIONS] COMMAND [ARGS]...

  Command line interface for the tilebench Python package.

Options:
  --help  Show this message and exit.

Commands:
  get-overview-level  Get internal Overview level.
  get-zooms           Get Mercator Zoom levels.
  profile             Get internal Overview level.
  random              Get random tile.
$ tilebench get-zooms https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/2020/S2A_34SGA_20200318_0_L2A/B05.tif | jq
{
  "minzoom": 8,
  "maxzoom": 12
}

$ tilebench random https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/2020/S2A_34SGA_20200318_0_L2A/B05.tif 12                
[2314, 1667, 12]

$ tilebench profile https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/2020/S2A_34SGA_20200318_0_L2A/B05.tif 12-2314-1667 --config GDAL_DISABLE_READDIR_ON_OPEN=EMPTY_DIR | jq
{
  "LIST": {
    "count": 0
  },
  "HEAD": {
    "count": 1
  },
  "GET": {
    "count": 3,
    "bytes": 1464479,
    "ranges": [
      "0-16383",
      "33328080-34028784",
      "36669144-37416533"
    ]
  },
  "Timing": 2.377608060836792
}

$ tilebench profile https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/2020/S2A_34SGA_20200318_0_L2A/B05.tif 12-2314-1667 --config GDAL_DISABLE_READDIR_ON_OPEN=FALSE | jq
{
  "LIST": {
    "count": 1
  },
  "HEAD": {
    "count": 8
  },
  "GET": {
    "count": 11,
    "bytes": 1464479,
    "ranges": [
      "0-16383",
      "33328080-34028784",
      "36669144-37416533"
    ]
  },
  "Timing": 7.09281587600708
}

更多

aiocogeo

使用great aiocogeo我们可以获得更多关于COG内部结构的信息。在

$ aiocogeo info https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/2020/S2A_34SGA_20200318_0_L2A/B05.tif

        FILE INFO: https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/2020/S2A_34SGA_20200318_0_L2A/B05.tif

          PROFILE
            Width:            5490
            Height:           5490
            Bands:            1
            Dtype:            uint16
            Crs:              EPSG:32634
            Origin:           (699960.0, 3600000.0)
            Resolution:       (20.0, -20.0)
            BoundingBox:      (699960.0, 3490200.0, 809760.0, 3600000.0)
            Compression:      deflate
            Internal mask:    False
        
          IFD
                Id      Size           BlockSize     MinTileSize (KB)     MaxTileSize (KB)     MeanTileSize (KB)    
                0       5490x5490      512x512       0.531                414.187              261.824                       
                1       2745x2745      256x256       0.149                105.182              67.362                        
                2       1373x1373      256x256       0.149                105.244              58.2                          
                3       687x687        256x256       15.938               106.996              60.686                        
                4       344x344        256x256       13.559               66.76                36.114  

更多

结合aiocogeo+morecantile,我们可以创建内部瓷砖的geojson,并与mercator网格进行比较。在

$ aiocogeo create-tms https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/2020/S2A_34SGA_20200318_0_L2A/B05.tif

{
 "title": "Tile matrix for https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/2020/S2A_34SGA_20200318_0_L2A/B05.tif",
 "identifier": "902b0312-2da6-4873-92f7-7a8b3480cef2",
 "supportedCRS": "http://www.opengis.net/def/crs/EPSG/0/32634",
 "tileMatrix": [
  {
   "identifier": "0",
   "topLeftCorner": [
    699960.0,
    3600000.0
   ],
   "tileWidth": 256,
   "tileHeight": 256,
   "matrixWidth": 2,
   "matrixHeight": 2,
   "scaleDenominator": 1139950.166112957
  },
  {
   "identifier": "1",
   "topLeftCorner": [
    699960.0,
    3600000.0
   ],
   "tileWidth": 256,
   "tileHeight": 256,
   "matrixWidth": 3,
   "matrixHeight": 3,
   "scaleDenominator": 570804.741110418
  },
  {
   "identifier": "2",
   "topLeftCorner": [
    699960.0,
    3600000.0
   ],
   "tileWidth": 256,
   "tileHeight": 256,
   "matrixWidth": 6,
   "matrixHeight": 6,
   "scaleDenominator": 285610.23826865054
  },
  {
   "identifier": "3",
   "topLeftCorner": [
    699960.0,
    3600000.0
   ],
   "tileWidth": 256,
   "tileHeight": 256,
   "matrixWidth": 11,
   "matrixHeight": 11,
   "scaleDenominator": 142857.14285714287
  },
  {
   "identifier": "4",
   "topLeftCorner": [
    699960.0,
    3600000.0
   ],
   "tileWidth": 512,
   "tileHeight": 512,
   "matrixWidth": 11,
   "matrixHeight": 11,
   "scaleDenominator": 71428.57142857143
  }
 ]
}

TMS级别从低到高排序,因此raw块是最后一个TMS级别(4

# Internal raw tiles grids
$ aiocogeo create-tms https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/2020/S2A_34SGA_20200318_0_L2A/B05.tif | morecantile tms-to-geojson --level 4 --collect > B05_raw.geojson

# Mercator grid at zoom 12
$ rio bounds https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/2020/S2A_34SGA_20200318_0_L2A/B05.tif  | supermercado burn 12 | mercantile shapes --collect > B05_zoom12.geojson

贡献与发展

问题和拉取请求非常受欢迎。在

dev安装

$ git clone https://github.com/developmentseed/tilebench.git
$ cd tilebench
$ pip install -e .[dev]

Python>;=3.7仅限

此回购设置为在提交新代码时使用pre-commit运行isortflake8pydocstringblack(“不妥协的Python代码格式化程序”)和mypy。在

$ pre-commit install

$ git add .

$ git commit -m'my change'
isort....................................................................Passed
black....................................................................Passed
Flake8...................................................................Passed
Verifying PEP257 Compliance..............................................Passed
mypy.....................................................................Passed

$ git push origin

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
apache commons 3.1中的java httpClient代理支持   ubuntu 14.04 Java:找不到类Xmx1g   java如何用当前用户的数据填充recyclerview?   java Alter Hibernate事务超时仅用于一种方法?   如果没有pow()、函数或递归,如何在c/c++中使用幂函数   java将html UI与本机安卓应用程序相结合   创建GridPane子项时发生java错误   java在基类构造函数中调用虚方法   客户端重新连接javasocket   具有建议日期的java Open DatePicker   雅加达ee Java ee请求范围和异步   classnotfoundexception无法执行目标组织。科德豪斯。项目<projectname>上的mojo:execmavenplugin:1.6.0:java(defaultcli):   java字符串内容相同,但equals方法返回false   primefaces调度的java问题   java帮助我理解关于实现接口的这一课   java Jsoup在下载页面文本时将所有url分离   java将字符串转换为整数错误   java如何从mapDB数据库中检索数据,而不必每次都重写它?