Ver Mensaje Individual
  #3 (permalink)  
Antiguo 23/09/2014, 10:25
Kirito92
 
Fecha de Ingreso: septiembre-2014
Mensajes: 2
Antigüedad: 9 años, 7 meses
Puntos: 0
Respuesta: Mostrar coordenadas en Google Maps

Nose si funciona pero muchas gracias. Lo resolvi asi por si alguno tiene la misma duda.

En el codigo .Net que utiliceis yo hice vb:

Imports System.Data.OleDb
Imports Subgurim.Controles

Public Class Gestion
Inherits System.Web.UI.Page
Private conexion As New OleDbConnection

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
txtRol.Text = Session("Rol")
txtPermiso.Text = Session("Permiso")
If txtRol.Text = "Visitante" Then
inicio.Style("width") = "325px"
inicio.Style("margin-left") = "20px"
gestion.Style("width") = "355px"
configuracion.Visible = False
configuracion1.Visible = False
configuracion2.Visible = False
ElseIf txtRol.Text = "Gestor" And txtPermiso.Text = "No" Then
inicio.Style("width") = "325px"
inicio.Style("margin-left") = "20px"
gestion.Style("width") = "355px"
configuracion.Visible = False
configuracion1.Visible = False
configuracion2.Visible = False
ElseIf txtRol.Text = "Gestor" And txtPermiso.Text = "Si" Then
configuracion1.Visible = False
End If

If Not Page.IsPostBack Then
Try
'creamos conexion con la base de datos de television
conexion.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\Proyecto.mdb"
conexion.Open()

Dim cmd As OleDbCommand = New OleDbCommand
cmd.Connection = conexion

'hacemos una consulta, buscamos todo dentro de la tabla usuarios
cmd.CommandText = "select Identificador, Posicion, estado.Estado, estado.porcentaje, tipo.Tipo from barriles, estado, tipo where estado.id=barriles.estado and tipo.id=barriles.tipo"
cmd.CommandType = CommandType.Text

Dim dr As OleDbDataReader = cmd.ExecuteReader()

Dim ubicacionInicio As New GLatLng(40.601357, -3.6952759999999998)
GMap1.setCenter(ubicacionInicio, 10)

'Establecemos alto y ancho en px
GMap1.Height = 450
GMap1.Width = 1235

'Adiciona el control de la parte izq superior (moverse, ampliar y reducir)
GMap1.addControl(New GControl(GControl.preBuilt.LargeMapControl))

'GControl.preBuilt.MapTypeControl: permite elegir un tipo de mapa y otro.
GMap1.addControl(New GControl(GControl.preBuilt.MapTypeControl))

While dr.Read
'Pone la marca de gota de agua con el nombre de la ubicacion
Dim coordenadas As String = dr.Item("posicion")
Dim coordenada1 As String = dr.Item("posicion").split(",")(0)
Dim coordenada2 As String = dr.Item("posicion").split(",")(1)

coordenada1 = coordenada1.Replace(".", ",")
coordenada2 = coordenada2.Replace(".", ",")

Dim lat As Double = coordenada1
Dim lng As Double = coordenada2

Dim marker As GMarker = New GMarker(New GLatLng(lat, lng))

Dim strMarker As String = "<div style='width: 250px; height: 170px'><b> IDENTIFICADOR: </b>" & dr.Item("identificador") & "<br/><br/><b>POSICIÓN: </b>" & dr.Item("posicion") & "<br/><br/><b>ESTADO: </b>" & dr.Item("estado") & vbLf & "<br/><br/><b>PORCENTAJE: </b>" & dr.Item("porcentaje") & vbLf & "<br/><br/><b>TIPO: </b>" & dr.Item("tipo") & "</div>"
Dim window As New GInfoWindow(marker, strMarker, False)
GMap1.addInfoWindow(window)

End While

'Tipo de mapa a mostrar
GMap1.mapType = GMapType.GTypes.Normal

'Moverse con el cursor del teclado
GMap1.enableGKeyboardHandler = True
conexion.Close()
Catch ex As Exception
MsgBox("Problemas al abrir la conexión")
conexion.Close()
Exit Sub
End Try
End If
End Sub
End Class

Y en el Codigo html:

<%@ Page Language="vb" AutoEventWireup="true" CodeBehind="WebForm1.aspx.vb" Inherits="PruebasASP.WebForm1" %>
<%@ Register Assembly="GMaps" Namespace="Subgurim.Controles" TagPrefix="cc" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div style="width:660px; height:560px;">
<cc:GMap ID="GMap1" runat="server" />
</div>
</form>
</body>
</html>

Lo deje con mi consulta y todo vale? pero os aseguro 100% que funciona muchas gracias de todos modos por tu ayuda amigo.