I have a map that allows the user to show the GoogleMapsLayer. It works fine in the development environment (Win7, VS2013, VB.NET) and it also works fine deployed on a test machine.
However, I have a user in a different location that gets the error “Unable to connect to the remote server”.
Here’s the code that I use to add the layer to the map.
Dim googleLayer As GoogleMapsLayer
googleLayer = New GoogleMapsLayer()
googleLayer.Name = “Google”
googleLayer.ApiKey = sAPIKey
googleLayer.IsVisible = True
googleLayer.MapType = GoogleMapsMapType.Satellite
staticOverlay.Layers.Add(“Google”, googleLayer)
Map1.Overlays.Add(“static”, staticOverlay)
I also tried using the GoogleMapsOverlay. Same results, works fine for me, but not for user in a different location.
Dim gooMapOverly As GoogleMapsOverlay
googMapOverly = New GoogleMapsOverlay
googMapOverly.Name = “GoogleOv”
googMapOverly.IsVisible = True
googMapOverly.MapType = GoogleMapsMapType.Satellite
googMapOverly.ClientId = gGoogleClientId
Map1.Overlays.Add(“goog”, googMapOverly)
The API key is stored in the variable sAPIKey, and the ClientId is stored in gGoogleClientId.
Please advise. Thank you!
Serena Lucy
GoogleMapsLayer error
Hi Serena,
The exception “Unable to connect to the remote server” looks like because your customer’s network have some problem.
In some countries and areas sometimes the network cannot connect to Google’s server correct.
I think you should want to find another machine not in your office to run your program first to make sure that’s not the programming issue.
If the program works well in another machine also, if possible, could you please contact your customer to view some test links. You can add SendingWebRequest event in GoogleMapsOverlay for get the test link in your program.
If your customer cannot open the test link correct, that prove it’s a network problem. So you should want to choose proxy or VPN to solve that.
If that’s not a network problem I think more detail exception information should be helpful.
Regards,
Don
Hi Don,
Thank you for the quick response. Could you please post an example showing how to use the SendingWebRequest event, preferably in VB. I found the syntax in the documentation, but a more complete example would be nice.
Serena
Hi Serena,
I think this code should works for you:
Private Sub DisplayMap_Load(ByVal sender As Object, ByVal e As EventArgs)
//… other code
Dim googleOverlay As GoogleMapsOverlay
AddHandler googleOverlay.SendingWebRequest, AddressOf handleWebRequest
//… other code
End Sub
Private Sub handleWebRequest(sender As Object, e As ThinkGeo.MapSuite.Core.SendingWebRequestEventArgs)
Dim uri As Uri = e.WebRequest.RequestUri
End Sub
Please get the uri, what’s we request in GoogleOverlay.
Regards,
Don