ArcGIS Pro 构建地图识别工具
his tutorial demonstrates how to create an ArcGIS Pro add-in with a custom map identification tool.
With the ArcGIS Pro SDK for .NET, you can extend ArcGIS Pro with your own unique tools and workflows. Using Microsoft Visual Studio and the Pro SDK, developers can build Pro add-ins and solution configurations that provide users with custom functionality specific to their organization or industry.
In this tutorial, you will use C# to create a new map tool for feature identification which allows you to draw a circular selection area on the map and view the total number of features per feature layer found within the selection area.
Tip
For more information, see the ArcGIS Pro wiki map exploration and map tools. Or see the ArcGIS Pro SDK API reference. For more samples, see the ArcGIS Pro user community's Map Exploration samples.
Prerequisites
- Microsoft Visual Studio is required. See the ArcGIS Pro system requirements for latest version and compatibility.
- Install ArcGIS Pro version 3.0 or higher.
- Install the ArcGIS Pro SDK for .NET. See the Installation ProGuide for more information.
- This tutorial uses Pro SDK Community sample data typically saved to your local C: drive.
Steps
Create a new ArcGIS Pro Add-In Visual Studio Project
-
Start Visual Studio.
-
Choose File > New > Project and then from ArcGIS templates group, select ArcGIS Pro Module Add-in. Name the add-in project "MapToolIdentify".
Create a new Pro map tool
-
Right-click the project and choose Add > New Item and then from the ArcGIS Pro Add-ins group select ArcGIS Pro Map Tool from the list of item templates. Name the new class file IdentifyTool.cs and then click Add to close the dialog box.
-
Open the
Config.daml
file and modify the tool item as shown in the following code: -
Compile and build the add-in project with Build > Build Solution.
-
Once the build succeeds, click Start to start the debugger in ArcGIS Pro. When the ArcGIS Pro start page appears, select the previously-installed Pro SDK Community sample project:
C:\\Data\\Interacting with Maps\\Interacting with Maps.aprx
. -
Click the Add-In tab to confirm that your new map tool UI appears on the ribbon with the caption, tooltip, and the other modifications from step 4.
-
Close ArcGIS Pro and stop debugging.
Create the identify map tool code and test
-
Open the
IdentifyTool.cs
file and add the followingusing
statements: -
Modify the
IdentifyTool()
constructor as follows: -
Modify the
OnSketchCompleteAsync
as follows, adding theasync
keyword to the method declaration: -
Rebuild your solution and fix any compilation errors. Click Start to start the debugger in ArcGIS Pro. Open the same
Interacting with Maps.aprx
project from the previous step. -
Zoom in on an area of the map containing features from the different feature layers to confirm that your new Identify tool functions as expected. Click and hold to define the center point of your selection circle, and drag away to define the radius. Once you release the mouse button, a message box should appear with the number of visible features found within the circle you defined.
What's Next?
Learn how to use additional ArcGIS Pro SDK for .NET features in these tutorials:
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· winform 绘制太阳,地球,月球 运作规律
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
2020-03-20 C#一个简单的含参数,控件调用多线程调用
2018-03-20 电脑不能使用ArcMap 提示由于系统时间不对造成的怎么办?转