0

仕事のためにSilverlight APIを介して自分のarcGISマップを教えています.XYの例で簡単なマーカーシンボルを配置しようとしていましたが、うまくいかない場合はやめてください! 次のサンプル ページを参照として使用していますが、デバッグを行うと、MapPoint の X 値と Y 値に関係なく、マーカーが常にマップの真ん中に表示されます。

http://blogs.esri.com/dev/blogs/silverlightwpf/archive/2010/12/14/adding-gps-location-to-the-map-in-the-arcgis-api-for-windows-phone。 aspx

私の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です。ヘルプ!

4

1 に答える 1

1

問題が見つかりました。ウォークスルーの例では、GeographicToWebMercator はオプションであると述べていましたが、明らかにそうではありません。ライン交換したら

wellsLayer.Graphics[0].Geometry = location;

wellsLayer.Graphics[0].Geometry = ESRI.ArcGIS.Client.Bing.Transform.GeographicToWebMercator(location);

マップ マーカーは、マップ ポイントに基づく位置に移動します。これは、緯度と経度が指定された空間参照システムに対して正しい場合でも、bing マップ システムはそれらの値を、現在の投影法で表示する方法を知っているものに変換する必要があるためです。

これが他の人に役立つことを願っています!

于 2011-05-09T15:50:15.247 に答える