当前位置: 首页>>代码示例>>C#>>正文


C# Locator.LocationToAddressAsync方法代码示例

本文整理汇总了C#中Locator.LocationToAddressAsync方法的典型用法代码示例。如果您正苦于以下问题:C# Locator.LocationToAddressAsync方法的具体用法?C# Locator.LocationToAddressAsync怎么用?C# Locator.LocationToAddressAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Locator的用法示例。


在下文中一共展示了Locator.LocationToAddressAsync方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MyMap_MouseClick

        private void MyMap_MouseClick(object sender, ESRI.ArcGIS.Client.Map.MouseEventArgs e)
        {
            Locator locatorTask = new Locator("http://tasks.arcgisonline.com/ArcGIS/rest/services/Locators/TA_Streets_US_10/GeocodeServer");
            locatorTask.LocationToAddressCompleted += LocatorTask_LocationToAddressCompleted;
            locatorTask.Failed += LocatorTask_Failed;

            // Tolerance (distance) specified in meters
            double tolerance = 30;
            locatorTask.LocationToAddressAsync(e.MapPoint, tolerance, e.MapPoint);
        }
开发者ID:ealvarezp,项目名称:arcgis-samples-silverlight,代码行数:10,代码来源:LocationToAddress.xaml.cs

示例2: MyMap_MapGesture

        private void MyMap_MapGesture(object sender, Map.MapGestureEventArgs e)
        {
            if (e.Gesture == GestureType.Tap && MyMap.Extent != null)
            {
                Locator locatorTask = new Locator("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");
                locatorTask.LocationToAddressCompleted += LocatorTask_LocationToAddressCompleted;
                locatorTask.Failed += LocatorTask_Failed;

                // Tolerance (distance) specified in meters
                double tolerance = 30;
                locatorTask.LocationToAddressAsync(e.MapPoint, tolerance);

                Graphic graphic = new Graphic()
                {
                    Symbol = DefaultMarkerSymbol,
                    Geometry = e.MapPoint
                };
                GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
                graphicsLayer.Graphics.Clear();
                graphicsLayer.Graphics.Add(graphic);
            }
        }
开发者ID:Esri,项目名称:arcgis-samples-winphone,代码行数:22,代码来源:LocationToAddress.xaml.cs

示例3: MyMap_MouseClick

        private void MyMap_MouseClick(object sender, ESRI.ArcGIS.Client.Map.MouseEventArgs e)
        {
            Locator locatorTask = new Locator("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");
            locatorTask.LocationToAddressCompleted += LocatorTask_LocationToAddressCompleted;
            locatorTask.Failed += LocationToAddressLocatorTask_Failed;
            Dictionary<string, string> address = new Dictionary<string, string>();
            address.Add("forStorage", "true");
            address.Add("token", "pgPwo32cfo-kLf0ABYjV9RZjxGNfFB4--xSkGLOY4bUx0UhmFMc0-06KJCPtx4uRsIGuO_9xn_cxI2G2w9IoD3hX7Q-LGulIg2VhKUcvklXu7CblMg1--yg5kznhXjSF");

            locatorTask.CustomParameters = address;


            // Tolerance (distance) specified in meters
            double tolerance = 30;

            locatorTask.LocationToAddressAsync(e.MapPoint, tolerance, e.MapPoint);
        }
开发者ID:ApexGIS,项目名称:developer-support,代码行数:17,代码来源:MainWindow.xaml.cs

示例4: GetAddressForLocation

 private void GetAddressForLocation(MapPoint location, Source source)
 {
     if (location == null) return;
     if (source == Source.Origin)
         pointA = null;
     else
         pointB = null;
     #region Locator - Gets the address of a given location
     var locator = new Locator(GEOCODE_URL);
     locator.LocationToAddressCompleted += (s, e) =>
     {
         MyProgressBar.IsIndeterminate = false;
         if (source == Source.Origin)
             pointA = GetGraphic(e.Address);
         else
             pointB = GetGraphic(e.Address);
         if (pointA != null && pointB != null)
             GetDirectionsFromAtoB(pointA, pointB); // Defines the path geometry.
     };
     locator.Failed += (s, e) =>
     {
         MyProgressBar.IsIndeterminate = false;
         var error = e.Error;
         MessageBox.Show(string.Format("Get address of '{0}' failed with error '{1}'", location, error.Message));
     };
     MyProgressBar.IsIndeterminate = true;
     locator.LocationToAddressAsync(location, 5000);
     #endregion
 }
开发者ID:jNery,项目名称:route_buffer_query_intersect_wp8,代码行数:29,代码来源:MainPage.xaml.cs

示例5: GetAddressOfMyLocation

 private void GetAddressOfMyLocation(MapPoint point)
 {
     if (point == null) return;
     myLocation = null;
     #region Locator - Get Current Location's Address
     var locator = new Locator(GEOCODE_URL);
     locator.LocationToAddressCompleted += (s, e) =>
     {
         MyProgressBar.IsIndeterminate = false;
         var address = e.Address;
         myLocation = GetGraphic(address);
     };
     locator.Failed += (s, e) =>
     {
         MyProgressBar.IsIndeterminate = false;
         var error = e.Error;
         MessageBox.Show(string.Format("Get address of '{0}' failed with error '{1}'", point, error.Message));
         ShowElement(MyMap);
     };
     MyProgressBar.IsIndeterminate = true;
     locator.LocationToAddressAsync(point, 100);
     #endregion
 }
开发者ID:jNery,项目名称:geocode_and_routing_wp8,代码行数:23,代码来源:MainPage.xaml.cs

示例6: GetAddressesOfLocations

 private void GetAddressesOfLocations(IList<Graphic> locationGraphics)
 {
     FindResultsStackPanel.Children.Clear();
     destinations.Clear();
     #region Locator - Finds addresses for possible destinations
     var locator = new Locator(GEOCODE_URL);
     locator.LocationToAddressCompleted += (s, e) =>
         {
             MyProgressBar.IsIndeterminate = false;
             var g = e.UserState as Graphic;
             UpdateSearchPanel(g, e.Address);
             var nextGraphic = locationGraphics.FirstOrDefault(r => !r.Attributes.ContainsKey("destination"));
             if (nextGraphic == null)
                 EnableSearchMenuItem(true);
             else
             {
                 var nextLocation = nextGraphic.Geometry as MapPoint;
                 locator.LocationToAddressAsync(nextLocation, DISTANCE, nextGraphic);
             }
         };
     locator.Failed += (s, e) =>
         {
             MyProgressBar.IsIndeterminate = false;
             var g = e.UserState as Graphic;
             var mp = g.Geometry as MapPoint;
             MessageBox.Show(string.Format("Get address of '{0}' failed with error '{1}'", mp, e.Error.Message));
             ShowElement(MyMap);
         };
     MyProgressBar.IsIndeterminate = true;
     var firstGraphic = locationGraphics.FirstOrDefault(g => !g.Attributes.ContainsKey("destination"));
     var firstLocation = firstGraphic.Geometry as MapPoint;
     locator.LocationToAddressAsync(firstLocation, DISTANCE,firstGraphic);
     #endregion
 }
开发者ID:jNery,项目名称:geocode_and_routing_wp8,代码行数:34,代码来源:MainPage.xaml.cs


注:本文中的Locator.LocationToAddressAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。