仕事のためにSilverlight APIを介して自分のarcGISマップを教えています.XYの例で簡単なマーカーシンボルを配置しようとしていましたが、うまくいかない場合はやめてください! 次のサンプル ページを参照として使用していますが、デバッグを行うと、MapPoint の X 値と Y 値に関係なく、マーカーが常にマップの真ん中に表示されます。
私のxamlは次のようになります:
<UserControl x:Class="CustomGeometry.MainPage"
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="clr-namespace:ESRI.ArcGIS.Client;assembly=ESRI.ArcGIS.Client"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White">
<esri:Map x:Name="mapWells" Loaded="mapWells_Loaded">
<esri:ArcGISTiledMapServiceLayer x:Name="BaseLayer" ID="Base Map" Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />
</esri:Map>
</Grid>
</UserControl>
私のバックエンドコードは次のようになります。
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}
/// <summary>
/// creating Wells Layer
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void mapWells_Loaded(object sender, RoutedEventArgs e)
{
GraphicsLayer wellsLayer = mapWells.Layers["WellsLayer"] as GraphicsLayer;
if (wellsLayer == null)
{
wellsLayer = new GraphicsLayer()
{
ID = "wellsLayer"
};
mapWells.Layers.Add(wellsLayer);
Graphic marker = new Graphic();
marker.Symbol = new SimpleMarkerSymbol();
wellsLayer.Graphics.Add(marker);
}
// map point not being set correctly.
MapPoint location = new MapPoint(-122.466903686523, 48.7440490722656, mapWells.SpatialReference);
wellsLayer.Graphics[0].Geometry = location;
}
}
私は何を間違っていますか?私はそれがspatialReferenceに関係していると仮定していますが、マップの空間参照はnullです。ヘルプ!