2016-06-01 9 views
0

Bing Maps, SOAP, c#.net을 사용하고 있습니다. 나는 GeocodeAddress()을 구현하고자하지만, 형식 또는 네임 스페이스 이름 'Confidence' 네임 스페이스에 존재하지 않는 : 당신이 빙지도에 대한 아주 오래된 SOAP 서비스를 사용하는 것처럼유형 또는 네임 스페이스 이름이 네임 스페이스에 존재하지 않습니다.

private String GeocodeAddress(string address) 
     { 
      string results = ""; 
      string key = "insert your Bing Maps key here"; 
      GeocodeRequest geocodeRequest = new GeocodeRequest(); 

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

      // Set the full address query 
      geocodeRequest.Query = address; 

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

      filters[0].MinimumConfidence = GeocodeService.Confidence.High; 

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

      // Make the geocode request 
      GeocodeServiceClient geocodeService = new  GeocodeServiceClient(); 
      GeocodeResponse geocodeResponse =   geocodeService.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; 
     } 
+0

코드는 [여기] (https://msdn.microsoft.com/en-us/library/dd221354.aspx) 코드와 동일하게 보입니다 (언뜻보기). 아무것도 바꿨 니? –

+0

나는 단지 이것을 바꿉니다 : geocodeRequest.Credentials = new DevExpress.Map.BingServices.Credentials(); @Damien_The_Unbeliever – ccorcoy

+0

서비스 참조를 추가 할 때 서비스에 지정한 이름이'GeocodeService'인지 확인 했습니까? 나는. 그 이름의 첫 부분은 당신이 서비스 레퍼런스에 부여한 이름이고, 우연히 참조의 이름으로'ServiceReference1'을 받아들이 기 쉽습니다. –

답변

0

것 같습니다. 빙지도 팀은 6 년 전의지도를 사용하여 추천을 중단했습니다. Bing Maps REST 서비스는 훨씬 빠르고 기능이 풍부하며 정기적으로 업데이트됩니다. 나머지 서비스에 대한 문서는 여기에서 찾을 수 있습니다 : https://msdn.microsoft.com/en-us/library/ff701713.aspx

여기 .NET에서 REST 서비스를 사용하는 방법에 대한 문서가 있습니다 : https://msdn.microsoft.com/en-us/library/jj819168.aspx

나 또한 여기에 모범 사례 문서를 체크 아웃하는 것이 좋습니다 https://msdn.microsoft.com/en-us/library/dn894107.aspx

관련 문제