private void AddPlaceMarkerByLongitudeAndLatitude(double Longitude, double Latitude)
{
//将要添加图标的图层 GraphicsLayer
GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
//new 图标
ESRI.ArcGIS.Client.Graphic aGraphic = new ESRI.ArcGIS.Client.Graphic();
//设置图标样式
ESRI.ArcGIS.Client.Symbols.PictureMarkerSymbol aPictureMarkerySymbol = new ESRI.ArcGIS.Client.Symbols.PictureMarkerSymbol();
ImageSource imageSource = new BitmapImage(new Uri("camara.jpg", UriKind.RelativeOrAbsolute));
aPictureMarkerySymbol.Source = imageSource;
aPictureMarkerySymbol.Width = 16;
aPictureMarkerySymbol.Height = 16;
//绑定图标位置和样式
ESRI.ArcGIS.Client.Projection.WebMercator mercator = new ESRI.ArcGIS.Client.Projection.WebMercator();
aGraphic.Geometry = mercator.FromGeographic(new MapPoint(Longitude, Latitude));
aGraphic.Symbol = aPictureMarkerySymbol;
//将图标显示到图层
graphicsLayer.Graphics.Add(aGraphic);
}
本文介绍了一种在地图上根据经纬度坐标添加图标的方法。通过使用ESRI ArcGIS API,可以轻松实现图标的位置设置及样式定制。
4689

被折叠的 条评论
为什么被折叠?



