Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Actually i want to find out the lat and long based Address using GoogleMaps.LocationServices API.

code:
C#
using GoogleMaps.LocationServices;
using System;

namespace Coordination
{
    public static class LocationService
    {
       
        public static Location Location (string address)
        {
            var locationService = new GoogleLocationService();
            var location = new Location();
            try
            {
                var point = locationService.GetLatLongFromAddress(address);

                if (point != null)
                {
                    location.Latitude = point.Latitude.ToString();
                    location.Longitude = point.Longitude.ToString();
                }
            }
            catch(Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return location;
        }
    } 
}


i had got the the error like "An unhandled exception of type 'System.Net.WebException' occurred in GoogleMaps.LocationServices.dll
Additional information: Request Not Authorized or Over QueryLimit" in the following line in the code
C#
var point = locationService.GetLatLongFromAddress(address);


Please help me

Thank u

What I have tried:

i had got the the error like "An unhandled exception of type 'System.Net.WebException' occurred in GoogleMaps.LocationServices.dll
Additional information: Request Not Authorized or Over QueryLimit" in the following line in the code
C#
var point = locationService.GetLatLongFromAddress(address);
Posted
Updated 9-Dec-18 20:44pm
Comments
Krishna Veni 10-Dec-18 1:54am    
Address given small content but got the error
Krishna Veni 10-Dec-18 23:54pm    
var locationService = new GoogleLocationService(APIkey);
APikey specified but i am mgetting the error same

1 solution

You probably have to pay as you have reached the limit of requests, see information here:
Usage Limits for Google Maps Platform Web Services  |  Google Maps APIs Premium Plan  |  Google Developers[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900