Pregunta SQLCLR with BING maps

  • martes, 10 de abril de 2012 13:56
     
     

    Hi I am trying to create SQL CLR which works with BING web service

    Here is code I am using but I am facing Following issue:

    Error 243 The best overloaded method match for 'CLRFunctions.GeocodeService.GeocodeServiceClient.Geocode(CLRFunctions.GeocodeService.GeocodeRequest)' has some invalid arguments C:\Users\XXXXX\documents\visual studio 2010\Projects\Data Warehouse\CLRFunctions\Spatial_GeoCode.cs 42 47 CLRFunctions

    I added GeocodeService serviced reference.

    using System;

    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using CLRFunctions.GeocodeService;
    using System.Web.Services;
    using System.ServiceModel;

    namespace CLRFunctions
    {
        class Spatial_GeoCode
        {
            private String GeocodeAddress(string postcode)
            {
                string results = "";
                string key = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxx";


                GeocodeRequest geocodeRequest = new GeocodeRequest();

                // Set the credentials using a valid Bing Maps key
                geocodeRequest.Credentials = new Credentials();
                geocodeRequest.Credentials.ApplicationId = key;


                    geocodeRequest.Query = postcode;



                // Set the options to only return high confidence results 
                ConfidenceFilter[] filters = new ConfidenceFilter[1];
                filters[0] = new ConfidenceFilter();
                filters[0].MinimumConfidence = Confidence.High;

                // Add the filters to the options
                GeocodeOptions geocodeOptions = new GeocodeOptions();
                geocodeOptions.Filters = filters;
                geocodeRequest.Options = geocodeOptions;

                // Make the geocode request
                GeocodeServiceClient client = new GeocodeServiceClient();
        GeocodeResponse geocodeResponse = client.Geocode(geocodeRequest);

                if (geocodeResponse.Results.Length > 0)
                    results = String.Format("Latitude: {0}\nLongitude: {1}",
                      geocodeResponse.Results[0].Locations[0].Latitude,
                      geocodeResponse.Results[0].Locations[0].Longitude);
                else
                    results = "No Results Found";
                return results;
            }
        }
    }

    Thanks

    P.S. Bold text have error



    • Editado Prathyushak martes, 10 de abril de 2012 14:26
    •  

Todas las respuestas

  • viernes, 13 de abril de 2012 6:19
    Moderador
     
     

    Hi Prathyushak,

    I would like to involve someone familiar with this to have a look, and give an update later. Thanks for your understanding.


    Stephanie Lv

    TechNet Community Support

  • viernes, 13 de abril de 2012 10:53
     
     

    It's working now...

    I will update the answer very soon.

    Thanks.