Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

geoding:Google doesn't work #154

Open
squeezed69 opened this issue Dec 1, 2021 · 5 comments
Open

geoding:Google doesn't work #154

squeezed69 opened this issue Dec 1, 2021 · 5 comments

Comments

@squeezed69
Copy link

squeezed69 commented Dec 1, 2021

Hi i have followed the Generic C# Geocoding API Build Status and readme.md instruction.
I have installed on visualstudio Geocoding.Google nuget that install
Geocoding.Goggle but also Goecoding.core
my problem at if I run this code on my masterpage.cs it goes on error
protected async Task Page_LoadAsync(object sender, EventArgs e)
{
/* IGeocoder geocoder = new GoogleGeocoder() { ApiKey = "myapikey" };

     IEnumerable<Address> addresses = await geocoder.GeocodeAsync("1600 pennsylvania ave washington dc");

     Console.WriteLine("Formatted: " + addresses.First().FormattedAddress);
     // Formatted: 1600 Pennsylvania Ave SE, Washington, DC 20003, USA

     Console.WriteLine("Coordinates: " + addresses.First().Coordinates.Latitude + ", " + addresses.First().Coordinates.Longitude);
     // Coordinates: 38.8791981, -76.9818437*/

    GoogleGeocoder geocoder = new GoogleGeocoder();
    IEnumerable<GoogleAddress> addresses = await geocoder.GeocodeAsync("1600 pennsylvania ave washington dc");
    
    var country = addresses.Where(a => !a.IsPartialMatch).Select(a => a[GoogleAddressType.Country]).First();
    //  Console.WriteLine("Country: " + country.LongName + ", " + country.ShortName); //Country: United States, US
}

CS0433: The type 'GoogleGeocoder' exists in both 'Geocoding.Google, Version=4.0.1.0, Culture=neutral, PublicKeyToken=null' and 'Geocoding, Version=3.6.0.0, Culture=neutral, PublicKeyToken=7c714700b88674c7'
i have tryed to install only the nuget compent Geoding.core but it's the same...
my VS version is VS 2019 and 4.7.2 is framework
does someone know how to resolve this error?
best regards
tkx for your help

@squeezed69
Copy link
Author

err1

@squeezed69
Copy link
Author

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\vs\9c57b3b5\dc672bed\App_Web_nsn3gkpt.0.cs(172,46): warning CS0436: The type 'MasterPage' in 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\vs\9c57b3b5\dc672bed\App_Web_nsn3gkpt.0.cs' conflicts with the imported type 'MasterPage' in 'GeoCodingCsharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\vs\9c57b3b5\dc672bed\App_Web_nsn3gkpt.0.cs'.
C:\Users\fontanel\source\repos\GeoCodingCsharp\GeoCodingCsharp\MasterPage.master.cs(15,19): error CS0433: The type 'IGeocoder' exists in both 'Geocoding.Core, Version=4.0.1.0, Culture=neutral, PublicKeyToken=null' and 'Geocoding, Version=3.6.0.0, Culture=neutral, PublicKeyToken=7c714700b88674c7'
C:\Users\fontanel\source\repos\GeoCodingCsharp\GeoCodingCsharp\MasterPage.master.cs(15,44): error CS0433: The type 'GoogleGeocoder' exists in both 'Geocoding.Google, Version=4.0.1.0, Culture=neutral, PublicKeyToken=null' and 'Geocoding, Version=3.6.0.0, Culture=neutral, PublicKeyToken=7c714700b88674c7'
C:\Users\fontanel\source\repos\GeoCodingCsharp\GeoCodingCsharp\MasterPage.master.cs(17,22): error CS0433: The type 'Address' exists in both 'Geocoding.Core, Version=4.0.1.0, Culture=neutral, PublicKeyToken=null' and 'Geocoding, Version=3.6.0.0, Culture=neutral, PublicKeyToken=7c714700b88674c7'

@squeezed69
Copy link
Author

squeezed69 commented Dec 1, 2021

deleting nuget Geocoding.Google and remaining Geocoding.Core it doesn't see GoogleGeocoder
Uploading err2.JPG…

@squeezed69
Copy link
Author

err2

@RodneyRichardson
Copy link
Contributor

RodneyRichardson commented Dec 22, 2021

@squeezed69 I think you want to get rid of the older Geocoding assembly, and just use Geocoding.Core and Geocoding.Google.

Just adding a dependency on Geocoding.Google should pull in the Core dependency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants