Click here to Skip to main content
15,879,474 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Everyone,

I hope you are doing well.

Could you please advise me to the following issue I am facing.

I am using in c# CMapControl and when I want to assign NearMap or YahooMap as map provider, it returns me: 'Exception: The remote server returned an error: (401).

When I assign:
map.MapProvider = GMapProviders.GoogleMap
, the map is rendered correctly. I wonder if the issue is not related to an authorization token ?

Do you think this is the case ? Do you know if these providers are still active ?

Maybe I should not allow them in the map selection list I have managed as follow:

C#
private static Dictionary<string, GMapProvider> Maps = new Dictionary<string, GMapProvider>()
        {
            {"Google"               ,GMapProviders.GoogleMap},               // 
            {"Bing"                 ,GMapProviders.BingMap},                 // 
            {"Yahoo"                ,GMapProviders.YahooMap},                // 
            {"Yandex"               ,GMapProviders.YandexMap},               // 
            {"Near"                 ,GMapProviders.NearMap},                 // 
            {"OpenCycle"            ,GMapProviders.OpenCycleMap},            // 
            {"OpenStreet"           ,GMapProviders.OpenStreetMap}            // 
        };


What is your view on this issue ? Any inputs are very welcome.
Thank you very much in advance.

I wish you a splendid sunny time.

Best regards.
MiQi

What I have tried:

I have tried to set in comment the zoom limit values and also some cache flags but the issue remains the same, no yahoo or near maps are drawn.

C#
map.MapProvider = GMapProviders.NearMap;
            
map.Position = new PointLatLng(54.6961334816182, 25.2985095977783);
//map.MinZoom = 0;
//map.MaxZoom = 24;
map.Zoom = 9;
GMaps.Instance.UseMemoryCache = false;
GMaps.Instance.CacheOnIdleRead = false;
GMaps.Instance.BoostCacheEngine = true;
Posted
Updated 1-Jun-21 0:46am
v2
Comments
Richard MacCutchan 1-Jun-21 5:13am    
"Exception: The remote server returned an error: (401)."
It could not be more clear that the issue is on the server side. So examine all the information that the server returns to find out why it gives a 401. If necessary check the API documentation for the system in question.
SuperMiQi 1-Jun-21 5:46am    
Hello Richard,
Thank you for your comment but I am just wondering if this is normal only these two are failing and the other providers not. I just rely to gmapcontrol which offers these different providers and by just assigning them to gmapcontrol.mapProvider should render the selected map type. Maybe should I remove these two as it may required a token to invoke internally the gmapcontrol api request ? Do you have already played with gmapcontrol for yahoo and nearmap ?

Thank you very much in advance.
Best regards.
MiQi

1 solution

A HTTP 401 error code is Unauthorized, which likely means some sort of authentication or API token is required that isn't currently being provided. Have you checked with the documentation to ensure that you're providing these in order to connect to and use the APIs?
 
Share this answer
 
Comments
SuperMiQi 1-Jun-21 8:22am    
Hello Chris,
thank you very much for your reply.

I searched on https://developer.yahoo.com/api/ and the map api is even not available on their list. I fear it is retired these days. Do you have heard about that ?

Thank you very much in advance.
Best regards.
MiQi
Chris Copeland 1-Jun-21 10:47am    
If the API has been deprecated, and you know that the Google one works, could you not just use the Google maps instead? Unfortunately it sounds like a limitation in this CMapControl.
SuperMiQi 1-Jun-21 12:56pm    
Ok thank you very much.

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