Note that there are some explanatory texts on larger screens.

plurals
  1. PODraw Polygon using set latlong from database in googlemaps
    primarykey
    data
    text
    <p>I am trying to draw polygon in my map but fail. I have set latlng from my database. I already read the tutorial in here <a href="https://developers.google.com/maps/documentation/javascript/examples/polygon-simple" rel="nofollow">https://developers.google.com/maps/documentation/javascript/examples/polygon-simple</a></p> <p>I am using vb.net on query.</p> <p>here is my code :</p> <pre><code>function showpolygon(){ var data1 = "&lt;%= vpolygon %&gt;"; var ndata1 = data1.split("|"); var len1 = ndata1.length; var nnama, nlat, nlong, gmbrpolygon; var arraypoly = []; var arraypoly1 = []; var n =0; var polygons = []; alert ("&lt;%= vpolygon %&gt;"); for (var i = 0; i &lt; len1; i++) { ndata11 = ndata1[i].split("~"); nlat = parseFloat (ndata11[1]); nlong = parseFloat(ndata11[2]); arraypoly = new google.maps.LatLng(nlat,nlong); //alert(polygons); arraypoly1.push(arraypoly); } polygons.push(arraypoly1); gmbrpolygon = new google.maps.Polygon({ paths: arraypoly1, strokeColor: '#FF0000', strokeOpacity: 0.8, strokeWeight: 2, fillColor: '#FF0000', fillOpacity: 0.35 }); gmbrpolygon.setMap(map); } </code></pre> <p>I am trying to using a mvc array but an error occurs.</p> <p>edit :&lt;%= vpolygon %> contain : name~lat~long~numberof|</p> <pre><code>polygon[n] = { location: new google.maps.LatLng(nlat,nlong)}; var polygons = new google.maps.MVCArray(polygon); </code></pre> <p>the error when i am using mvc array is parameter 0: [object][object] and Cannot set property '0' of undefined</p> <p>and with this code nothing error in console javascript, but the polygon doesn't appear.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload