GMap2.Bounds

2006-11-15
2013-04-19
  • The property GMap2.Bounds is currently in a TODO state.

    Is there anyone that have an idéa of how to get the bounds? Using Google API is one solution but that would cause extra round trips and could also mess up the server side code when initalizing the map. I think the best idéa would to calculate the bounds on the server.

    /Robert

     
    • Sprocketonline
      Sprocketonline
      2006-11-15

      Hi Robert.

      I've been considering this - indeed, the round trips would add extra problems, in my opinion they would be a nightmare to implement.

      I've taken the liberty of looking at Google's javascript code directly.  (go to www.mapki.com and there is a link to the latest file on the right hand side).  Unfortunately the code is obfuscated, they have used class names such as 'j' instead of GMap2, or 'Xe' instead of getBounds etc..  I undertook it upon myself to try and make some sense of it.

      I took the code and reverse engineered and parsed it into C#, thus allowing me to add XMLcomments and get tooltip and autocomplete and use it in a C# IDE.  There is a folder, 'GoogleMapJavascriptReverseEngineering', on the SVN with my efforts.

      You can look at this and see Google's own code for calculating the bounds.  DO NOT copy and paste directly - there are copyright issues. (and anyway I don't particularly want obfuscated code anywhere near the GMap.Net Control, so at the very least change the names to something sensible!)

      Iain

      P.S.  I started the reverse engineering with Google Map version 2.67.  2.68 has been released since, and there may be some changes (MarkerManager for a start)