ArcGIS API for Silverlight 呼叫GP服務載入等值線圖層
第二篇、Silverlight客戶端呼叫GP服務
利用ArcGIS API for Silverlight實現GP服務呼叫,這裡的雨量資料是通過一個WebService獲取而來,主要資訊是雨量站點的經緯度座標值和某個時間段內的降雨量值三個主要欄位。
以下是核心程式碼部分:
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:esri="http://schemas.esri.com/arcgis/client/2009"
xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" x:Class="TestDZX.MainPage2"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<controlsToolkit:BusyIndicator x:Name="busyIndicator" BusyContent="正在載入,請稍等..." IsBusy="True">
<Grid x:Name="LayoutRoot" Background="White"> <esri:Map x:Name="myMap" IsLogoVisible="False" ZoomDuration="0:00:00" PanDuration="0:00:00"
Extent="117.647738815324,29.4704217183843,118.446182957997,30.4124245048916">
<esri:ArcGISTiledMapServiceLayer ID="BaseLayer" Url="http://localhost/arcgis/rest/services/HSDQ/MapServer/"/>
<!--等值線和等直面圖層-->
<esri:GraphicsLayer ID="GraphicsDZX"/>
</esri:Map>
<Grid x:Name="gridMain" HorizontalAlignment="Left" Width="215" Margin="1,0,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" x:Name="gridSub2" />
<ColumnDefinition Width="15" x:Name="gridSub1"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="1" Background="#FFD2D4D1" Width="15" Margin="-1,0,0,0" d:LayoutOverrides="HorizontalMargin">
<Border BorderBrush="#FFA5C6E5" BorderThickness="2" Width="15">
<Image x:Name="imgExpandOrCollapsed" Margin="0,136,0,117" Source="Images/ss.png" Stretch="Fill" Height="45" MouseLeftButtonDown="imgExpandOrCollapsed_MouseLeftButtonDown" MouseLeftButtonUp="imgExpandOrCollapsed_MouseLeftButtonUp" Cursor="Hand" ToolTipService.ToolTip="收縮/展開"/>
</Border>
</Grid>
<Grid Width="200" HorizontalAlignment="Left" Background="#FFD2D4D1">
<Grid.RowDefinitions>
<RowDefinition Height="0.095*"/>
<RowDefinition Height="0.905*"/>
</Grid.RowDefinitions>
<StackPanel Margin="0" Grid.Row="1" VerticalAlignment="Top">
<Grid Height="40" d:LayoutOverrides="Height, VerticalMargin" VerticalAlignment="Top">
<sdk:DatePicker x:Name="dpStart" Margin="38,6,65,6"/>
<ComboBox x:Name="cbStart" HorizontalAlignment="Right" Margin="0,6,16,6" Width="49"/>
<TextBlock HorizontalAlignment="Left" Margin="3,0,0,0" TextWrapping="Wrap" Text="起始:" Width="40" FontSize="13.333" FontFamily="Microsoft YaHei" VerticalAlignment="Center"/>
<TextBlock TextWrapping="Wrap" Text="時" FontSize="13.333" FontFamily="Microsoft YaHei" VerticalAlignment="Center" HorizontalAlignment="Right" Width="15" Margin="0,0,1,0"/>
</Grid>
<Grid Height="40" d:LayoutOverrides="Height, VerticalMargin">
<sdk:DatePicker x:Name="dpEnd" Margin="38,6,65,6"/>
<ComboBox x:Name="cbEnd" HorizontalAlignment="Right" Margin="0,6,16,6" Width="49"/>
<TextBlock HorizontalAlignment="Left" Margin="3,0,0,0" TextWrapping="Wrap" Text="截至:" Width="40" FontSize="13.333" FontFamily="Microsoft YaHei" VerticalAlignment="Center"/>
<TextBlock TextWrapping="Wrap" Text="時" FontSize="13.333" FontFamily="Microsoft YaHei" VerticalAlignment="Center" HorizontalAlignment="Right" Width="15" Margin="0,0,1,0"/>
</Grid>
<Grid Height="40" d:LayoutOverrides="Height, VerticalMargin">
<ComboBox x:Name="cbRainGrade" Margin="68,6,0,6"/>
<TextBlock HorizontalAlignment="Left" Margin="4,0,0,0" TextWrapping="Wrap" Text="雨量級別:" Width="69" FontSize="13.333" FontFamily="Microsoft YaHei" VerticalAlignment="Center"/>
</Grid>
<Grid Height="40" d:LayoutOverrides="Height, VerticalMargin">
<RadioButton x:Name="rb1" Content="稀" Margin="70,11,67,1" FontSize="13.333" FontFamily="Microsoft YaHei" GroupName="rbGroup" IsChecked="True" Cursor="Hand" Click="rb_Click"/>
<TextBlock HorizontalAlignment="Left" Margin="4,0,0,0" TextWrapping="Wrap" Text="過濾級:" Width="55" FontSize="13.333" FontFamily="Microsoft YaHei" VerticalAlignment="Center"/>
<RadioButton x:Name="rb2" Content="密" Margin="0,12,8,0" FontSize="13.333" FontFamily="Microsoft YaHei" HorizontalAlignment="Right" Width="55" GroupName="rbGroup" Cursor="Hand" Click="rb_Click"/>
</Grid>
<Grid Height="40" d:LayoutOverrides="Height, VerticalMargin">
<Button x:Name="btnAnalysis" Content="等值線分析" Margin="64,0,63,0" VerticalAlignment="Center" Cursor="Hand" FontSize="13.333" FontFamily="Microsoft YaHei" d:LayoutOverrides="Width" Click="btnAnalysis_Click"/>
</Grid>
</StackPanel>
<Border BorderBrush="#FF459BFB" BorderThickness="2" Background="#FF449DFF" Height="30" VerticalAlignment="Top">
<TextBlock HorizontalAlignment="Center" Margin="0" TextWrapping="Wrap" Text="專 題 分 析" Width="82" FontSize="16" FontFamily="Microsoft YaHei" VerticalAlignment="Center" Foreground="White"/>
</Border>
</Grid>
</Grid>
</Grid>
</controlsToolkit:BusyIndicator>
</UserControl>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;using ESRI.ArcGIS.Client;
using ESRI.ArcGIS.Client.Geometry;
using ESRI.ArcGIS.Client.Tasks;
using System.Net.Browser;
using ESRI.ArcGIS.Client.Symbols;
using TestDZX.ServiceReference1;
using System.Collections.ObjectModel;
using System.Collections;
using System.Windows.Media.Imaging;
using System.Threading;
using System.Globalization;
using Syit.CommonClass;namespace TestDZX
{
public partial class MainPage2 : UserControl
{
/******************GP引數* 2012-08-29***********************/ private Geoprocessor _ContourTask; //等值線GP
public struct EvaluationPointStruct
{
public double Latitute; //緯度
public double Longitute; //經度
public double YL; //雨量
};
public EvaluationPointStruct[] evaluatePoints;
private FeatureSet featureSet;//作為GP輸入引數的要素集 ESRI.ArcGIS.Client.Projection.WebMercator mercator = new ESRI.ArcGIS.Client.Projection.WebMercator(); public int Contour_interval = 5; //預設是5表示稀,1表示密
/*********************************************************/ public MainPage2()
{
InitializeComponent();
//設定日期格式
Thread.CurrentThread.CurrentCulture = (CultureInfo)Thread.CurrentThread.CurrentCulture.Clone();
Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern = "yyyy-MM-dd";
//載入日期
this.dpStart.SelectedDate = (DateTime?)DateTime.Parse(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"));
this.dpEnd.SelectedDate = (DateTime?)DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
//載入小時及雨量級別
BindElement();
//初次載入前日八時到現在小時的資料
DrawContourUseGP();
} #region 頁面上資料繫結 public void BindElement()
{
//起始小時繫結
this.cbStart.Items.Add("00");
this.cbStart.Items.Add("01");
this.cbStart.Items.Add("02");
this.cbStart.Items.Add("03");
this.cbStart.Items.Add("04");
this.cbStart.Items.Add("05");
this.cbStart.Items.Add("06");
this.cbStart.Items.Add("07");
this.cbStart.Items.Add("08");
this.cbStart.Items.Add("09");
this.cbStart.Items.Add("10");
this.cbStart.Items.Add("11");
this.cbStart.Items.Add("12");
this.cbStart.Items.Add("13");
this.cbStart.Items.Add("14");
this.cbStart.Items.Add("15");
this.cbStart.Items.Add("16");
this.cbStart.Items.Add("17");
this.cbStart.Items.Add("18");
this.cbStart.Items.Add("19");
this.cbStart.Items.Add("20");
this.cbStart.Items.Add("21");
this.cbStart.Items.Add("22");
this.cbStart.Items.Add("23");
this.cbStart.SelectedIndex = 8; //結束時間繫結
this.cbEnd.Items.Add("00");
this.cbEnd.Items.Add("01");
this.cbEnd.Items.Add("02");
this.cbEnd.Items.Add("03");
this.cbEnd.Items.Add("04");
this.cbEnd.Items.Add("05");
this.cbEnd.Items.Add("06");
this.cbEnd.Items.Add("07");
this.cbEnd.Items.Add("08");
this.cbEnd.Items.Add("09");
this.cbEnd.Items.Add("10");
this.cbEnd.Items.Add("11");
this.cbEnd.Items.Add("12");
this.cbEnd.Items.Add("13");
this.cbEnd.Items.Add("14");
this.cbEnd.Items.Add("15");
this.cbEnd.Items.Add("16");
this.cbEnd.Items.Add("17");
this.cbEnd.Items.Add("18");
this.cbEnd.Items.Add("19");
this.cbEnd.Items.Add("20");
this.cbEnd.Items.Add("21");
this.cbEnd.Items.Add("22");
this.cbEnd.Items.Add("23");
DateTime dt = DateTime.Now;
string hour = dt.Hour.ToString();
if (hour.Length == 1)
{
hour = "0" + hour;
}
switch (hour)
{
case "00":
this.cbEnd.SelectedIndex = 0;
break;
case "01":
this.cbEnd.SelectedIndex = 1;
break;
case "02":
this.cbEnd.SelectedIndex = 2;
break;
case "03":
this.cbEnd.SelectedIndex = 3;
break;
case "04":
this.cbEnd.SelectedIndex = 4;
break;
case "05":
this.cbEnd.SelectedIndex = 5;
break;
case "06":
this.cbEnd.SelectedIndex = 6;
break;
case "07":
this.cbEnd.SelectedIndex = 7;
break;
case "08":
this.cbEnd.SelectedIndex = 8;
break;
case "09":
this.cbEnd.SelectedIndex = 9;
break;
case "10":
this.cbEnd.SelectedIndex = 10;
break;
case "11":
this.cbEnd.SelectedIndex = 11;
break;
case "12":
this.cbEnd.SelectedIndex = 12;
break;
case "13":
this.cbEnd.SelectedIndex = 13;
break;
case "14":
this.cbEnd.SelectedIndex = 14;
break;
case "15":
this.cbEnd.SelectedIndex = 15;
break;
case "16":
this.cbEnd.SelectedIndex = 16;
break;
case "17":
this.cbEnd.SelectedIndex = 17;
break;
case "18":
this.cbEnd.SelectedIndex = 18;
break;
case "19":
this.cbEnd.SelectedIndex = 19;
break;
case "20":
this.cbEnd.SelectedIndex = 20;
break;
case "21":
this.cbEnd.SelectedIndex = 21;
break;
case "22":
this.cbEnd.SelectedIndex = 22;
break;
case "23":
this.cbEnd.SelectedIndex = 23;
break;
}
//繫結雨量級別
this.cbRainGrade.Items.Add("A:5,10,25,50,100,200");
this.cbRainGrade.Items.Add("B:10,25,50,100,200,300");
this.cbRainGrade.Items.Add("C:50,100,200,300,400,500,600");
this.cbRainGrade.Items.Add("D:100,200,300,400,600,700");
this.cbRainGrade.Items.Add("E:10,20,30,40,50,60");
this.cbRainGrade.SelectedIndex = 0;
} #endregion #region 呼叫GP服務繪製等值線 /// <summary>
/// 呼叫GP服務繪製等值線
/// </summary>
public void DrawContourUseGP()
{
Thread.Sleep(1000);
//載入之前,顯示等待
busyIndicator.IsBusy = true; try
{
getXQYJInfoSoapClient client = new getXQYJInfoSoapClient();
//水位資料
client.getSWRainByTimeSpanCompleted += new EventHandler<getSWRainByTimeSpanCompletedEventArgs>(client_getSWRainByTimeSpanCompleted);
client.getSWRainByTimeSpanAsync(DateTime.Parse(this.dpStart.SelectedDate.ToString().Split(' ')[0] + " " + this.cbStart.SelectedItem.ToString() + ":00:00"), DateTime.Parse(this.dpEnd.SelectedDate.ToString().Split(' ')[0] + " " + this.cbEnd.SelectedItem.ToString() + ":00:00"));
}
catch (Exception)
{
}
} void client_getSWRainByTimeSpanCompleted(object sender, getSWRainByTimeSpanCompletedEventArgs e)
{
try
{
//獲取到所有的水文局雨量點
ObservableCollection<RainFall> lists = e.Result;
int PointsNum = lists.Count;//點的個數
evaluatePoints = new EvaluationPointStruct[PointsNum];
int index = 0;
foreach (RainFall item in lists)
{
if (item.YL24 != 0)
{
evaluatePoints[index].Latitute = item.Latitute;
evaluatePoints[index].Longitute = item.Longitute;
evaluatePoints[index].YL = item.YL24;
index++;
}
}
Utility.AddPointToMapLayer(myMap, evaluatePoints, out featureSet); AccessGPService(featureSet);
}
catch (Exception)
{
}
} private void AccessGPService(FeatureSet featureset)
{
try
{
HttpWebRequest.RegisterPrefix("http://", System.Net.Browser.WebRequestCreator.ClientHttp);
_ContourTask = new Geoprocessor("http://localhost/arcgis/rest/services/ContourServiceTool/GPServer/Contour");
List<GPParameter> parameters = new List<GPParameter>();
parameters.Add(new GPFeatureRecordSetLayer("Input_point_features", featureset));
parameters.Add(new GPDouble("Contour_interval", Contour_interval));
_ContourTask.UpdateDelay = 5000; // 10s的更新時間
_ContourTask.OutputSpatialReference = myMap.SpatialReference; //設定輸出空間參考系
_ContourTask.JobCompleted += new EventHandler<JobInfoEventArgs>(geoprocessorTask_JobCompleted);
_ContourTask.Failed += new EventHandler<TaskFailedEventArgs>(geoprocessorTask_Failed);
_ContourTask.SubmitJobAsync(parameters);
}
catch (Exception)
{
}
} /********************************事件處理程式段***************************************/ void geoprocessorTask_JobCompleted(object sender, JobInfoEventArgs e)
{
Geoprocessor gp = sender as Geoprocessor;
//註冊字首
HttpWebRequest.RegisterPrefix("http://", System.Net.Browser.WebRequestCreator.ClientHttp);
gp.GetResultDataCompleted += new EventHandler<GPParameterEventArgs>(gp_GetResultDataCompleted);
gp.GetResultDataAsync(e.JobInfo.JobId, "Contour_Idw_11_Clip_SmoothLi_shp"); //載入完成,隱藏
busyIndicator.IsBusy = false;
} void gp_GetResultDataCompleted(object sender, GPParameterEventArgs e)
{
//找到顯示等值線圖層並清空,然後再次載入
GraphicsLayer layer = myMap.Layers["GraphicsDZX"] as GraphicsLayer;
layer.ClearGraphics();
GPFeatureRecordSetLayer gplayer = e.Parameter as GPFeatureRecordSetLayer;
int index = 0;
foreach (Graphic graphic in gplayer.FeatureSet.Features)
{
if (IsRainInGrade(graphic.Attributes["CONTOUR"].ToString()))
{
graphic.Symbol = new ESRI.ArcGIS.Client.Symbols.SimpleLineSymbol()
{
Style = ESRI.ArcGIS.Client.Symbols.SimpleLineSymbol.LineStyle.Solid,
Color = new SolidColorBrush(Colors.Red),
Width = 2
}; layer.Graphics.Add(graphic); //新增紅色的等值線
/****************************************************************************************/ //標註數值
TextSymbol textSymbol = new TextSymbol()
{
FontFamily = new System.Windows.Media.FontFamily("Microsoft YaHei"),
Foreground = new System.Windows.Media.SolidColorBrush(Color.FromArgb(255, 0, 0, 0)),
FontSize = 12,
Text = graphic.Attributes["CONTOUR"].ToString()
};
//尋找線段的中心點座標位置
Graphic graphicText; //封閉曲線在曲線中間顯示數值
Graphic graphicStart; //非封閉曲線的起始點
Graphic graphicEnd; //非封閉曲線的終止點
if (gplayer.FeatureSet.GeometryType == GeometryType.Polyline)
{
ESRI.ArcGIS.Client.Geometry.Polyline pl = gplayer.FeatureSet.Features[index].Geometry as ESRI.ArcGIS.Client.Geometry.Polyline;
MapPoint mp = pl.Extent.GetCenter();
if (pl.Paths != null && pl.Paths.Count > 0)
{
ESRI.ArcGIS.Client.Geometry.PointCollection path = pl.Paths[0];
if (path != null && path.Count > 0)
{
int mid = path.Count / 2;
mp = path[mid];
if (path.Count == 2)
{
// path裡面只有兩個點的情況
double x1 = (path[0] as MapPoint).X;
double y1 = (path[0] as MapPoint).Y;
double x2 = (path[1] as MapPoint).X;
double y2 = (path[1] as MapPoint).Y;
mp.X = x2 + (x1 - x2) / 2;
mp.Y = y2 + (y1 - y2) / 2;
//封閉的曲線
graphicText = new Graphic()
{
Geometry = mercator.FromGeographic(mp),
Symbol = textSymbol
};
//封閉的曲線在中間位置
layer.Graphics.Add(graphicText); //新增數值
}
else
{
//起始
graphicStart = new Graphic()
{
Geometry = mercator.FromGeographic(new MapPoint(path[0].X, path[0].Y)),
Symbol = textSymbol
};
//結束
graphicEnd = new Graphic()
{
Geometry = mercator.FromGeographic(new MapPoint(path[path.Count - 1].X, path[path.Count - 1].Y)),
Symbol = textSymbol
};
layer.Graphics.Add(graphicStart); //標註起始數值
layer.Graphics.Add(graphicEnd); //標註結束數值
}
}
}
}
}
//索引自增欄位
index++;
}
} /// <summary>
/// 地理處理失敗,返回失敗原因
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void geoprocessorTask_Failed(object sender, TaskFailedEventArgs e)
{
MessageBox.Show(e.Error.ToString());
} /// <summary>
/// 等值線分析按鈕
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnAnalysis_Click(object sender, RoutedEventArgs e)
{
DrawContourUseGP();
} #endregion #region 選單處理選項及事件 private void imgExpandOrCollapsed_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
e.Handled = true;
} private void imgExpandOrCollapsed_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
if (this.gridSub2.Width == new GridLength(200, GridUnitType.Pixel))
{
//處於展開狀態
this.imgExpandOrCollapsed.Tag = "收縮皮膚";
Grid.SetColumnSpan(gridMain, 1);
this.gridSub2.Width = new GridLength(0, GridUnitType.Pixel);
Uri uri = new Uri("Images/zk.png", UriKind.Relative);
BitmapImage image = new BitmapImage(uri);
this.imgExpandOrCollapsed.Source = image;
}
else
{
//處於收縮狀態
this.imgExpandOrCollapsed.Tag = "展開皮膚";
Grid.SetColumnSpan(gridMain, 2);
this.gridSub2.Width = new GridLength(200, GridUnitType.Pixel);
Uri uri = new Uri("Images/ss.png", UriKind.Relative);
BitmapImage image = new BitmapImage(uri);
this.imgExpandOrCollapsed.Source = image;
}
} /// <summary>
/// 過濾級單選按鈕的切換事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void rb_Click(object sender, RoutedEventArgs e)
{
RadioButton currRadioButton;
currRadioButton = sender as RadioButton;
if (currRadioButton != null && currRadioButton.IsChecked.Value)
{
if (currRadioButton.Name == "rb1")
{
//首先賦值Contour_interval
Contour_interval = 5;
//改變值後,重新載入等值線
DrawContourUseGP();
}
else if (currRadioButton.Name == "rb2")
{
//首先賦值Contour_interval
Contour_interval = 1;
//改變值後,重新載入等值線
DrawContourUseGP();
}
}
} #endregion #region 根據雨量等級進行資料篩選 /// <summary>
/// 判斷一個降雨值取整數後,是否在雨量級別的數值中
/// </summary>
/// <param name="value"></param>
/// <returns>在數值中的話,返回true,否則返回false</returns>
public bool IsRainInGrade(string value)
{
bool flag = false;
string[] list = this.cbRainGrade.SelectedItem.ToString().Trim().Split(':')[1].Split(',');
foreach (string s in list)
{
if (value.Trim() == s)
{
flag = true;
}
}
return flag;
}
#endregion
}
}
使用到的另一個cs類檔案如下Utility.cs檔案如下
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using ESRI.ArcGIS.Client.Geometry;
using ESRI.ArcGIS.Client;
using ESRI.ArcGIS.Client.Tasks;
using ESRI.ArcGIS.Client.Symbols;namespace TestDZX
{
public class Utility
{
public static void AddPointToMapLayer(ESRI.ArcGIS.Client.Map map, MainPage2.EvaluationPointStruct[] evaluatePoints, out ESRI.ArcGIS.Client.Tasks.FeatureSet featureset)
{
ESRI.ArcGIS.Client.Projection.WebMercator mercator = new ESRI.ArcGIS.Client.Projection.WebMercator(); #region 動態新增預測點圖層 if (map.Layers["YLPointsLayer"] != null)
{
map.Layers.Remove(map.Layers["YLPointsLayer"]);
}
GraphicsLayer graphicslayer = new GraphicsLayer()
{
ID = "YLPointsLayer",
};
map.Layers.Add(graphicslayer); #endregion #region 將降雨量點新增到圖層中 featureset = new FeatureSet();
if (evaluatePoints.Length != 0)
{
foreach (MainPage2.EvaluationPointStruct evaluationpoint in evaluatePoints)
{
Graphic g = new Graphic()
{
Geometry = mercator.FromGeographic(new MapPoint(evaluationpoint.Latitute, evaluationpoint.Longitute)),
Symbol = new ESRI.ArcGIS.Client.Symbols.SimpleMarkerSymbol()
{
Style = ESRI.ArcGIS.Client.Symbols.SimpleMarkerSymbol.SimpleMarkerStyle.Circle,
Size = 5,
Color = new SolidColorBrush(Colors.Red)
}
};
g.Attributes.Add("YL", evaluationpoint.YL);
featureset.Features.Add(g);
graphicslayer.Graphics.Add(g);
//動態新增文字
TextSymbol textSymbol = new TextSymbol()
{
FontFamily = new System.Windows.Media.FontFamily("Microsoft YaHei"),
Foreground = new System.Windows.Media.SolidColorBrush(Color.FromArgb(255, 117, 20, 99)),
FontSize = 12,
Text = evaluationpoint.YL.ToString(),
OffsetX = 12,
OffsetY = -5
}; Graphic graphicText = new Graphic()
{
Geometry = mercator.FromGeographic(new MapPoint(evaluationpoint.Latitute, evaluationpoint.Longitute)),
Symbol = textSymbol
};
graphicslayer.Graphics.Add(graphicText);
}
}
#endregion
}
}
}
顯示效果如下:
===========================================================================
如果覺得對您有幫助,微信掃一掃支援一下:
相關文章
- ArcGIS Pro建立、釋出、呼叫GP服務全過程示例(等高線分析)
- arcgis api for js入門開發系列十九圖層線上編輯APIJS
- ArcGis api配合vue開發入門系列(一)引入arcgis api以及載入地圖APIVue地圖
- mapboxgl載入geoserver釋出的tms向量圖層服務Server
- 基於Echarts的百度地圖疊加arcgis server的WMS圖層服務Echarts地圖Server
- 不偏移的天地圖地圖服務-ArcGIS版地圖
- Cesium載入ArcGIS Server4490且orgin -400 400的切片服務Server
- ArcGIS Pro釋出地圖服務(影像、向量)地圖
- 等值線圖的Python繪製方法Python
- OpenFeign 服務呼叫與負載負載
- Vue 高德地圖 API Loca 如何使用 連線線圖層、脈衝連線圖層Vue地圖API
- arcgis怎樣把面圖層按另一面圖層分割
- 從零開始釋出一個ArcGIS Server地圖服務Server地圖
- ArcGIS API for JavaScript根據兩個點座標在地圖上畫線APIJavaScript地圖
- SpringCloud(二):服務呼叫與負載均衡SpringGCCloud負載
- MapBox載入GeoServer釋出的WMS地圖服務Server地圖
- SpringCloud 服務負載均衡和呼叫 Ribbon、OpenFeignSpringGCCloud負載
- 頁面錄製服務上線:RESTful API 呼叫實現,所見所錄即所得RESTAPI
- SpringCloud入門(二)服務間呼叫和案例SpringGCCloud
- ArcGIS Desktop釋出地形高程服務(DEM/DSM)
- 服務與服務之間的呼叫
- Silverlight3.0正式版(Silverlight3_Tools)離線安裝
- ArcGIS Pro SDK 003 如何呼叫Toolbox
- SpringCloud之服務呼叫SpringGCCloud
- 【ArcGIS For JS】前端geojson渲染行政區劃圖層並加標籤前端JSON
- eureka如何管理服務呼叫
- openlayer呼叫wms服務端服務端
- AUTOCAD——圖層線型
- 層次人才服務中心
- go微服務系列(三) - 服務呼叫(http)Go微服務HTTP
- springcloud(三):服務提供與呼叫SpringGCCloud
- eureka服務之間呼叫(3)
- GRPC 服務呼叫實踐(一)RPC
- Nacos服務呼叫(基於Openfeign)
- [Python入門]使用Python指令碼呼叫API生成DALL-E-3圖片Python指令碼API
- GP Bullhound:2021年Q4網路服務報告
- GP Bullhound:2021年Q3網路服務報告
- GP Bullhound:2021年Q2網路服務報告
- ArcMap10.7載入天地圖不顯示圖層,空白怎麼辦地圖