Working with British Postcodes

6 posts, 0 answers
  1. Jake Lyon
    Jake Lyon avatar
    5 posts
    Member since:
    May 2010

    Posted 16 Jun 2010 Link to this post

    Hi Telerik 

    I have been looking at your trial program specifically using the Charting gauge's and the map 

    one thing im struggling to figure out is how to map British postcodes as points on the map.

    do you know of any reading or have anything provided to see how to map these, 

    if i can get these working i may be able to swing my boss into buying the controls for our team

    JAke

  2. Jake Lyon
    Jake Lyon avatar
    5 posts
    Member since:
    May 2010

    Posted 17 Jun 2010 Link to this post

    its okay now figured it out using a third party party postcode to Lat long table
  3. UI for WPF is Visual Studio 2017 Ready
  4. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 17 Jun 2010 Link to this post

    Hello Jake Lyon,

    You can use geocoding for this purposes. The code below demonstrate how it can be done:

    public partial class MainPage : UserControl
    {
        private BingGeocodeProvider geocodeProvider;
        private Location geocodeLocation;
      
        public MainPage()   
        {
            InitializeComponent();
        }
      
        private void WindowLoaded(object sender, RoutedEventArgs e) 
        {
            // Init geocode provider.
            geocodeProvider = new BingGeocodeProvider()
            {
                ApplicationId = "Your Bing Application ID",
                MapControl = this.radMap
            };
            geocodeProvider.GeocodeCompleted += new EventHandler<GeocodeCompletedEventArgs>(Provider_GeocodeCompleted);
        }
      
      
        private void BeginGeocodingRequest()
        {
            Address address = new Address()
            {
                CountryRegion = "UK",
                PostalCode = "LS17 6HA"
            };
      
            GeocodeRequest geocodeRequest = new GeocodeRequest()
            {
                Address = address
            };
            this.geocodeProvider.GeocodeAsync(geocodeRequest);
        }
      
        private void Provider_GeocodeCompleted(object sender, GeocodeCompletedEventArgs e)
        {
            GeocodeResponse response = e.Response;
            if (response.Results.Count > 0)
            {
                this.radMap.SetView(response.Results[0].BestView);
      
                this.informationLayer.ItemsSource = response.Results[0].Locations;
            }
        }
    }


    Regards,
    Andrey Murzov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Jake Lyon
    Jake Lyon avatar
    5 posts
    Member since:
    May 2010

    Posted 20 Jun 2010 Link to this post

     private void Provider_GeocodeCompleted(object sender, GeocodeCompletedEventArgs e)
        {
            GeocodeResponse response = e.Response;
            if (response.Results.Count > 0)
            {
                this.radMap.SetView(response.Results[0].BestView);
                this.informationLayer.ItemsSource = response.Results[0].Locations;
            }
        } 

    hi thanks for your response 

    quick question regarding informationLayer above, do you have an example on what this may look like?

    Edit: Again I have found this within the XAML

  6. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 21 Jun 2010 Link to this post

    Hi Jake Lyon,

    The InformationLayer is a part of the RadMap control list. It is designed to put geographically positioned framework elements over the map. You can find examples of the information layer using in the our demo application.

    Best wishes,
    Andrey Murzov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Mick D.
    Mick D. avatar
    1 posts
    Member since:
    Sep 2008

    Posted 25 Oct 2010 Link to this post

    Brilliant !

    Thanks for posting solution - solved my problem as well

    Mick
Back to Top
UI for WPF is Visual Studio 2017 Ready