ArcGIS Pro Build a map layout
This tutorial demonstrates how to create a custom map layout using the ArcGIS Pro SDK for .NET.
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.
The ArcGIS Pro SDK for .NET includes a Map Layout API, which provides classes and members to support managing layouts, layout elements, and working with layout views. You can create new layouts and layout elements, modify existing elements, and manage selections, layout view control, and navigation.
In this tutorial, you will create a new map layout, add layout elements including a map frame and text elements, and then open the layout in a new layout view.
Tip
For more information, see the ArcGIS Pro wiki layouts document, and review layout code snippets, or see the ArcGIS Pro SDK API reference. You can also review the ArcGIS Pro user community's layout 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.
Steps
Create a new ArcGIS Pro Add-In Visual Studio Project
-
Start Visual Studio.
-
Choose File > New > Project and then from the ArcGIS templates group, select ArcGIS Pro Module Add-in. Name the add-in project "MapLayout".
Create a new Pro button and edit DAML
-
Right-click the project and choose Add > New Item. From the ArcGIS Pro Add-ins group > list of templates, select ArcGIS Pro Button.
-
Name the new class file "BuildNewLayout.cs" and press Add to close the dialog box.
-
Open the
Config.daml
file and modify the button item as follows:
Create and set up a new layout page
-
Open the
BuildNewLayout.cs
file and add the following using directives: -
In the
BuildNewLayout.cs
file, update the code to match the following for theOnClick
method. This creates a new layout and CIM page and applies it to the layout:
Create a map and map elements and add to the layout
You will continue adding code to the OnClick
method.
-
Next you will add code to create a map with census data, add it to the layout, and set the camera. Update the code to match the following:
-
Continue adding code to the
OnClick
method. This code creates a title and North arrow:
Finalize code and test
In this step, you continue to use the ElementFactory to create and add new map elements to your layout.
-
Finalize the
OnClick
method with additional code creating a map legend and then opening the layout pane. -
Once your code is completed, build your project and debug any issues. Start the project, which will launch ArcGIS Pro.
Note:
You must be connected to the internet while running this add-in in order to access the ArcGIS Online dataset referenced in the code.
-
Create a new project when the ArcGIS Pro start page appears. From the Add-in tab and find your new button.
-
Press your new button to run the code and open the new layout.
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 提示由于系统时间不对造成的怎么办?转