This is a migrated thread and some comments may be shown as answers.

Working with British Postcodes

5 Answers 136 Views
Map
This is a migrated thread and some comments may be shown as answers.
Jake Lyon
Top achievements
Rank 1
Jake Lyon asked on 16 Jun 2010, 10:57 PM

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

5 Answers, 1 is accepted

Sort by
0
Jake Lyon
Top achievements
Rank 1
answered on 17 Jun 2010, 10:39 AM
its okay now figured it out using a third party party postcode to Lat long table
0
Andrey
Telerik team
answered on 17 Jun 2010, 02:20 PM
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
0
Jake Lyon
Top achievements
Rank 1
answered on 20 Jun 2010, 09:09 AM
 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

0
Andrey
Telerik team
answered on 21 Jun 2010, 09:59 AM
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
0
Mick D.
Top achievements
Rank 1
answered on 25 Oct 2010, 08:20 PM
Brilliant !

Thanks for posting solution - solved my problem as well

Mick
Tags
Map
Asked by
Jake Lyon
Top achievements
Rank 1
Answers by
Jake Lyon
Top achievements
Rank 1
Andrey
Telerik team
Mick D.
Top achievements
Rank 1
Share this question
or