Buenas tengo una duda, estoy desarrollando un sistema en asp.net y quisiera pintar poligonos en google maps teniendo en base de datos las coordenadas de esos poligonos.. entonces como puedo pasar las coordenadas de los poligonos desde base de datos a google maps.. tengo este codigo pero nose como ir llenando el arreglo que esta en negritas..
function initialize() {
var mapOptions = {
zoom: 7,
//ubicacion de colombia
center: new google.maps.LatLng(4.9190021, -72.7798205),
mapTypeId: google.maps.MapTypeId.TERRAIN
};
var bermudaTriangle;
map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
for (var num = 0; num <= TotalBoundary ; num = num + 1) {
var vertex = num + 1;
var sqlx = "select c.XCOORD/360000.00 as Y from BOUNDARY as a join BOUNDARY_VERTEX as b on a.BOUNDARY_SET_ID = b.BOUNDARY_SET_ID join VERTEX as c on c.BOUNDARY_SET_ID = b.BOUNDARY_SET_ID join BOUNDARY_SET as d on d.BOUNDARY_SET_ID = a.BOUNDARY_SET_ID where a.BOUNDARY_SET_ID= 144 and a.BOUNDARY_ID = 1 and a.BOUNDARY_ID = b.BOUNDARY_ID and b.VERTEX_ID = c.VERTEX_ID and c.VERTEX_ID=" + vertex;
da = new SqlDataAdapter(sqlx, conRS);
da.SelectCommand.Connection.Open();
var x = Convert.ToInt32(da.SelectCommand.ExecuteScalar().ToString());
da.SelectCommand.Connection.Close();
var sqly = "select c.YCOORD/360000.00 as X from BOUNDARY as a join BOUNDARY_VERTEX as b on a.BOUNDARY_SET_ID = b.BOUNDARY_SET_ID join VERTEX as c on c.BOUNDARY_SET_ID = b.BOUNDARY_SET_ID join BOUNDARY_SET as d on d.BOUNDARY_SET_ID = a.BOUNDARY_SET_ID where a.BOUNDARY_SET_ID= 144 and a.BOUNDARY_ID = 1 and a.BOUNDARY_ID = b.BOUNDARY_ID and b.VERTEX_ID = c.VERTEX_ID and c.VERTEX_ID=" + vertex;
da = new SqlDataAdapter(sqly, conRS);
da.SelectCommand.Connection.Open();
var y = Convert.ToInt32(da.SelectCommand.ExecuteScalar().ToString());
da.SelectCommand.Connection.Close();
// valores donde se ponen las coordenas de los poligonos a pintar.
var tiangleCoords=[num]
<strong> var triangleCoords = [
new google.maps.LatLng(x, y)
]; </strong>
}
// Construct the polygon.
bermudaTriangle = new google.maps.Polygon({
paths: triangleCoords,
strokeColor: '#FF0000',
strokeOpacity: 0.8,
strokeWeight: 3,
fillColor: '#FF0000',
fillOpacity: 0.35
});
bermudaTriangle.setMap(map);