{"id":1154883,"date":"2025-01-13T17:56:42","date_gmt":"2025-01-13T09:56:42","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1154883.html"},"modified":"2025-01-13T17:56:44","modified_gmt":"2025-01-13T09:56:44","slug":"arcgis%e4%b8%ad%e5%a6%82%e4%bd%95%e5%ae%89%e8%a3%85python","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1154883.html","title":{"rendered":"arcgis\u4e2d\u5982\u4f55\u5b89\u88c5python"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25184352\/89391302-7a54-4797-aa28-576d59a4adbb.webp\" alt=\"arcgis\u4e2d\u5982\u4f55\u5b89\u88c5python\" \/><\/p>\n<p><p> <strong>\u5728ArcGIS\u4e2d\u5b89\u88c5Python\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u4e3b\u8981\u5305\u62ec\u4f7f\u7528ArcGIS Pro\u81ea\u5e26\u7684Python\u73af\u5883\u3001\u4f7f\u7528Anaconda\u521b\u5efa\u865a\u62df\u73af\u5883\u3001\u4f7f\u7528ArcGIS API for Python\u3001\u4f7f\u7528ArcGIS Notebook\u3002<\/strong>\u5176\u4e2d\uff0c<strong>\u4f7f\u7528ArcGIS Pro\u81ea\u5e26\u7684Python\u73af\u5883<\/strong>\u662f\u6700\u4e3a\u7b80\u5355\u548c\u76f4\u63a5\u7684\u65b9\u6cd5\uff0c\u56e0\u4e3aArcGIS Pro\u81ea\u5e26\u4e86\u4e00\u4e2a\u914d\u7f6e\u5b8c\u5584\u7684Python\u73af\u5883\uff0c\u7528\u6237\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u800c\u65e0\u9700\u989d\u5916\u914d\u7f6e\u3002<\/p>\n<\/p>\n<p><p>\u4e0b\u9762\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528ArcGIS Pro\u81ea\u5e26\u7684Python\u73af\u5883\uff1a<\/p>\n<\/p>\n<p><p>ArcGIS Pro\u81ea\u5e26\u7684Python\u73af\u5883\u5df2\u7ecf\u914d\u7f6e\u597d\u4e86\u4e0eArcGIS\u5de5\u5177\u96c6\u6210\u7684\u5fc5\u8981\u5305\u548c\u6a21\u5757\uff0c\u56e0\u6b64\u7528\u6237\u65e0\u9700\u989d\u5916\u914d\u7f6e\uff0c\u53ea\u9700\u5b89\u88c5ArcGIS Pro\u5373\u53ef\u83b7\u5f97\u4e00\u4e2a\u5b8c\u6574\u7684Python\u73af\u5883\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u6765\u4f7f\u7528Python\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6253\u5f00ArcGIS Pro\u5e76\u542f\u52a8Python\u7a97\u53e3<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u6253\u5f00ArcGIS Pro\u5e94\u7528\u7a0b\u5e8f\u3002<\/li>\n<li>\u5728\u83dc\u5355\u680f\u4e2d\u9009\u62e9\u201c\u89c6\u56fe\u201d\u9009\u9879\u5361\u3002<\/li>\n<li>\u70b9\u51fb\u201cPython\u201d\u6309\u94ae\uff0c\u6253\u5f00Python\u7a97\u53e3\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528Python\u7a97\u53e3\u8fdb\u884c\u7f16\u7a0b<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u5728Python\u7a97\u53e3\u4e2d\u8f93\u5165Python\u4ee3\u7801\uff0c\u5e76\u6309Enter\u952e\u6267\u884c\u3002<\/li>\n<li>\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528ArcGIS Pro\u4e2d\u7684\u5404\u79cdGIS\u5de5\u5177\u548cPython\u5e93\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u5728ArcGIS Pro\u4e2d\u4f7f\u7528Jupyter Notebook<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>ArcGIS Pro\u8fd8\u652f\u6301\u4f7f\u7528Jupyter Notebook\u6765\u7f16\u5199\u548c\u8fd0\u884cPython\u4ee3\u7801\u3002<\/li>\n<li>\u5728Python\u7a97\u53e3\u4e2d\u8f93\u5165 <code>import jupyter<\/code> \u6765\u542f\u52a8Jupyter Notebook\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5\u5176\u4ed6Python\u5305<\/strong>\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u5982\u679c\u9700\u8981\u5b89\u88c5\u5176\u4ed6Python\u5305\uff0c\u53ef\u4ee5\u4f7f\u7528ArcGIS Pro\u81ea\u5e26\u7684\u5305\u7ba1\u7406\u5de5\u5177\u3002\u5728Python\u7a97\u53e3\u4e2d\u8f93\u5165 <code>import pip<\/code>\uff0c\u7136\u540e\u4f7f\u7528pip\u547d\u4ee4\u5b89\u88c5\u6240\u9700\u7684\u5305\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><p>\u8be6\u7ec6\u4ecb\u7ecd\u5b8c\u4f7f\u7528ArcGIS Pro\u81ea\u5e26\u7684Python\u73af\u5883\u540e\uff0c\u63a5\u4e0b\u6765\u6211\u4eec\u5c06\u63a2\u8ba8\u5176\u4ed6\u51e0\u79cd\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><h2>\u4e00\u3001\u4f7f\u7528Anaconda\u521b\u5efa\u865a\u62df\u73af\u5883<\/h2>\n<\/p>\n<p><h3>\u5b89\u88c5Anaconda<\/h3>\n<\/p>\n<p><p>Anaconda\u662f\u4e00\u4e2a\u6d41\u884c\u7684Python\u53d1\u884c\u7248\uff0c\u5305\u542b\u4e86\u8bb8\u591a\u6709\u7528\u7684\u5305\u548c\u5de5\u5177\u3002\u9996\u5148\uff0c\u9700\u8981\u4eceAnaconda\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u5e76\u5b89\u88c5Anaconda\u3002<\/p>\n<\/p>\n<p><h3>\u521b\u5efa\u865a\u62df\u73af\u5883<\/h3>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7Anaconda\u521b\u5efa\u4e00\u4e2a\u865a\u62df\u73af\u5883\u6765\u5b89\u88c5\u548c\u7ba1\u7406Python\u5305\u3002<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00Anaconda Prompt\u3002<\/li>\n<li>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u865a\u62df\u73af\u5883\uff0c\u4f8b\u5982\u201carcgis\u201d\uff1a\n<pre><code class=\"language-sh\">conda create -n arcgis python=3.8<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u6fc0\u6d3b\u865a\u62df\u73af\u5883\uff1a\n<pre><code class=\"language-sh\">conda activate arcgis<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u5b89\u88c5ArcGIS API for Python<\/h3>\n<\/p>\n<p><p>\u5728\u6fc0\u6d3b\u7684\u865a\u62df\u73af\u5883\u4e2d\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5ArcGIS API for Python\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">conda install -c esri arcgis<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4f7f\u7528\u865a\u62df\u73af\u5883<\/h3>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u5728\u865a\u62df\u73af\u5883\u4e2d\u8fd0\u884cPython\u4ee3\u7801\uff0c\u4f7f\u7528ArcGIS API\u8fdb\u884c\u5730\u7406\u7a7a\u95f4\u5206\u6790\u548c\u6570\u636e\u5904\u7406\u3002<\/p>\n<\/p>\n<p><h2>\u4e8c\u3001\u4f7f\u7528ArcGIS API for Python<\/h2>\n<\/p>\n<p><h3>\u5b89\u88c5ArcGIS API for Python<\/h3>\n<\/p>\n<p><p>\u5982\u679c\u4e0d\u60f3\u4f7f\u7528Anaconda\uff0c\u53ef\u4ee5\u76f4\u63a5\u5728\u672c\u5730Python\u73af\u5883\u4e2d\u5b89\u88c5ArcGIS API for Python\u3002<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u3002<\/li>\n<li>\u4f7f\u7528pip\u547d\u4ee4\u5b89\u88c5ArcGIS API for Python\uff1a\n<pre><code class=\"language-sh\">pip install arcgis<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u4f7f\u7528ArcGIS API\u8fdb\u884c\u7f16\u7a0b<\/h3>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u5728Python\u811a\u672c\u4e2d\u5bfc\u5165arcgis\u5305\u5e76\u8fdb\u884c\u7f16\u7a0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from arcgis.gis import GIS<\/p>\n<p>gis = GIS()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7ArcGIS API\uff0c\u53ef\u4ee5\u8bbf\u95eeArcGIS Online\u548cArcGIS Enterprise\u4e2d\u7684\u5404\u79cd\u670d\u52a1\u548c\u8d44\u6e90\u3002<\/p>\n<\/p>\n<p><h2>\u4e09\u3001\u4f7f\u7528ArcGIS Notebook<\/h2>\n<\/p>\n<p><h3>\u542f\u52a8ArcGIS Notebook<\/h3>\n<\/p>\n<p><p>ArcGIS Notebook\u662f\u4e00\u4e2a\u57fa\u4e8eJupyter Notebook\u7684\u5de5\u5177\uff0c\u96c6\u6210\u4e86ArcGIS\u7684\u529f\u80fd\u548cPython\u7f16\u7a0b\u73af\u5883\u3002<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00ArcGIS Pro\u3002<\/li>\n<li>\u5728\u83dc\u5355\u680f\u4e2d\u9009\u62e9\u201cInsert\u201d\u9009\u9879\u5361\u3002<\/li>\n<li>\u70b9\u51fb\u201cNew Notebook\u201d\u6309\u94ae\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Notebook\u3002<\/li>\n<\/ol>\n<p><h3>\u4f7f\u7528ArcGIS Notebook\u8fdb\u884c\u7f16\u7a0b<\/h3>\n<\/p>\n<p><p>\u5728Notebook\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528Python\u7f16\u5199\u4ee3\u7801\uff0c\u6267\u884c\u5730\u7406\u7a7a\u95f4\u5206\u6790\uff0c\u521b\u5efa\u5730\u56fe\u548c\u56fe\u8868\u7b49\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from arcgis.gis import GIS<\/p>\n<p>from arcgis.geocoding import geocode<\/p>\n<p>gis = GIS()<\/p>\n<p>location = geocode(&quot;1600 Pennsylvania Ave NW, Washington, DC 20500&quot;)[0]<\/p>\n<p>map = gis.map()<\/p>\n<p>map.add_layer(location)<\/p>\n<p>map<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u56db\u3001\u5176\u4ed6\u65b9\u6cd5\u548c\u5de5\u5177<\/h2>\n<\/p>\n<p><h3>\u4f7f\u7528Python\u5305\u7ba1\u7406\u5668<\/h3>\n<\/p>\n<p><p>\u9664\u4e86Anaconda\u548cpip\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528\u5176\u4ed6Python\u5305\u7ba1\u7406\u5668\u6765\u5b89\u88c5\u548c\u7ba1\u7406Python\u5305\uff0c\u4f8b\u5982Poetry\u548cPipenv\u3002<\/p>\n<\/p>\n<p><h3>\u4f7f\u7528Docker<\/h3>\n<\/p>\n<p><p>Docker\u662f\u4e00\u4e2a\u5bb9\u5668\u5316\u5de5\u5177\uff0c\u53ef\u4ee5\u7528\u6765\u521b\u5efa\u548c\u7ba1\u7406\u9694\u79bb\u7684\u73af\u5883\u3002\u5728Docker\u4e2d\uff0c\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u5305\u542bArcGIS\u548cPython\u7684\u5bb9\u5668\uff0c\u5b9e\u73b0\u73af\u5883\u7684\u5feb\u901f\u90e8\u7f72\u548c\u7ba1\u7406\u3002<\/p>\n<\/p>\n<p><h3>\u4f7f\u7528\u865a\u62df\u673a<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u5728\u865a\u62df\u673a\u4e2d\u5b89\u88c5ArcGIS\u548cPython\uff0c\u521b\u5efa\u4e00\u4e2a\u72ec\u7acb\u7684\u5f00\u53d1\u73af\u5883\u3002\u8fd9\u79cd\u65b9\u6cd5\u9002\u7528\u4e8e\u9700\u8981\u5728\u591a\u4e2a\u64cd\u4f5c\u7cfb\u7edf\u4e4b\u95f4\u5207\u6362\u7684\u7528\u6237\u3002<\/p>\n<\/p>\n<p><h2>\u4e94\u3001\u5b89\u88c5\u548c\u914d\u7f6ePython\u5305<\/h2>\n<\/p>\n<p><h3>\u4f7f\u7528pip\u5b89\u88c5Python\u5305<\/h3>\n<\/p>\n<p><p>pip\u662fPython\u7684\u5305\u7ba1\u7406\u5668\uff0c\u53ef\u4ee5\u7528\u6765\u5b89\u88c5\u548c\u7ba1\u7406Python\u5305\u3002\u4f7f\u7528pip\u5b89\u88c5\u5305\u975e\u5e38\u7b80\u5355\uff0c\u53ea\u9700\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install \u5305\u540d<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4f7f\u7528conda\u5b89\u88c5Python\u5305<\/h3>\n<\/p>\n<p><p>conda\u662fAnaconda\u7684\u5305\u7ba1\u7406\u5668\uff0c\u53ef\u4ee5\u7528\u6765\u5b89\u88c5\u548c\u7ba1\u7406Python\u5305\u3002\u4f7f\u7528conda\u5b89\u88c5\u5305\u7684\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">conda install \u5305\u540d<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u914d\u7f6ePython\u5305<\/h3>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u5728Python\u811a\u672c\u4e2d\u5bfc\u5165\u5305\u5e76\u8fdb\u884c\u914d\u7f6e\u3002\u4f8b\u5982\uff0c\u5bfc\u5165NumPy\u5e93\u5e76\u914d\u7f6e\u6570\u7ec4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import numpy as np<\/p>\n<p>array = np.array([1, 2, 3, 4])<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u66f4\u65b0\u548c\u5378\u8f7dPython\u5305<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528pip\u548cconda\u66f4\u65b0\u548c\u5378\u8f7dPython\u5305\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install --upgrade \u5305\u540d<\/p>\n<p>pip uninstall \u5305\u540d<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><pre><code class=\"language-sh\">conda update \u5305\u540d<\/p>\n<p>conda remove \u5305\u540d<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u68c0\u67e5Python\u5305\u7248\u672c<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u68c0\u67e5\u5df2\u5b89\u88c5\u5305\u7684\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip show \u5305\u540d<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><pre><code class=\"language-sh\">conda list \u5305\u540d<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u516d\u3001\u4f7f\u7528ArcGIS Pro\u4e0ePython\u96c6\u6210<\/h2>\n<\/p>\n<p><h3>\u5728ArcGIS Pro\u4e2d\u4f7f\u7528Python\u7a97\u53e3<\/h3>\n<\/p>\n<p><p>ArcGIS Pro\u81ea\u5e26\u4e00\u4e2aPython\u7a97\u53e3\uff0c\u53ef\u4ee5\u76f4\u63a5\u5728\u5176\u4e2d\u7f16\u5199\u548c\u6267\u884cPython\u4ee3\u7801\u3002Python\u7a97\u53e3\u652f\u6301\u81ea\u52a8\u8865\u5168\u548c\u8bed\u6cd5\u9ad8\u4eae\uff0c\u975e\u5e38\u9002\u5408\u8fdb\u884c\u5feb\u901f\u6d4b\u8bd5\u548c\u539f\u578b\u5f00\u53d1\u3002<\/p>\n<\/p>\n<p><h3>\u4f7f\u7528ArcPy\u8fdb\u884c\u5730\u7406\u5904\u7406<\/h3>\n<\/p>\n<p><p>ArcPy\u662fArcGIS Pro\u4e2d\u7684Python\u6a21\u5757\uff0c\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u5730\u7406\u5904\u7406\u5de5\u5177\u3002\u53ef\u4ee5\u5728Python\u7a97\u53e3\u4e2d\u5bfc\u5165ArcPy\u5e76\u4f7f\u7528\u5176\u5de5\u5177\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import arcpy<\/p>\n<p>arcpy.Buffer_analysis(&quot;input.shp&quot;, &quot;output.shp&quot;, &quot;100 Meters&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4f7f\u7528ArcGIS API for Python<\/h3>\n<\/p>\n<p><p>ArcGIS API for Python\u63d0\u4f9b\u4e86\u4e00\u7ec4\u7528\u4e8e\u8bbf\u95ee\u548c\u64cd\u4f5cArcGIS Online\u548cArcGIS Enterprise\u7684\u5de5\u5177\u3002\u53ef\u4ee5\u5728Python\u7a97\u53e3\u4e2d\u5bfc\u5165arcgis\u5305\u5e76\u4f7f\u7528\u5176\u529f\u80fd\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from arcgis.gis import GIS<\/p>\n<p>gis = GIS()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u4e03\u3001\u4f7f\u7528Jupyter Notebook<\/h2>\n<\/p>\n<p><h3>\u5b89\u88c5Jupyter Notebook<\/h3>\n<\/p>\n<p><p>Jupyter Notebook\u662f\u4e00\u4e2a\u57fa\u4e8eWeb\u7684\u4ea4\u4e92\u5f0f\u7f16\u7a0b\u73af\u5883\uff0c\u53ef\u4ee5\u7528\u6765\u7f16\u5199\u548c\u8fd0\u884cPython\u4ee3\u7801\u3002\u53ef\u4ee5\u4f7f\u7528pip\u6216conda\u5b89\u88c5Jupyter Notebook\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install notebook<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><pre><code class=\"language-sh\">conda install jupyter<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u542f\u52a8Jupyter Notebook<\/h3>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8Jupyter Notebook\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">jupyter notebook<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4f7f\u7528Jupyter Notebook\u8fdb\u884c\u7f16\u7a0b<\/h3>\n<\/p>\n<p><p>\u5728Jupyter Notebook\u4e2d\uff0c\u53ef\u4ee5\u521b\u5efa\u65b0\u7684Notebook\uff0c\u7f16\u5199\u548c\u8fd0\u884cPython\u4ee3\u7801\u3002Notebook\u652f\u6301Markdown\u548c\u4ee3\u7801\u5355\u5143\uff0c\u65b9\u4fbf\u8fdb\u884c\u6587\u6863\u7f16\u5199\u548c\u4ee3\u7801\u6267\u884c\u3002<\/p>\n<\/p>\n<p><h3>\u5bfc\u5165\u548c\u4f7f\u7528ArcGIS API for Python<\/h3>\n<\/p>\n<p><p>\u5728Notebook\u4e2d\uff0c\u53ef\u4ee5\u5bfc\u5165arcgis\u5305\u5e76\u4f7f\u7528\u5176\u529f\u80fd\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from arcgis.gis import GIS<\/p>\n<p>from arcgis.geocoding import geocode<\/p>\n<p>gis = GIS()<\/p>\n<p>location = geocode(&quot;1600 Pennsylvania Ave NW, Washington, DC 20500&quot;)[0]<\/p>\n<p>map = gis.map()<\/p>\n<p>map.add_layer(location)<\/p>\n<p>map<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4f7f\u7528\u53ef\u89c6\u5316\u5de5\u5177<\/h3>\n<\/p>\n<p><p>Jupyter Notebook\u652f\u6301\u591a\u79cd\u53ef\u89c6\u5316\u5de5\u5177\uff0c\u4f8b\u5982Matplotlib\u3001Seaborn\u3001Plotly\u7b49\u3002\u53ef\u4ee5\u5728Notebook\u4e2d\u521b\u5efa\u5404\u79cd\u56fe\u8868\u548c\u5730\u56fe\uff0c\u8fdb\u884c\u6570\u636e\u5206\u6790\u548c\u53ef\u89c6\u5316\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import matplotlib.pyplot as plt<\/p>\n<p>import seaborn as sns<\/p>\n<p>data = sns.load_dataset(&quot;iris&quot;)<\/p>\n<p>sns.p<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>rplot(data, hue=&quot;species&quot;)<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4fdd\u5b58\u548c\u5bfc\u51faNotebook<\/h3>\n<\/p>\n<p><p>Jupyter Notebook\u652f\u6301\u5c06Notebook\u4fdd\u5b58\u4e3a\u591a\u79cd\u683c\u5f0f\uff0c\u4f8b\u5982HTML\u3001PDF\u7b49\u3002\u53ef\u4ee5\u5728Notebook\u83dc\u5355\u4e2d\u9009\u62e9\u201cFile\u201d-&gt;\u201cDownload as\u201d\uff0c\u9009\u62e9\u9700\u8981\u7684\u683c\u5f0f\u8fdb\u884c\u5bfc\u51fa\u3002<\/p>\n<\/p>\n<p><h2>\u516b\u3001\u4f7f\u7528ArcGIS Online\u548cArcGIS Enterprise<\/h2>\n<\/p>\n<p><h3>\u8bbf\u95eeArcGIS Online<\/h3>\n<\/p>\n<p><p>ArcGIS Online\u662f\u4e00\u4e2a\u57fa\u4e8e\u4e91\u7684\u5730\u7406\u4fe1\u606f\u7cfb\u7edf\uff0c\u53ef\u4ee5\u7528\u6765\u521b\u5efa\u548c\u5171\u4eab\u5730\u56fe\u3001\u5e94\u7528\u7a0b\u5e8f\u548c\u6570\u636e\u3002\u53ef\u4ee5\u4f7f\u7528ArcGIS API for Python\u8bbf\u95eeArcGIS Online\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from arcgis.gis import GIS<\/p>\n<p>gis = GIS(&quot;https:\/\/www.arcgis.com&quot;, &quot;username&quot;, &quot;password&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u8bbf\u95eeArcGIS Enterprise<\/h3>\n<\/p>\n<p><p>ArcGIS Enterprise\u662f\u4e00\u4e2a\u672c\u5730\u90e8\u7f72\u7684\u5730\u7406\u4fe1\u606f\u7cfb\u7edf\uff0c\u53ef\u4ee5\u7528\u6765\u7ba1\u7406\u3001\u5206\u6790\u548c\u5171\u4eab\u5730\u7406\u7a7a\u95f4\u6570\u636e\u3002\u53ef\u4ee5\u4f7f\u7528ArcGIS API for Python\u8bbf\u95eeArcGIS Enterprise\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from arcgis.gis import GIS<\/p>\n<p>gis = GIS(&quot;https:\/\/your-enterprise-url.com&quot;, &quot;username&quot;, &quot;password&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u521b\u5efa\u548c\u7ba1\u7406Web\u5730\u56fe<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528ArcGIS API for Python\u521b\u5efa\u548c\u7ba1\u7406Web\u5730\u56fe\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from arcgis.gis import GIS<\/p>\n<p>from arcgis.mapping import WebMap<\/p>\n<p>gis = GIS()<\/p>\n<p>web_map = WebMap()<\/p>\n<p>web_map.add_layer({&quot;type&quot;: &quot;FeatureLayer&quot;, &quot;url&quot;: &quot;https:\/\/sampleserver6.arcgisonline.com\/arcgis\/rest\/services\/USA\/MapServer\/0&quot;})<\/p>\n<p>web_map.save({&quot;title&quot;: &quot;My Web Map&quot;, &quot;tags&quot;: &quot;example&quot;})<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u5206\u6790\u548c\u5904\u7406\u5730\u7406\u7a7a\u95f4\u6570\u636e<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528ArcGIS API for Python\u8fdb\u884c\u5730\u7406\u7a7a\u95f4\u6570\u636e\u7684\u5206\u6790\u548c\u5904\u7406\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from arcgis.features import FeatureLayer<\/p>\n<p>layer = FeatureLayer(&quot;https:\/\/sampleserver6.arcgisonline.com\/arcgis\/rest\/services\/USA\/MapServer\/0&quot;)<\/p>\n<p>query_result = layer.query(where=&quot;POP2000 &gt; 1000000&quot;, out_fields=&quot;NAME, POP2000&quot;)<\/p>\n<p>for feature in query_result:<\/p>\n<p>    print(feature.attributes)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u4e5d\u3001\u4f7f\u7528ArcGIS Notebooks Server<\/h2>\n<\/p>\n<p><h3>\u5b89\u88c5\u548c\u914d\u7f6eArcGIS Notebooks Server<\/h3>\n<\/p>\n<p><p>ArcGIS Notebooks Server\u662f\u4e00\u4e2aJupyter Notebook\u670d\u52a1\u5668\uff0c\u96c6\u6210\u4e86ArcGIS\u7684\u529f\u80fd\u548c\u5de5\u5177\u3002\u53ef\u4ee5\u5728ArcGIS Enterprise\u4e2d\u5b89\u88c5\u548c\u914d\u7f6eArcGIS Notebooks Server\u3002<\/p>\n<\/p>\n<p><h3>\u521b\u5efa\u548c\u7ba1\u7406Notebook<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528ArcGIS Notebooks Server\u521b\u5efa\u548c\u7ba1\u7406Notebook\uff0c\u8fdb\u884c\u5730\u7406\u7a7a\u95f4\u5206\u6790\u548c\u6570\u636e\u5904\u7406\u3002Notebook\u652f\u6301ArcGIS API for Python\u548c\u5176\u4ed6Python\u5e93\uff0c\u65b9\u4fbf\u8fdb\u884c\u7efc\u5408\u5206\u6790\u548c\u53ef\u89c6\u5316\u3002<\/p>\n<\/p>\n<p><h3>\u5171\u4eab\u548c\u534f\u4f5c<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u5c06Notebook\u5171\u4eab\u7ed9\u5176\u4ed6\u7528\u6237\uff0c\u8fdb\u884c\u534f\u4f5c\u548c\u4ea4\u6d41\u3002ArcGIS Notebooks Server\u652f\u6301\u591a\u7528\u6237\u8bbf\u95ee\u548c\u6743\u9650\u7ba1\u7406\uff0c\u786e\u4fdd\u6570\u636e\u548c\u4ee3\u7801\u7684\u5b89\u5168\u6027\u3002<\/p>\n<\/p>\n<p><h2>\u5341\u3001\u4f7f\u7528ArcGIS\u7684\u5176\u4ed6\u5de5\u5177\u548c\u8d44\u6e90<\/h2>\n<\/p>\n<p><h3>ArcGIS Developer<\/h3>\n<\/p>\n<p><p>ArcGIS Developer\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u5f00\u53d1\u5de5\u5177\u548c\u8d44\u6e90\uff0c\u53ef\u4ee5\u7528\u6765\u521b\u5efa\u81ea\u5b9a\u4e49\u7684GIS\u5e94\u7528\u7a0b\u5e8f\u548c\u89e3\u51b3\u65b9\u6848\u3002\u53ef\u4ee5\u8bbf\u95eeArcGIS Developer\u7f51\u7ad9\uff0c\u83b7\u53d6API\u6587\u6863\u3001\u793a\u4f8b\u4ee3\u7801\u548c\u6280\u672f\u652f\u6301\u3002<\/p>\n<\/p>\n<p><h3>ArcGIS Hub<\/h3>\n<\/p>\n<p><p>ArcGIS Hub\u662f\u4e00\u4e2a\u793e\u533a\u53c2\u4e0e\u5e73\u53f0\uff0c\u53ef\u4ee5\u7528\u6765\u53d1\u5e03\u548c\u5171\u4eabGIS\u6570\u636e\u3001\u5e94\u7528\u7a0b\u5e8f\u548c\u9879\u76ee\u3002\u53ef\u4ee5\u4f7f\u7528ArcGIS API for Python\u8bbf\u95ee\u548c\u7ba1\u7406ArcGIS Hub\u8d44\u6e90\u3002<\/p>\n<\/p>\n<p><h3>ArcGIS Marketplace<\/h3>\n<\/p>\n<p><p>ArcGIS Marketplace\u662f\u4e00\u4e2a\u5728\u7ebf\u5546\u5e97\uff0c\u53ef\u4ee5\u7528\u6765\u67e5\u627e\u548c\u8d2d\u4e70GIS\u5e94\u7528\u7a0b\u5e8f\u3001\u6570\u636e\u548c\u670d\u52a1\u3002\u53ef\u4ee5\u5728ArcGIS Marketplace\u4e2d\u641c\u7d22\u548c\u8ba2\u8d2d\u6240\u9700\u7684\u8d44\u6e90\u3002<\/p>\n<\/p>\n<p><h3>ArcGIS \u5728\u7ebf\u57f9\u8bad\u548c\u6587\u6863<\/h3>\n<\/p>\n<p><p>Esri\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u5728\u7ebf\u57f9\u8bad\u548c\u6587\u6863\u8d44\u6e90\uff0c\u53ef\u4ee5\u5e2e\u52a9\u7528\u6237\u5b66\u4e60\u548c\u638c\u63e1ArcGIS\u7684\u5404\u79cd\u529f\u80fd\u548c\u5de5\u5177\u3002\u53ef\u4ee5\u8bbf\u95eeEsri\u57f9\u8bad\u7f51\u7ad9\uff0c\u6ce8\u518c\u8bfe\u7a0b\u548c\u89c2\u770b\u89c6\u9891\u6559\u7a0b\u3002<\/p>\n<\/p>\n<p><h3>\u793e\u533a\u548c\u652f\u6301<\/h3>\n<\/p>\n<p><p>\u53ef\u4ee5\u52a0\u5165Esri\u793e\u533a\uff0c\u53c2\u4e0e\u8ba8\u8bba\u548c\u4ea4\u6d41\uff0c\u83b7\u53d6\u6280\u672f\u652f\u6301\u548c\u5e2e\u52a9\u3002Esri\u793e\u533a\u63d0\u4f9b\u4e86\u8bba\u575b\u3001\u535a\u5ba2\u3001\u6280\u672f\u6587\u7ae0\u548c\u6848\u4f8b\u7814\u7a76\u7b49\u4e30\u5bcc\u7684\u8d44\u6e90\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u4ecb\u7ecd\uff0c\u6211\u4eec\u53ef\u4ee5\u770b\u5230\uff0c<strong>\u5728ArcGIS\u4e2d\u5b89\u88c5\u548c\u4f7f\u7528Python\u7684\u65b9\u6cd5\u591a\u79cd\u591a\u6837<\/strong>\uff0c\u7528\u6237\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u9700\u6c42\u548c\u73af\u5883\u9009\u62e9\u6700\u9002\u5408\u7684\u65b9\u6cd5\u3002\u65e0\u8bba\u662f\u4f7f\u7528ArcGIS Pro\u81ea\u5e26\u7684Python\u73af\u5883\uff0c\u8fd8\u662f\u4f7f\u7528Anaconda\u521b\u5efa\u865a\u62df\u73af\u5883\uff0c\u6216\u8005\u4f7f\u7528ArcGIS API for Python\uff0c\u7528\u6237\u90fd\u53ef\u4ee5\u65b9\u4fbf\u5730\u8fdb\u884c\u5730\u7406\u7a7a\u95f4\u5206\u6790\u548c\u6570\u636e\u5904\u7406\u3002\u5e0c\u671b\u901a\u8fc7\u672c\u6587\u7684\u4ecb\u7ecd\uff0c\u80fd\u591f\u5e2e\u52a9\u7528\u6237\u66f4\u597d\u5730\u638c\u63e1\u548c\u4f7f\u7528ArcGIS\u4e0ePython\u7684\u96c6\u6210\uff0c\u63d0\u5347\u5de5\u4f5c\u6548\u7387\u548c\u6570\u636e\u5206\u6790\u80fd\u529b\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5728ArcGIS\u4e2d\u5b89\u88c5Python\u7684\u6b65\u9aa4\u662f\u4ec0\u4e48\uff1f<\/strong><br \/>\u5728ArcGIS\u4e2d\uff0cPython\u901a\u5e38\u968fArcGIS\u8f6f\u4ef6\u4e00\u8d77\u5b89\u88c5\u3002\u7528\u6237\u53ef\u4ee5\u901a\u8fc7ArcGIS Pro\u81ea\u5e26\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff08\u5982conda\uff09\u6765\u7ba1\u7406Python\u73af\u5883\u548c\u5e93\u3002\u5982\u679c\u9700\u8981\u5b89\u88c5\u7279\u5b9a\u7248\u672c\u7684Python\u6216\u989d\u5916\u7684\u5e93\uff0c\u53ef\u4ee5\u4f7f\u7528ArcGIS Pro\u7684Python\u7a97\u53e3\u6216\u547d\u4ee4\u884c\u754c\u9762\u8f93\u5165\u76f8\u5173\u547d\u4ee4\uff0c\u786e\u4fdd\u6240\u9700\u7684Python\u5305\u548c\u4f9d\u8d56\u9879\u5f97\u5230\u6b63\u786e\u5b89\u88c5\u3002<\/p>\n<p><strong>ArcGIS\u652f\u6301\u54ea\u4e9b\u7248\u672c\u7684Python\uff1f<\/strong><br \/>ArcGIS Pro\u652f\u6301Python 3.x\u7248\u672c\uff0c\u5177\u4f53\u7248\u672c\u53d6\u51b3\u4e8eArcGIS Pro\u7684\u7248\u672c\u3002\u7528\u6237\u53ef\u4ee5\u5728ArcGIS\u7684\u5b98\u65b9\u7f51\u7ad9\u6216\u6587\u6863\u4e2d\u67e5\u627e\u4e0e\u81ea\u5df1\u4f7f\u7528\u7684ArcGIS Pro\u7248\u672c\u517c\u5bb9\u7684Python\u7248\u672c\u4fe1\u606f\u3002\u5bf9\u4e8eArcMap\uff0c\u901a\u5e38\u4f7f\u7528\u7684\u662fPython 2.x\u7248\u672c\uff0c\u4f46\u7528\u6237\u5e94\u8003\u8651\u8fc1\u79fb\u5230ArcGIS Pro\u4ee5\u83b7\u5f97\u66f4\u597d\u7684\u652f\u6301\u548c\u529f\u80fd\u3002<\/p>\n<p><strong>\u5982\u4f55\u68c0\u67e5ArcGIS\u4e2d\u5b89\u88c5\u7684Python\u5e93\uff1f<\/strong><br \/>\u7528\u6237\u53ef\u4ee5\u901a\u8fc7ArcGIS Pro\u7684Python\u7a97\u53e3\u6765\u68c0\u67e5\u5df2\u5b89\u88c5\u7684\u5e93\u3002\u5728Python\u7a97\u53e3\u4e2d\u8f93\u5165\u547d\u4ee4<code>!pip list<\/code>\uff0c\u53ef\u4ee5\u5217\u51fa\u6240\u6709\u5df2\u5b89\u88c5\u7684Python\u5e93\u53ca\u5176\u7248\u672c\u3002\u6b64\u5916\uff0c\u4f7f\u7528Anaconda Navigator\u4e5f\u53ef\u4ee5\u65b9\u4fbf\u5730\u67e5\u770b\u548c\u7ba1\u7406Python\u73af\u5883\u4e2d\u7684\u5e93\uff0c\u786e\u4fdd\u9879\u76ee\u6240\u9700\u7684\u4f9d\u8d56\u9879\u90fd\u5df2\u7ecf\u5b89\u88c5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728ArcGIS\u4e2d\u5b89\u88c5Python\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u4e3b\u8981\u5305\u62ec\u4f7f\u7528ArcGIS Pro\u81ea\u5e26\u7684Python\u73af\u5883\u3001\u4f7f\u7528An [&hellip;]","protected":false},"author":3,"featured_media":1154885,"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\/1154883"}],"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=1154883"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1154883\/revisions"}],"predecessor-version":[{"id":1154886,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1154883\/revisions\/1154886"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1154885"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1154883"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1154883"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1154883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}