{"id":2604,"date":"2022-08-30T15:26:15","date_gmt":"2022-08-30T15:26:15","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/02\/04\/googlemaps-api-and-c-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:26:15","modified_gmt":"2022-08-30T15:26:15","slug":"googlemaps-api-and-c-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/googlemaps-api-and-c-collection-of-common-programming-errors\/","title":{"rendered":"GoogleMaps Api and C#-Collection of common programming errors"},"content":{"rendered":"<p>i have problem with my map. Map was working correctly about 5 months ago. Now when I load map with my coords, map is loading, but when i start browsing map, zooming etc. i&#8217;m getting white screen like there&#8217;s no connection with map.. i need to load map again, but again this same problem happens. About 5 months ago i was using this script and everything was working fine.. browsing, zooming, change map type, everything without any problems. I&#8217;ve created html code according to google website and put it in new resource file:<\/p>\n<pre><code>\n\n\n\n\n\nGoogle Maps JavaScript API v3 Example: Map Simple\n\n\n\n\n\n  function load(latitude,longitude,zoomik) {\n    var myLatlng = new google.maps.LatLng(latitude,longitude);\n    var myOptions = {\n      zoom: zoomik,\n      center: myLatlng,\n      mapTypeId: google.maps.MapTypeId.ROADMAP\n    }\n\n\n    var map = new google.maps.Map(document.getElementById(\"map_canvas\"), myOptions);\n\n    var marker = new google.maps.Marker({\n        position: myLatlng, \n        map: map,\n        title:\"Here!\"});\n\n  }\n\n\n\n\n  \n\n\n<\/code><\/pre>\n<p>Code for my button is:<\/p>\n<pre><code>  private void TestButton_Click(object sender, EventArgs e)\n    {\n        webBrowser1.Document.InvokeScript(\"load\", new object[] { -34.397, 150.644, 8 });\n    }\n<\/code><\/pre>\n<p>Screens: Map loaded correctly: <img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/l1Ub5.jpg\" \/><\/p>\n<p>After use of pan tool or zoom tool: &#8211; blank white screen. <img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/dTnWJ.jpg\" \/><\/p>\n<p>I&#8217;m using Visual C# Express and WebBrowser control from winforms.<\/p>\n<p>HTML code is working correctly in Firefox (using Aptana Studio) (zoom and pan working ok)<\/p>\n<p>What more this code from google api example is also not working correctly:<\/p>\n<pre><code>\n\n\n\n\n\nGoogle Maps JavaScript API v3 Example: Map Simple\n\n\n function initialize() {\n    var myLatlng = new google.maps.LatLng(-34.397, 150.644);\n    var myOptions = {\n     zoom: 8,\n     center: myLatlng,\n     mapTypeId: google.maps.MapTypeId.ROADMAP\n   }\n    var map = new google.maps.Map(document.getElementById(\"map_canvas\"), myOptions);\n   }\n  \n  \n  \n  \n  \n  \n<\/code><\/pre>\n<ol>\n<li>\n<p>I&#8217;ve figured this myself.<\/p>\n<p>Wrong was:<\/p>\n<pre><code>\n<\/code><\/pre>\n<p>after changing it to:<\/p>\n<pre><code>\n<\/code><\/pre>\n<p>map is working as it should.<\/p>\n<\/li>\n<li>\n<p>When i have problems with gMaps the first thing i do is changing the map key, did you try this? Which browsers did you try? Firefox, Chrome or IE ?<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2014-02-04 02:42:10. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>i have problem with my map. Map was working correctly about 5 months ago. Now when I load map with my coords, map is loading, but when i start browsing map, zooming etc. i&#8217;m getting white screen like there&#8217;s no connection with map.. i need to load map again, but again this same problem happens. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2604","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2604","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=2604"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2604\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=2604"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=2604"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=2604"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}