I’m using Thinkgeo.Core 12.4.1. The GoogleMapsLayer works very well except for a recent development where I intermittently get back a black image as opposed to the expected imagery. I’ve tried to hook into the various event handlers (DrawingException, DrawnException, SentWebRequest) but these events do not get fired during debug. Is there a setting that needs to be enabled for this type of error. The black image occurs without error even when I provide an incorrect google api URI. Any help describing how to get the GoogleMapsLayer to throw exceptions would be appreciated so I can try to better understand where the error is occuring.
Thanks!
-jason
GoogleMapsLayer intermittently resolving to a black box rather than imagery
Hi Jason,
If the black tile is coming from google, then there will not be an exception thrown. I think the first thing we have to do is determine where the black tile is coming from. Sometimes with a black tile, google is throttling your requests. Are you in single tile mode or multi-tile?
Do you have a simple .sln that recreates the issue that you could attach to this ticket and we’ll take a look?
Thanks,
John
Hi John, thanks for the reply. As I stated in the original post, I can create the issue by simply using an incorrect api url, like say “https://googleapissomebadurl.com”. I would expect the GoogleMapsLayer to throw an exception rather than just return a black image.
Hi Jason,
Can you share the code where you’re setting the url on the GoogleMapsLayer? I do not see anywhere to set this in a constructor or properties. I believe that the url to the google static maps cannot be changed.
Thanks,
John
Here is how I’m assigning the google aip uri:
var googleLayer = new GoogleMapsLayer(googleClientId, googleSignature)
{
MapType = googleMapType,
PictureFormat = GoogleMapsPictureFormat.Jpeg,
Name = "Google"
};
googleLayer.SendingWebRequest += (sender, eventArgs) =>
{
eventArgs.WebRequest = System.Net.WebRequest.Create(new Uri("https://googleapissomebadurl.com"));
};
Using the above, any requests to this layer will return the black image. Using the wrong url should throw an error. Perhaps it does throw an error inside the layer but its not propagating out of the class. Is there a setting I need to cause the error to be thrown? Perhaps the layer just swallows the error and returns the black image instead?
Thanks,
-jason
Hi Jason,
We just fixed an issue in GoogleMapsLayer that internal exceptions are eaten. Please get the latest beta(ThinkGeo.Core 13.1.0-beta053) and have another try. Now you will see the following if googleLayer.DrawingExceptionMode = DrawingExceptionMode.DrawException.
There’s another issue in the Overlay level that if the layer is added to LayerOverlay, the exception cannot be thrown even layer.DrawingExceptionMode is set to ThrowException. We’ve added to the bug list but I’m afraid it’s not something can be fixed in a short time.
I see you are using v12.4.1, just FYI the latest v13 is virtually completely compatible with v12.4, you might need to install the v13 license though. We are targeting at releasing v13.1 within 2 weeks, all the features/bug fixes in beta branch will be available in v13.1.
Let us know if you see any more issues.
Thanks,
Ben
Yes, I’ve worked with the beta just now and you are correct, it does apply the error message to the image. For my purposes, I need the exception to be thrown when using the LayerOverlay. Could you provide when this bug fix will be available in a beta and/or release date?
Thank you very much for you help!
-jason
Hi Jason,
I was thinking Desktop but I just noticed you are using ThinkGeo Web. Are you using WebAPI? Can you do both Layer.DrawingExceptionMode = ThrowException and LayerOverlay.DrawingExceptionMode = ThrowException and see if that’s what you want?
Also just let you know v13.1 is released. Please upgrade to it if possible.
Thanks,
Ben
Hey Ben,
Yes this is what I need! We are moving forward with the upgrade so we can have this feature.
Thank you,
-jason
That’s Awesome!
Thanks,
Ben