• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

gisoracle

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

View Post

ArcGIS Pro SDK MapSeries

You can create multiple map series but a layout can only have one associated map series at a time. There are two basic ways you can work with a map series. 

First, you can reference the layout's currently active map series using the MapSeries property on the Layout. This returns a map series CIM definition. Changes can be made and then pushed back to the Layout using the SetMapSeries() method. 

Second, you can create a new map series using a constructor like CreateSpatialMapSeries. This will also return a CIM definition that can be modified and pushed back to the Layout using the SetMapSeries() method. 

To export a map series you need to contruct an ExportFormat and a MapSeriesExportOptions.

Example
MapSeries_GetSetDefinition
C# //Get and modify a map series CIM definition and set the changes back to the layout

//Perform on the worker thread
await QueuedTask.Run(() =>
{
  MapSeries MS = layout.MapSeries as MapSeries;
  CIMMapSeries CIM_MS = MS.GetDefinition();
  CIM_MS.Enabled = false;
  MS.SetDefinition(CIM_MS);
  layout.SetMapSeries(MS);
});
Modify an existing map series
C# //Modify the currently active map series and changes its sort field and page number field.

//Perform on the worker thread
await QueuedTask.Run(() =>
{
  SpatialMapSeries SMS = layout.MapSeries as SpatialMapSeries; //cast as spatial map seris for additional members
  SMS.SortField = "State_Name";
  SMS.SortAscending = true;
  SMS.PageNumberField = "PageNum";

  //Overwrite the current map series with these new settings
  layout.SetMapSeries(SMS); 
});
Create a new spatial map series
C# // This example create a new spatial map series and then applies it to the active layout. This will automatically 
// overwrite an existing map series if one is already present.

//Reference map frame and index layer
MapFrame mf = layout.FindElement("Map Frame") as MapFrame;
Map m = mf.Map;
BasicFeatureLayer indexLyr = m.FindLayers("Countries").FirstOrDefault() as BasicFeatureLayer;

//Construct map series on worker thread
await QueuedTask.Run(() =>
{
  //SpatialMapSeries constructor - required parameters
  SpatialMapSeries SMS = MapSeries.CreateSpatialMapSeries(layout, mf, indexLyr, "Name");
  
  //Set optional, non-default values
  SMS.CategoryField = "Continent";
  SMS.SortField = "Population";
  SMS.ExtentOptions = ExtentFitType.BestFit;
  SMS.MarginType = ArcGIS.Core.CIM.UnitType.PageUnits;
  SMS.MarginUnits = ArcGIS.Core.Geometry.LinearUnit.Centimeters;
  SMS.Margin = 1;
  SMS.ScaleRounding = 1000;
  layout.SetMapSeries(SMS);  //Overwrite existing map series.
});

 

posted on 2023-02-28 08:06  gisai  阅读(43)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3