ThinkGeo.com    |     Documentation    |     Premium Support

GoogleMaps crash on postback when zoomed out too far

Hi,


It seems that when I set the BackgroundMap to a GoogleMap, I have an issue where the application crashes during a postback.  


Here is what happens: I start the application (using the GoogleMap) with a default CurrentExtent of -140, 10, 140, 4, and this shows me the whole world.  If I zoom out, the image that is rendered shows the GoogleMap 'tiled', or repeated.  (This creates havoc, BTW, with a shape file that overlays the GoogleMap)  In any case, when I perform an action that causes a postback to the server, the application crashes.  I have set a break point on the Page_Load method, but it is never reached before the crash.


The error message states: "The double value is out of range.  Parameter name: maxX"


Is this a bug, or am I doing something wrong?  Is there is a way to limit the 'zoom out' so that you can't zoom out that far?  Since the zoom functionality is done in JavaScript (Ajax?) and built into your control, I don't think I can control that functionality...true or not?


Any help would be appreciated.  I need to be able to prevent this crash.


Thanks,


Tom


Here is the complete text shown in the browser:


Server Error in '/SelectCDs' Application.

The input double value is out of range.

Parameter name: maxX

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.



Exception Details: System.ArgumentOutOfRangeException: The input double value is out of range.

Parameter name: maxX



Source Error:



An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.



Stack Trace:



[ArgumentOutOfRangeException: The input double value is out of range.

Parameter name: maxX]

   ThinkGeo.MapSuite.Core.x547f91e235e84727.x2be9d435579529c4(Double xbfda5a387f7f831f, String x0dd0c741c3800f4b, Double x97edb4541d2ddc2e, x23c0cb5ae68e11fe x9e96937cfeb45122, Double xdb117c7e5c899e75, x23c0cb5ae68e11fe x70514a72b00df1de) +97

   ThinkGeo.MapSuite.Core.x547f91e235e84727.x81638b81e081b50e(Double xbfda5a387f7f831f, String x0dd0c741c3800f4b, Double x97edb4541d2ddc2e, x23c0cb5ae68e11fe x9e96937cfeb45122) +64

   ThinkGeo.MapSuite.Core.RectangleShape..ctor(Double minX, Double maxY, Double maxX, Double minY) +60

   ThinkGeo.MapSuite.WebEdition.Map.LoadPostData(String postDataKey, NameValueCollection postCollection) +1509

   System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +661

   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1194





Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433



Tom, 


 Thanks for post!
 
1, I think you have guessed right that the exception is because of an out of range extent. As you wondered, we have an API “Map.RestrictedExtent” to limit the “pan”. We are now trying to make it limit the “zoom out” for GoogleMap also; maybe you can see it in the next beta release.


2, For now, you can set the RestrictedExtent to limit the “pan” and set a “max Zoom” to limit the “zoom out” by comparing the current extent with the MaxExtent in every ZoomEnd event. Please see the codes attached. It works in my machine with the latest public release (WebEdition 3.0.2, NetTopologySuite.dll 1.7.1.27881).
 
Ben

43-ZoomLimitationCodes.txt (1.43 KB)
45-ZoomLimitationResult.JPG (62.2 KB)

Ben,


Thanks very much.  I have implemented the RestrictedExtent property and the JavaScript code you attached.  It works great and is exactly what I needed to limit the Zoom (and Pan which I hadn't even thought of before).  Thanks again!


BTW, is there documentation anywhere on this site describing more about JavaScript code that we could implement?  I've only seen the C# API, but no JavaScript functions.  Anything like that would certainly be helpful.


Thanks again for the code.


Tom



Tom, 



Very happy that code helps. 



For now, we don’t have much documentation for the javaScript APIs. We are working on that and hope you will not need to wait too long. 



Our map control uses OpenLayers internally, which is an excellent open source map library in JavaScript supports all kinds of cool features. Now we are trying to map our objects like “Layer” to openLayers’ objects, like OpenLayers’ layer. In that way we can directly use OpenLayers’ rich APIs and reference its detailed documentations. That will help a lot for developing, especially for the client part. Hope that day comes early:) 



Ben.