{"id":1160751,"date":"2025-01-13T19:08:36","date_gmt":"2025-01-13T11:08:36","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1160751.html"},"modified":"2025-01-13T19:08:39","modified_gmt":"2025-01-13T11:08:39","slug":"python%e5%a6%82%e4%bd%95%e4%b8%8b%e8%bd%bdtiff%e5%9c%b0%e5%9b%be%e7%93%a6%e7%89%87","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1160751.html","title":{"rendered":"python\u5982\u4f55\u4e0b\u8f7dtiff\u5730\u56fe\u74e6\u7247"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25202155\/e188887b-8e53-48f3-8b7c-8d7500945255.webp\" alt=\"python\u5982\u4f55\u4e0b\u8f7dtiff\u5730\u56fe\u74e6\u7247\" \/><\/p>\n<p><p> <strong>Python\u4e0b\u8f7dtiff\u5730\u56fe\u74e6\u7247\u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93\u5982<code>requests<\/code>\u5e93\u3001<code>gdal<\/code>\u5e93\u3001<code>rasterio<\/code>\u5e93\u3001<code>folium<\/code>\u5e93\u3001\u4ee5\u53ca\u5229\u7528OGC\u6807\u51c6\u7684WMS\u670d\u52a1\u3002<\/strong> \u5176\u4e2d\uff0c\u5229\u7528<code>requests<\/code>\u5e93\u662f\u4e00\u4e2a\u76f8\u5bf9\u7b80\u5355\u800c\u6709\u6548\u7684\u65b9\u5f0f\uff0c\u9002\u5408\u521d\u5b66\u8005\u3002\u4ee5\u4e0b\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5229\u7528<code>requests<\/code>\u5e93\u4e0b\u8f7dtiff\u5730\u56fe\u74e6\u7247\u7684\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><h3>\u5229\u7528<code>requests<\/code>\u5e93\u4e0b\u8f7dtiff\u5730\u56fe\u74e6\u7247<\/h3>\n<\/p>\n<p><p><code>requests<\/code>\u5e93\u662f\u4e00\u4e2a\u7b80\u5355\u6613\u7528\u7684HTTP\u5e93\uff0c\u53ef\u4ee5\u7528\u6765\u53d1\u8d77HTTP\u8bf7\u6c42\uff0c\u4e0b\u8f7d\u6587\u4ef6\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u4f8b\u5b50\uff0c\u5c55\u793a\u5982\u4f55\u4f7f\u7528<code>requests<\/code>\u5e93\u4eceWMS\u670d\u52a1\u4e2d\u4e0b\u8f7dtiff\u5730\u56fe\u74e6\u7247\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import requests<\/p>\n<h2><strong>WMS\u670d\u52a1\u7684URL<\/strong><\/h2>\n<p>wms_url = &quot;https:\/\/example.com\/wms&quot;<\/p>\n<h2><strong>\u5b9a\u4e49\u8bf7\u6c42\u53c2\u6570<\/strong><\/h2>\n<p>params = {<\/p>\n<p>    &#39;service&#39;: &#39;WMS&#39;,<\/p>\n<p>    &#39;version&#39;: &#39;1.1.1&#39;,<\/p>\n<p>    &#39;request&#39;: &#39;GetMap&#39;,<\/p>\n<p>    &#39;layers&#39;: &#39;layer_name&#39;,<\/p>\n<p>    &#39;styles&#39;: &#39;&#39;,<\/p>\n<p>    &#39;bbox&#39;: &#39;bbox_coordinates&#39;,<\/p>\n<p>    &#39;width&#39;: &#39;256&#39;,<\/p>\n<p>    &#39;height&#39;: &#39;256&#39;,<\/p>\n<p>    &#39;srs&#39;: &#39;EPSG:4326&#39;,<\/p>\n<p>    &#39;format&#39;: &#39;image\/tiff&#39;<\/p>\n<p>}<\/p>\n<h2><strong>\u53d1\u8d77\u8bf7\u6c42<\/strong><\/h2>\n<p>response = requests.get(wms_url, params=params)<\/p>\n<h2><strong>\u68c0\u67e5\u8bf7\u6c42\u662f\u5426\u6210\u529f<\/strong><\/h2>\n<p>if response.status_code == 200:<\/p>\n<p>    with open(&#39;output.tiff&#39;, &#39;wb&#39;) as f:<\/p>\n<p>        f.write(response.content)<\/p>\n<p>    print(&quot;TIFF\u5730\u56fe\u74e6\u7247\u4e0b\u8f7d\u6210\u529f&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(f&quot;\u8bf7\u6c42\u5931\u8d25\uff0c\u72b6\u6001\u7801\uff1a{response.status_code}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528<code>gdal<\/code>\u5e93\u4e0b\u8f7dtiff\u5730\u56fe\u74e6\u7247<\/h3>\n<\/p>\n<p><p>GDAL\uff08Geospatial Data Abstraction Library\uff09\u662f\u4e00\u4e2a\u975e\u5e38\u5f3a\u5927\u7684\u5730\u7406\u6570\u636e\u5904\u7406\u5e93\uff0c\u652f\u6301\u591a\u79cd\u683c\u5f0f\u7684\u8bfb\u5199\u64cd\u4f5c\u3002\u5229\u7528GDAL\u5e93\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u4e0b\u8f7d\u548c\u5904\u7406tiff\u5730\u56fe\u74e6\u7247\u3002<\/p>\n<\/p>\n<p><h4>\u5b89\u88c5GDAL\u5e93<\/h4>\n<\/p>\n<p><p>\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5GDAL\u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install gdal<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>\u4e0b\u8f7dtiff\u5730\u56fe\u74e6\u7247<\/h4>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u4f7f\u7528GDAL\u5e93\u4e0b\u8f7dtiff\u5730\u56fe\u74e6\u7247\u7684\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from osgeo import gdal<\/p>\n<h2><strong>WMS\u670d\u52a1\u7684URL<\/strong><\/h2>\n<p>wms_url = &quot;https:\/\/example.com\/wms&quot;<\/p>\n<h2><strong>\u5b9a\u4e49\u8bf7\u6c42\u53c2\u6570<\/strong><\/h2>\n<p>wms_request = f&quot;{wms_url}?service=WMS&amp;version=1.1.1&amp;request=GetMap&amp;layers=layer_name&amp;styles=&amp;bbox=bbox_coordinates&amp;width=256&amp;height=256&amp;srs=EPSG:4326&amp;format=image\/tiff&quot;<\/p>\n<h2><strong>\u4f7f\u7528GDAL\u5e93\u4e0b\u8f7d\u5730\u56fe\u74e6\u7247<\/strong><\/h2>\n<p>output_file = &#39;output.tiff&#39;<\/p>\n<p>gdal.Warp(output_file, wms_request, format=&#39;GTiff&#39;)<\/p>\n<p>print(&quot;TIFF\u5730\u56fe\u74e6\u7247\u4e0b\u8f7d\u6210\u529f&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528<code>rasterio<\/code>\u5e93\u4e0b\u8f7dtiff\u5730\u56fe\u74e6\u7247<\/h3>\n<\/p>\n<p><p>Rasterio\u662f\u4e00\u4e2a\u7528\u4e8e\u5904\u7406\u5149\u6805\u6570\u636e\u7684Python\u5e93\uff0c\u63d0\u4f9b\u4e86\u7b80\u5355\u7684API\u6765\u8bfb\u5199\u5730\u7406\u7a7a\u95f4\u6570\u636e\u3002<\/p>\n<\/p>\n<p><h4>\u5b89\u88c5Rasterio\u5e93<\/h4>\n<\/p>\n<p><p>\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5Rasterio\u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install rasterio<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>\u4e0b\u8f7dtiff\u5730\u56fe\u74e6\u7247<\/h4>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u4f7f\u7528Rasterio\u5e93\u4e0b\u8f7dtiff\u5730\u56fe\u74e6\u7247\u7684\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import rasterio<\/p>\n<p>from rasterio.io import MemoryFile<\/p>\n<p>import requests<\/p>\n<h2><strong>WMS\u670d\u52a1\u7684URL<\/strong><\/h2>\n<p>wms_url = &quot;https:\/\/example.com\/wms&quot;<\/p>\n<h2><strong>\u5b9a\u4e49\u8bf7\u6c42\u53c2\u6570<\/strong><\/h2>\n<p>params = {<\/p>\n<p>    &#39;service&#39;: &#39;WMS&#39;,<\/p>\n<p>    &#39;version&#39;: &#39;1.1.1&#39;,<\/p>\n<p>    &#39;request&#39;: &#39;GetMap&#39;,<\/p>\n<p>    &#39;layers&#39;: &#39;layer_name&#39;,<\/p>\n<p>    &#39;styles&#39;: &#39;&#39;,<\/p>\n<p>    &#39;bbox&#39;: &#39;bbox_coordinates&#39;,<\/p>\n<p>    &#39;width&#39;: &#39;256&#39;,<\/p>\n<p>    &#39;height&#39;: &#39;256&#39;,<\/p>\n<p>    &#39;srs&#39;: &#39;EPSG:4326&#39;,<\/p>\n<p>    &#39;format&#39;: &#39;image\/tiff&#39;<\/p>\n<p>}<\/p>\n<h2><strong>\u53d1\u8d77\u8bf7\u6c42<\/strong><\/h2>\n<p>response = requests.get(wms_url, params=params)<\/p>\n<h2><strong>\u68c0\u67e5\u8bf7\u6c42\u662f\u5426\u6210\u529f<\/strong><\/h2>\n<p>if response.status_code == 200:<\/p>\n<p>    with MemoryFile(response.content) as memfile:<\/p>\n<p>        with memfile.open() as dataset:<\/p>\n<p>            with rasterio.open(&#39;output.tiff&#39;, &#39;w&#39;, dataset.profile) as dst:<\/p>\n<p>                dst.write(dataset.read())<\/p>\n<p>    print(&quot;TIFF\u5730\u56fe\u74e6\u7247\u4e0b\u8f7d\u6210\u529f&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(f&quot;\u8bf7\u6c42\u5931\u8d25\uff0c\u72b6\u6001\u7801\uff1a{response.status_code}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528<code>folium<\/code>\u5e93\u4e0b\u8f7dtiff\u5730\u56fe\u74e6\u7247<\/h3>\n<\/p>\n<p><p>Folium\u662f\u4e00\u4e2a\u7528\u4e8e\u5728Python\u4e2d\u521b\u5efa\u4ea4\u4e92\u5f0f\u5730\u56fe\u7684\u5e93\uff0c\u57fa\u4e8eLeaflet.js\u3002\u867d\u7136Folium\u672c\u8eab\u5e76\u4e0d\u76f4\u63a5\u652f\u6301\u4e0b\u8f7dtiff\u5730\u56fe\u74e6\u7247\uff0c\u4f46\u53ef\u4ee5\u7ed3\u5408\u5176\u4ed6\u65b9\u6cd5\u6765\u5b9e\u73b0\u3002<\/p>\n<\/p>\n<p><h4>\u5b89\u88c5Folium\u5e93<\/h4>\n<\/p>\n<p><p>\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5Folium\u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install folium<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>\u4e0b\u8f7dtiff\u5730\u56fe\u74e6\u7247<\/h4>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u7ed3\u5408Folium\u5e93\u548crequests\u5e93\u4e0b\u8f7dtiff\u5730\u56fe\u74e6\u7247\u7684\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import folium<\/p>\n<p>import requests<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2aFolium\u5730\u56fe\u5bf9\u8c61<\/strong><\/h2>\n<p>m = folium.Map(location=[latitude, longitude], zoom_start=12)<\/p>\n<h2><strong>WMS\u670d\u52a1\u7684URL<\/strong><\/h2>\n<p>wms_url = &quot;https:\/\/example.com\/wms&quot;<\/p>\n<h2><strong>\u5b9a\u4e49\u8bf7\u6c42\u53c2\u6570<\/strong><\/h2>\n<p>params = {<\/p>\n<p>    &#39;service&#39;: &#39;WMS&#39;,<\/p>\n<p>    &#39;version&#39;: &#39;1.1.1&#39;,<\/p>\n<p>    &#39;request&#39;: &#39;GetMap&#39;,<\/p>\n<p>    &#39;layers&#39;: &#39;layer_name&#39;,<\/p>\n<p>    &#39;styles&#39;: &#39;&#39;,<\/p>\n<p>    &#39;bbox&#39;: &#39;bbox_coordinates&#39;,<\/p>\n<p>    &#39;width&#39;: &#39;256&#39;,<\/p>\n<p>    &#39;height&#39;: &#39;256&#39;,<\/p>\n<p>    &#39;srs&#39;: &#39;EPSG:4326&#39;,<\/p>\n<p>    &#39;format&#39;: &#39;image\/tiff&#39;<\/p>\n<p>}<\/p>\n<h2><strong>\u53d1\u8d77\u8bf7\u6c42<\/strong><\/h2>\n<p>response = requests.get(wms_url, params=params)<\/p>\n<h2><strong>\u68c0\u67e5\u8bf7\u6c42\u662f\u5426\u6210\u529f<\/strong><\/h2>\n<p>if response.status_code == 200:<\/p>\n<p>    with open(&#39;output.tiff&#39;, &#39;wb&#39;) as f:<\/p>\n<p>        f.write(response.content)<\/p>\n<p>    print(&quot;TIFF\u5730\u56fe\u74e6\u7247\u4e0b\u8f7d\u6210\u529f&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(f&quot;\u8bf7\u6c42\u5931\u8d25\uff0c\u72b6\u6001\u7801\uff1a{response.status_code}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u56db\u3001\u5229\u7528OGC\u6807\u51c6\u7684WMS\u670d\u52a1\u4e0b\u8f7dtiff\u5730\u56fe\u74e6\u7247<\/h3>\n<\/p>\n<p><p>OGC\uff08Open Geospatial Consortium\uff09\u6807\u51c6\u7684WMS\uff08Web Map Service\uff09\u670d\u52a1\u63d0\u4f9b\u4e86\u83b7\u53d6\u5730\u56fe\u5f71\u50cf\u7684\u6807\u51c6\u63a5\u53e3\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u83b7\u53d6tiff\u683c\u5f0f\u7684\u5730\u56fe\u74e6\u7247\u3002<\/p>\n<\/p>\n<p><h4>\u5b9a\u4e49WMS\u670d\u52a1\u8bf7\u6c42\u53c2\u6570<\/h4>\n<\/p>\n<p><p>\u8981\u4f7f\u7528WMS\u670d\u52a1\uff0c\u9700\u8981\u5b9a\u4e49\u4e00\u7cfb\u5217\u8bf7\u6c42\u53c2\u6570\uff0c\u5305\u62ec\u670d\u52a1\u7c7b\u578b\u3001\u7248\u672c\u3001\u8bf7\u6c42\u7c7b\u578b\u3001\u56fe\u5c42\u540d\u79f0\u3001\u6837\u5f0f\u3001\u8fb9\u754c\u6846\u3001\u56fe\u50cf\u5bbd\u5ea6\u3001\u9ad8\u5ea6\u3001\u5750\u6807\u53c2\u8003\u7cfb\u7edf\u548c\u56fe\u50cf\u683c\u5f0f\u7b49\u3002<\/p>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u793a\u4f8b\u8bf7\u6c42\u53c2\u6570\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">params = {<\/p>\n<p>    &#39;service&#39;: &#39;WMS&#39;,<\/p>\n<p>    &#39;version&#39;: &#39;1.1.1&#39;,<\/p>\n<p>    &#39;request&#39;: &#39;GetMap&#39;,<\/p>\n<p>    &#39;layers&#39;: &#39;layer_name&#39;,<\/p>\n<p>    &#39;styles&#39;: &#39;&#39;,<\/p>\n<p>    &#39;bbox&#39;: &#39;bbox_coordinates&#39;,<\/p>\n<p>    &#39;width&#39;: &#39;256&#39;,<\/p>\n<p>    &#39;height&#39;: &#39;256&#39;,<\/p>\n<p>    &#39;srs&#39;: &#39;EPSG:4326&#39;,<\/p>\n<p>    &#39;format&#39;: &#39;image\/tiff&#39;<\/p>\n<p>}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>\u53d1\u8d77WMS\u670d\u52a1\u8bf7\u6c42<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528requests\u5e93\u53d1\u8d77WMS\u670d\u52a1\u8bf7\u6c42\uff0c\u5e76\u5c06\u8fd4\u56de\u7684tiff\u5730\u56fe\u74e6\u7247\u4fdd\u5b58\u5230\u672c\u5730\u6587\u4ef6\u4e2d\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import requests<\/p>\n<h2><strong>WMS\u670d\u52a1\u7684URL<\/strong><\/h2>\n<p>wms_url = &quot;https:\/\/example.com\/wms&quot;<\/p>\n<h2><strong>\u53d1\u8d77\u8bf7\u6c42<\/strong><\/h2>\n<p>response = requests.get(wms_url, params=params)<\/p>\n<h2><strong>\u68c0\u67e5\u8bf7\u6c42\u662f\u5426\u6210\u529f<\/strong><\/h2>\n<p>if response.status_code == 200:<\/p>\n<p>    with open(&#39;output.tiff&#39;, &#39;wb&#39;) as f:<\/p>\n<p>        f.write(response.content)<\/p>\n<p>    print(&quot;TIFF\u5730\u56fe\u74e6\u7247\u4e0b\u8f7d\u6210\u529f&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(f&quot;\u8bf7\u6c42\u5931\u8d25\uff0c\u72b6\u6001\u7801\uff1a{response.status_code}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e94\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>Python\u4e0b\u8f7dtiff\u5730\u56fe\u74e6\u7247\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5176\u4e2d\u4f7f\u7528<code>requests<\/code>\u5e93\u662f\u6700\u7b80\u5355\u7684\u65b9\u5f0f\uff0c\u9002\u5408\u521d\u5b66\u8005\u3002\u6b64\u5916\uff0cGDAL\u3001Rasterio\u548cFolium\u5e93\u4e5f\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u529f\u80fd\uff0c\u53ef\u4ee5\u7528\u4e8e\u4e0b\u8f7d\u548c\u5904\u7406tiff\u5730\u56fe\u74e6\u7247\u3002\u5229\u7528OGC\u6807\u51c6\u7684WMS\u670d\u52a1\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u83b7\u53d6tiff\u683c\u5f0f\u7684\u5730\u56fe\u74e6\u7247\u3002\u6839\u636e\u5177\u4f53\u9700\u6c42\u548c\u4f7f\u7528\u573a\u666f\uff0c\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u8fdb\u884c\u4e0b\u8f7d\u548c\u5904\u7406\u3002\u65e0\u8bba\u9009\u62e9\u54ea\u79cd\u65b9\u6cd5\uff0c\u90fd\u9700\u8981\u786e\u4fddWMS\u670d\u52a1\u7684URL\u548c\u8bf7\u6c42\u53c2\u6570\u6b63\u786e\uff0c\u4ee5\u4fdd\u8bc1\u8bf7\u6c42\u6210\u529f\u5e76\u83b7\u53d6\u5230\u6240\u9700\u7684tiff\u5730\u56fe\u74e6\u7247\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u4e0a\u8ff0\u4ecb\u7ecd\uff0c\u76f8\u4fe1\u4f60\u5df2\u7ecf\u638c\u63e1\u4e86\u5982\u4f55\u5728Python\u4e2d\u4e0b\u8f7dtiff\u5730\u56fe\u74e6\u7247\u7684\u65b9\u6cd5\u3002\u6839\u636e\u5b9e\u9645\u9700\u6c42\uff0c\u53ef\u4ee5\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u8fdb\u884c\u4e0b\u8f7d\u548c\u5904\u7406\u3002\u5e0c\u671b\u8fd9\u4e9b\u5185\u5bb9\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u4f7f\u7528Python\u4e0b\u8f7d\u7279\u5b9a\u533a\u57df\u7684TIFF\u5730\u56fe\u74e6\u7247\uff1f<\/strong><br \/>\u5728Python\u4e2d\u4e0b\u8f7d\u7279\u5b9a\u533a\u57df\u7684TIFF\u5730\u56fe\u74e6\u7247\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u5e93\u5982<code>requests<\/code>\u4e0e<code>Pillow<\/code>\uff08PIL\uff09\u6765\u83b7\u53d6\u548c\u5904\u7406\u5730\u56fe\u6570\u636e\u3002\u9996\u5148\uff0c\u786e\u5b9a\u8981\u4e0b\u8f7d\u7684\u5730\u56fe\u74e6\u7247\u7684URL\uff0c\u901a\u5e38\u8fd9\u4e9b\u74e6\u7247\u4f1a\u4ee5\u7279\u5b9a\u7684URL\u6a21\u5f0f\u63d0\u4f9b\u3002\u63a5\u7740\uff0c\u60a8\u53ef\u4ee5\u7f16\u5199\u4e00\u4e2a\u7b80\u5355\u7684\u811a\u672c\uff0c\u901a\u8fc7\u5faa\u73af\u6784\u9020URL\u5e76\u4e0b\u8f7d\u6240\u9700\u7684\u74e6\u7247\u3002\u4e0b\u8f7d\u540e\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528Pillow\u5e93\u5c06\u8fd9\u4e9b\u74e6\u7247\u5408\u6210\u4e00\u4e2a\u5b8c\u6574\u7684\u5730\u56fe\u56fe\u50cf\u3002<\/p>\n<p><strong>\u4e0b\u8f7dTIFF\u5730\u56fe\u74e6\u7247\u65f6\uff0c\u5982\u4f55\u5904\u7406\u4e0d\u540c\u7684\u5750\u6807\u7cfb\uff1f<\/strong><br \/>\u5f53\u4e0b\u8f7dTIFF\u5730\u56fe\u74e6\u7247\u65f6\uff0c\u786e\u4fdd\u60a8\u4e86\u89e3\u6240\u4f7f\u7528\u7684\u5750\u6807\u7cfb\u3002\u4e0d\u540c\u7684\u5730\u56fe\u670d\u52a1\u53ef\u80fd\u4f7f\u7528\u4e0d\u540c\u7684\u6295\u5f71\u65b9\u5f0f\uff0c\u4f8b\u5982WGS84\u6216Web Mercator\u3002\u60a8\u9700\u8981\u5c06\u6240\u9700\u7684\u7ecf\u7eac\u5ea6\u8f6c\u6362\u4e3a\u74e6\u7247\u5750\u6807\u3002\u8fd9\u901a\u5e38\u6d89\u53ca\u5230\u4e00\u4e9b\u6570\u5b66\u8ba1\u7b97\uff0c\u5982\u4f7f\u7528Zoom\u7ea7\u522b\u3001\u74e6\u7247\u5927\u5c0f\u7b49\u53c2\u6570\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528Python\u5e93\u5982<code>pyproj<\/code>\u6765\u5904\u7406\u5750\u6807\u8f6c\u6362\uff0c\u4ee5\u786e\u4fdd\u4e0b\u8f7d\u7684\u74e6\u7247\u80fd\u591f\u6b63\u786e\u53e0\u52a0\u3002<\/p>\n<p><strong>\u6709\u54ea\u4e9bPython\u5e93\u53ef\u4ee5\u5e2e\u52a9\u6211\u66f4\u8f7b\u677e\u5730\u4e0b\u8f7d\u548c\u5904\u7406TIFF\u5730\u56fe\u74e6\u7247\uff1f<\/strong><br \/>\u5728\u4e0b\u8f7d\u548c\u5904\u7406TIFF\u5730\u56fe\u74e6\u7247\u65f6\uff0c\u6709\u51e0\u4e2aPython\u5e93\u53ef\u4ee5\u975e\u5e38\u6709\u7528\u3002<code>requests<\/code>\u7528\u4e8e\u53d1\u8d77HTTP\u8bf7\u6c42\u4ee5\u4e0b\u8f7d\u74e6\u7247\uff0c<code>Pillow<\/code>\u7528\u4e8e\u56fe\u50cf\u5904\u7406\uff0c<code>rasterio<\/code>\u53ef\u7528\u4e8e\u8bfb\u53d6\u548c\u5199\u5165\u6805\u683c\u6570\u636e\uff0c\u5305\u62ecTIFF\u6587\u4ef6\u3002\u6b64\u5916\uff0c<code>geopandas<\/code>\u4e5f\u53ef\u4ee5\u5e2e\u52a9\u60a8\u5904\u7406\u7a7a\u95f4\u6570\u636e\uff0c\u65b9\u4fbf\u5730\u4e0e\u5730\u56fe\u74e6\u7247\u8fdb\u884c\u4ea4\u4e92\u3002\u7ed3\u5408\u8fd9\u4e9b\u5e93\uff0c\u60a8\u53ef\u4ee5\u6784\u5efa\u4e00\u4e2a\u5f3a\u5927\u7684\u5de5\u5177\u6765\u4e0b\u8f7d\u548c\u5904\u7406\u5730\u56fe\u74e6\u7247\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u4e0b\u8f7dtiff\u5730\u56fe\u74e6\u7247\u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93\u5982requests\u5e93\u3001gdal\u5e93\u3001rasterio\u5e93\u3001 [&hellip;]","protected":false},"author":3,"featured_media":1160753,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1160751"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=1160751"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1160751\/revisions"}],"predecessor-version":[{"id":1160755,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1160751\/revisions\/1160755"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1160753"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1160751"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1160751"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1160751"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}