private void GetDirections_Click(object sender, RoutedEventArgs e)
        {
            //Reset
            DirectionsStackPanel.Children.Clear();
            _stops.Clear();

            (MyMap.Layers["MyRouteGraphicsLayer"] as GraphicsLayer).ClearGraphics();
            _locator.CancelAsync();
            _routeTask.CancelAsync();

            //Geocode from address
            _locator.AddressToLocationsAsync(ParseAddress(FromTextBox.Text), "from");
        }
Esempio n. 2
0
 private void findAddress()
 {
     try
     {
         if (_mapWidget != null)
         {
             _mapWidget.Map.MouseClick -= Map_MouseClick;
         }
         Locator locatorTask = new Locator("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");
         locatorTask.AddressToLocationsCompleted += new EventHandler <AddressToLocationsEventArgs>(locatorTask_AddressToLocationsCompleted);
         locatorTask.Failed += new EventHandler <TaskFailedEventArgs>(locatorTaskFindAddress_Failed);
         AddressToLocationsParameters addressParams = new AddressToLocationsParameters()
         {
             OutSpatialReference = _mapWidget.Map.SpatialReference
         };
         Dictionary <string, string> address = addressParams.Address;
         address.Add("SingleLine", txtAddress.Text);
         txtAddress.Text = "Enter Address";
         locatorTask.AddressToLocationsAsync(addressParams);
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine("error in find address: " + ex.Message);
     }
 }
        private void FindAddressButton_Click(object sender, RoutedEventArgs e)

        {
   

            Locator locatorTask = new Locator("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");

            locatorTask.AddressToLocationsCompleted += LocatorTask_AddressToLocationsCompleted;
            locatorTask.Failed += LocatorTask_Failed;
            AddressToLocationsParameters addressParams = new AddressToLocationsParameters();
            
            Dictionary<string, string> address = addressParams.Address;

            if (!string.IsNullOrEmpty(Address.Text))
                address.Add("Address", Address.Text);
            if (!string.IsNullOrEmpty(City.Text))
                address.Add("City", City.Text);
            if (!string.IsNullOrEmpty(State.Text))
                address.Add("Region", State.Text);
            if (!string.IsNullOrEmpty(Zip.Text))
                address.Add("Postal", Zip.Text);
            address.Add("forStorage", "true");
            address.Add("token","pgPwo32cfo-kLf0ABYjV9RZjxGNfFB4--xSkGLOY4bUx0UhmFMc0-06KJCPtx4uRsIGuO_9xn_cxI2G2w9IoD3hX7Q-LGulIg2VhKUcvklXu7CblMg1--yg5kznhXjSF");
            locatorTask.AddressToLocationsAsync(addressParams);
        }
        private void FindAddressButton_Click(object sender, RoutedEventArgs e)
        {
            Locator locatorTask = new Locator("http://tasks.arcgisonline.com/ArcGIS/rest/services/Locators/TA_Streets_US_10/GeocodeServer");

            locatorTask.AddressToLocationsCompleted += LocatorTask_AddressToLocationsCompleted;
            locatorTask.Failed += LocatorTask_Failed;
            AddressToLocationsParameters addressParams = new AddressToLocationsParameters();
            Dictionary <string, string>  address       = addressParams.Address;

            if (!string.IsNullOrEmpty(Address.Text))
            {
                address.Add("Street", Address.Text);
            }
            if (!string.IsNullOrEmpty(City.Text))
            {
                address.Add("City", City.Text);
            }
            if (!string.IsNullOrEmpty(State.Text))
            {
                address.Add("State", State.Text);
            }
            if (!string.IsNullOrEmpty(Zip.Text))
            {
                address.Add("ZIP", Zip.Text);
            }

            locatorTask.AddressToLocationsAsync(addressParams);
        }
        private void FindAddressButton_Click(object sender, RoutedEventArgs e)
        {
            graphicsLayer.ClearGraphics();
            AddressBorder.Visibility = Visibility.Collapsed;
            ResultsTextBlock.Visibility = Visibility.Collapsed;

            Locator locatorTask = new Locator("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");
            locatorTask.AddressToLocationsCompleted += LocatorTask_AddressToLocationsCompleted;
            locatorTask.Failed += LocatorTask_Failed;

            AddressToLocationsParameters addressParams = new AddressToLocationsParameters()
            {
                OutSpatialReference = MyMap.SpatialReference
            };

            Dictionary<string, string> address = addressParams.Address;

            if (!string.IsNullOrEmpty(Address.Text))
                address.Add("Address", Address.Text);
            if (!string.IsNullOrEmpty(City.Text))
                address.Add("City", City.Text);
            if (!string.IsNullOrEmpty(StateAbbrev.Text))
                address.Add("Region", StateAbbrev.Text);
            if (!string.IsNullOrEmpty(Zip.Text))
                address.Add("Postal", Zip.Text);

            locatorTask.AddressToLocationsAsync(addressParams);
        }
Esempio n. 6
0
        private void FindAddressButton_Click(object sender, RoutedEventArgs e)
        {
            _locatorTask = new Locator("http://tasks.arcgisonline.com/ArcGIS/rest/services/Locators/TA_Address_NA/GeocodeServer");
            _locatorTask.AddressToLocationsCompleted += LocatorTask_AddressToLocationsCompleted;
            _locatorTask.Failed += LocatorTask_Failed;

            AddressToLocationsParameters addressParams = new AddressToLocationsParameters()
            {
                OutSpatialReference = MyMap.SpatialReference
            };

            Dictionary <string, string> address = addressParams.Address;


            if (!string.IsNullOrEmpty(City.Text))
            {
                address.Add("City", City.Text);
            }
            if (!string.IsNullOrEmpty(State.Text))
            {
                address.Add("State", State.Text);
            }


            _locatorTask.AddressToLocationsAsync(addressParams);
        }
Esempio n. 7
0
        private void FindAddressButton_Click(object sender, RoutedEventArgs e)

        {
            Locator locatorTask = new Locator("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");

            locatorTask.AddressToLocationsCompleted += LocatorTask_AddressToLocationsCompleted;
            locatorTask.Failed += LocatorTask_Failed;
            AddressToLocationsParameters addressParams = new AddressToLocationsParameters();

            Dictionary <string, string> address = addressParams.Address;

            if (!string.IsNullOrEmpty(Address.Text))
            {
                address.Add("Address", Address.Text);
            }
            if (!string.IsNullOrEmpty(City.Text))
            {
                address.Add("City", City.Text);
            }
            if (!string.IsNullOrEmpty(State.Text))
            {
                address.Add("Region", State.Text);
            }
            if (!string.IsNullOrEmpty(Zip.Text))
            {
                address.Add("Postal", Zip.Text);
            }
            address.Add("forStorage", "true");
            address.Add("token", "pgPwo32cfo-kLf0ABYjV9RZjxGNfFB4--xSkGLOY4bUx0UhmFMc0-06KJCPtx4uRsIGuO_9xn_cxI2G2w9IoD3hX7Q-LGulIg2VhKUcvklXu7CblMg1--yg5kznhXjSF");
            locatorTask.AddressToLocationsAsync(addressParams);
        }
Esempio n. 8
0
        private void SearchLocation_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key != Key.Enter)
            {
                return;
            }
            TextBox tb = sender as TextBox;

            Locator locatorTask = new Locator("http://tasks.arcgisonline.com/ArcGIS/rest/services/Locators/ESRI_Places_World/GeocodeServer");

            locatorTask.AddressToLocationsCompleted += LocatorTask_AddressToLocationsCompleted;
            //locatorTask.Failed += LocatorTask_Failed;
            AddressToLocationsParameters addressParams = new AddressToLocationsParameters();
            Dictionary <string, string>  address       = addressParams.Address;

            addressParams.OutFields.Add("North_Lat");
            addressParams.OutFields.Add("South_Lat");
            addressParams.OutFields.Add("West_Lon");
            addressParams.OutFields.Add("East_Lon");
            addressParams.OutFields.Add("Descr");

            if (!string.IsNullOrEmpty(tb.Text))
            {
                address.Add("PlaceName", tb.Text);
            }
            else
            {
                return;
            }

            locatorTask.AddressToLocationsAsync(addressParams);
        }
Esempio n. 9
0
        private void FindAddressButton_Click(object sender, RoutedEventArgs e)
        {
            _locatorTask = new Locator("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");
            _locatorTask.AddressToLocationsCompleted += LocatorTask_AddressToLocationsCompleted;
            _locatorTask.Failed += LocatorTask_Failed;

            AddressToLocationsParameters addressParams = new AddressToLocationsParameters()
            {
                OutSpatialReference = MyMap.SpatialReference
            };

            Dictionary <string, string> address = addressParams.Address;

            if (!string.IsNullOrEmpty(InputAddress.Text))
            {
                address.Add("Address", InputAddress.Text);
            }
            if (!string.IsNullOrEmpty(City.Text))
            {
                address.Add("City", City.Text);
            }
            if (!string.IsNullOrEmpty(State.Text))
            {
                address.Add("Region", State.Text);
            }
            if (!string.IsNullOrEmpty(Zip.Text))
            {
                address.Add("Postal", Zip.Text);
            }

            _locatorTask.AddressToLocationsAsync(addressParams);
        }
Esempio n. 10
0
        private void FindAddressButton_Click(object sender, RoutedEventArgs e)
        {
            graphicsLayer.ClearGraphics();
            AddressBorder.Visibility    = Visibility.Collapsed;
            ResultsTextBlock.Visibility = Visibility.Collapsed;

            Locator locatorTask = new Locator("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");

            locatorTask.AddressToLocationsCompleted += LocatorTask_AddressToLocationsCompleted;
            locatorTask.Failed += LocatorTask_Failed;

            AddressToLocationsParameters addressParams = new AddressToLocationsParameters()
            {
                OutSpatialReference = MyMap.SpatialReference
            };

            Dictionary <string, string> address = addressParams.Address;

            if (!string.IsNullOrEmpty(Address.Text))
            {
                address.Add("Address", Address.Text);
            }
            if (!string.IsNullOrEmpty(City.Text))
            {
                address.Add("City", City.Text);
            }
            if (!string.IsNullOrEmpty(StateAbbrev.Text))
            {
                address.Add("Region", StateAbbrev.Text);
            }
            if (!string.IsNullOrEmpty(Zip.Text))
            {
                address.Add("Postal", Zip.Text);
            }

            locatorTask.AddressToLocationsAsync(addressParams);
        }
        private void FindAddressButton_Click(object sender, RoutedEventArgs e)
        {
            _locatorTask = new Locator("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");
            _locatorTask.AddressToLocationsCompleted += LocatorTask_AddressToLocationsCompleted;
            _locatorTask.Failed += LocatorTask_Failed;

            AddressToLocationsParameters addressParams = new AddressToLocationsParameters()
            {
                OutSpatialReference = MyMap.SpatialReference
            };

            Dictionary<string, string> address = addressParams.Address;

            if (!string.IsNullOrEmpty(InputAddress.Text))
                address.Add("Address", InputAddress.Text);
            if (!string.IsNullOrEmpty(City.Text))
                address.Add("City", City.Text);
            if (!string.IsNullOrEmpty(State.Text))
                address.Add("Region", State.Text);
            if (!string.IsNullOrEmpty(Zip.Text))
                address.Add("Postal", Zip.Text);

            _locatorTask.AddressToLocationsAsync(addressParams);
        }
        private void FindAddressButton_Click(object sender, RoutedEventArgs e)
        {
            _locatorTask = new Locator("http://tasks.arcgisonline.com/ArcGIS/rest/services/Locators/TA_Streets_US/GeocodeServer");
            _locatorTask.AddressToLocationsCompleted += LocatorTask_AddressToLocationsCompleted;
            _locatorTask.Failed += LocatorTask_Failed;

            AddressToLocationsParameters addressParams = new AddressToLocationsParameters()
            {
                OutSpatialReference = Map.SpatialReference
            };

            Dictionary<string, string> address = addressParams.Address;

            if (!string.IsNullOrEmpty(InputAddress.Text))
                address.Add("Street", InputAddress.Text);
            if (!string.IsNullOrEmpty(City.Text))
                address.Add("City", City.Text);
            if (!string.IsNullOrEmpty(State.Text))
                address.Add("State", State.Text);
            if (!string.IsNullOrEmpty(Zip.Text))
                address.Add("ZIP", Zip.Text);

            _locatorTask.AddressToLocationsAsync(addressParams);
        }
 private void findAddress()
 {
     try
     {
         if (_mapWidget != null)
         {
             _mapWidget.Map.MouseClick -= Map_MouseClick;
         }
         Locator locatorTask = new Locator("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");
         locatorTask.AddressToLocationsCompleted += new EventHandler<AddressToLocationsEventArgs>(locatorTask_AddressToLocationsCompleted);
         locatorTask.Failed += new EventHandler<TaskFailedEventArgs>(locatorTaskFindAddress_Failed);
         AddressToLocationsParameters addressParams = new AddressToLocationsParameters()
         {
             OutSpatialReference = _mapWidget.Map.SpatialReference
         };
         Dictionary<string, string> address = addressParams.Address;
         address.Add("SingleLine", txtAddress.Text);
         txtAddress.Text = "Enter Address";
         locatorTask.AddressToLocationsAsync(addressParams);
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine("error in find address: " + ex.Message);
     }
 }