I'm trying to get the lat/lng of my current location of my win7 PC, I'm using Bing maps. I've had some words with the guys at the SO C# chat room and they told me about this github project. Now I've downloaded the NuGet components: Geocoding.Core
and Geocoding.Microsoft
In the example provided, an IGeocoder
should be instantiated as follows:
IGeocoder geocoder = new GoogleGeocoder() { ApiKey = "this-is-my-optional-google-api-key" };
Now what I'm trying to do is using MicrosoftGeocoder
instead. But the IDE doesn't seem to have this kind of constructor, the new
keyword won't give me that option. Here's my code:
public MainWindow()
{
InitializeComponent();
MainMap.Mode = new AerialMode(true);
MainMap.Focus();
MainMap.Culture = "ar-sa";
MainMap.MouseDoubleClick += new MouseButtonEventHandler(MapWithPushpins_MouseDoubleClick);
IGeocoder geocoder = new MicrosoftGeocoder("KEY HERE");
}
I should say that I haven't dealt with github very much so excuse my ignorance if I'm missing something.
There is no MicrosoftGeocoder
type available in Geocoding.Microsoft
but the constructor of BingMapsGeocoder
accepts a key:
IGeocoder geocoder = new BingMapsGeocoder("KEY HERE");