Como ir a Google Maps?

Como ir a Google Maps?

Postby Armando » Wed Aug 07, 2019 9:08 pm

Foreros:

Tengo el reto de realizar una aplicación con Harbour y FWH, el detalle es que el cliente
necesita ubicar un domicilio en Google maps y esa liga conservarla en una BDD para que
al dar clic sobre esa liga se abra Google maps en el domicilio indicado.

El tema es que no tengo ni idea por donde empezar, alguien que me tire una hebra?

Saludos
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3061
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Como ir a Google Maps?

Postby hmpaquito » Thu Aug 08, 2019 7:50 am

hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: Como ir a Google Maps?

Postby cmsoft » Thu Aug 08, 2019 12:44 pm

Code: Select all  Expand view
**************************************************
** Google Maps
STATIC FUNCTION BuscaMap(cCalle,cLoca,oDlg)
LOCAL oWnd, oActiveX, cFile, cCrhome , cMap := memoread( "gmap.html" ), oErr, lError := .f.
cMap := STRTRAN(cMap,"<<dire>>",cCalle)
cMap := STRTRAN(cMap,"<<localidad>>",cLoca)
memowrit( "gmapb.html", cMap )
cFile := hb_CurDrive()+":"+CurDir()+"\gmapb.html"
cCrhome := getenv( "USERPROFILE" ) + "\AppData\Local\Google\Chrome\Application\chrome.exe -url "
oActiveX := CreateObject("WScript.Shell")
TRY
   oActiveX&#058;Exec (cCrhome+cFile)
CATCH oErr
   lError := .t.
END TRY
IF lError
TRY
   cCrhome := getenv( "PROGRAMFILES(X86)" ) + "\AppData\Local\Google\Chrome\Application\chrome.exe -url "
   lError := .f.
CATCH oErr
  lError := .t.
END TRY
ENDIF
IF lError
   MsgInfo("No pudo abrir el mapa","Error")
ENDIF
RETURN nil


No me deja pegarte el texto de como debe ser el mapa base (el archivo gmap.html) pero cualquier cosa en el foro ya estaba ...
User avatar
cmsoft
 
Posts: 1189
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: Como ir a Google Maps?

Postby karinha » Thu Aug 08, 2019 1:44 pm

Code: Select all  Expand view

// CALLES.PRG y CALLES.RC

#include "FiveWin.ch"

#Define CLR_MENTA      nRGB( 221, 255, 238 )

STATIC lSaida := .F., lLigaBotao := .F., oDlg

FUNCTION Google_Calles() // CALLE = RUA(Portugues)

   LOCAL nEnde := "", nCid := "", nPais := ""

   TestWebMapFw( nEnde, nCid, nPais )

RETURN NIL

FUNCTION Testwebmapfw( nEnde, nCid, nPais )

   LOCAL oDlg, oActiveX, oFnt, oFont
   LOCAL aWhatsNear
   LOCAL cStreet, cCity, cCountry
   LOCAL cStreet2, cCity2
   LOCAL cStreet3, cCity3
   LOCAL cStreet4, cCity4
   LOCAL cStreet5, cCity5
   LOCAL cWhatsNear
   LOCAL nZoomLevel

   DEFAULT cStreet    := "AV PAULISTA, 1313                         ", ;
           cCity      := "SAO PAULO                                 ", ;
           cCountry   := "BRASIL                  "                  , ;
           cStreet2   := SPACE( 80 ), ;
           cCity2     := SPACE( 80 ), ;
           cStreet3   := SPACE( 80 ), ;
           cCity3     := SPACE( 80 ), ;
           cStreet4   := SPACE( 80 ), ;
           cCity4     := SPACE( 80 ), ;
           cStreet5   := SPACE( 80 ), ;
           cCity5     := SPACE( 80 )
           cWhatsNear := ''
           nZoomLevel := 0

   aWhatsNear := { ;
      '', ;
      'Hotel', ;
      'Posto de Gasolina', ;
      'Praça de Alimentação', ;
      'Parque', ;
      'Peças e Acessórios de Carros', ;
      'Peças de Caminhões', ;
      'Ferrovias' ;
      }

   SetBalloon( .T. ) // Balloon shape required for tooltips
   SkinButtons()     // Botoes Coloridos nas novas versoes

   SetGetColorFocus( CLR_MENTA )

   tGet():lDisColors  := .F.
   tGet():nClrTextDis := CLR_BLUE
   tGet():nClrPaneDis := CLR_HRED // SOFTYELLOW

   DEFINE FONT oFnt    NAME "Ms Sans Serif" SIZE 00, -12 BOLD
   DEFINE FONT oFont   NAME "Ms Sans Serif" SIZE 00, -14 BOLD

   DEFINE DIALOG oDlg RESOURCE "MAP" COLORS CLR_BLACK, CLR_WHITE TRANSPARENT

   oDlg:lHelpIcon := .F.

   REDEFINE GET cStreet ID 200 OF oDlg UPDATE COLORS CLR_HBLUE, CLR_WHITE  ;
            FONT oFont

   REDEFINE GET cCity ID 300 OF oDlg UPDATE COLORS CLR_HBLUE, CLR_WHITE    ;
            FONT oFont

   REDEFINE GET cCountry ID 400 OF oDlg UPDATE COLORS CLR_HBLUE, CLR_WHITE ;
            FONT oFont

   REDEFINE COMBOBOX cWhatsNear ITEMS aWhatsNear ID 140 OF oDlg UPDATE

   REDEFINE GET cStreet2 ID 202 OF oDlg UPDATE COLORS CLR_HBLUE, CLR_WHITE ;
            FONT oFont

   REDEFINE GET cCity2   ID 302 OF oDlg UPDATE COLORS CLR_HBLUE, CLR_WHITE ;
            FONT oFont

   REDEFINE GET cStreet3 ID 203 OF oDlg UPDATE COLORS CLR_HBLUE, CLR_WHITE ;
            FONT oFont

   REDEFINE GET cCity3   ID 303 OF oDlg UPDATE COLORS CLR_HBLUE, CLR_WHITE ;
            FONT oFont

   REDEFINE GET cStreet4 ID 204 OF oDlg UPDATE COLORS CLR_HBLUE, CLR_WHITE ;
            FONT oFont

   REDEFINE GET cCity4   ID 304 OF oDlg UPDATE COLORS CLR_HBLUE, CLR_WHITE ;
            FONT oFont

   REDEFINE GET cStreet5 ID 205 OF oDlg UPDATE COLORS CLR_HBLUE, CLR_WHITE ;
            FONT oFont

   REDEFINE GET cCity5   ID 305 OF oDlg UPDATE COLORS CLR_HBLUE, CLR_WHITE ;
            FONT oFont

   REDEFINE GET nZoomLevel ID 141 OF oDlg UPDATE COLORS CLR_HBLUE, CLR_WHITE ;
            FONT oFont

   REDEFINE BUTTON ID 1 OF oDlg ;
            ACTION ShowInWin(cStreet,cCity,cCountry,cStreet2,cCity2,cStreet3,cCity3,cStreet4,cCity4,cStreet5,cCity5,cWhatsNear,nZoomLevel)

   REDEFINE BUTTON ID 150 OF oDlg ;
            ACTION ShowFull(cStreet,cCity,cCountry,cStreet2,cCity2,cStreet3,cCity3,cStreet4,cCity4,cStreet5,cCity5,cWhatsNear,nZoomLevel)

   SET FONT OF oDlg TO oFnt

   ACTIVATE DIALOG oDlg CENTERED

   oFnt:End()
   oFont:End()

RETURN NIL

function ShowFull(cStreet,cCity,cCountry,cStreet2,cCity2,cStreet3,cCity3,cStreet4,cCity4,cStreet5,cCity5,cWhatsNear,nZoomLevel)

   local oWnd, oActiveX, oBar
   local cEvents := ""
   local oWebMap

   oWebMap := WebMap():new()
   oWebMap:AddStopSep( cStreet, cCity,,, cCountry )
   // you can format address yourself or just
   // type address string like in google maps
   // using :AddStop() instead of :AddStopSep()
   //
   // oWebMap:AddStop( alltrim( cStreet )+','+;
   //    alltrim( cCity )+' '+alltrim( cCountry ) )
   // or
   // oWebMap:AddStop( 'My Address Info' )
   oWebMap:AddStopSep( cStreet2, cCity2 )
   oWebMap:AddStopSep( cStreet3, cCity3 )
   oWebMap:AddStopSep( cStreet4, cCity4 )
   oWebMap:AddStopSep( cStreet5, cCity5 )

   oWebMap:cWhatsNear := cWhatsNear
   oWebMap:nZoomLevel := nZoomLevel
   oWebMap:GenLink()

   if .not. empty( oWebMap:cLink )

      ShellExecute( 0, "open", oWebMap:cLink,,, 5 )

      // You can also use this for more control
      /*
      oActiveX := TOleAuto():New("InternetExplorer.Application")
      oActiveX&#058;Visible := .T.
      oActiveX&#058;Toolbar := .T.
      oActiveX&#058;Statusbar :=.T.
      oActiveX&#058;MenuBar := .T.
      oActiveX&#058;Navigate( oWebMap:cLink )
      */


      sysrefresh()

   endif

return nil

function ShowInWin(cStreet,cCity,cCountry,cStreet2,cCity2,cStreet3,cCity3,cStreet4,cCity4,cStreet5,cCity5,cWhatsNear,nZoomLevel)

   local oWnd, oActiveX, oBar
   local cEvents := ""
   local oWebMap

   oWebMap := WebMap():new()
   oWebMap:AddStopSep( cStreet, cCity,,, cCountry )
   oWebMap:AddStopSep( cStreet2, cCity2 )
   oWebMap:AddStopSep( cStreet3, cCity3 )
   oWebMap:AddStopSep( cStreet4, cCity4 )
   oWebMap:AddStopSep( cStreet5, cCity5 )
   oWebMap:cWhatsNear := cWhatsNear
   oWebMap:nZoomLevel := nZoomLevel
   oWebMap:GenLink()

   if .not. empty( oWebMap:cLink )

      DEFINE WINDOW oWnd TITLE "Google Map Localização" ;
         FROM 0, 0 TO 600, 800 pixel

      oActiveX = TActiveX():New( oWnd, "Shell.Explorer" )
      // oActiveX = TOleAuto():New("InternetExplorer.Application")

      // oActivex&#058;Silent := .T.  // Para Evitar: Erro de Script na Pagina.

      oWnd:oClient = oActiveX // To fill the entire window surface

      // these setprop options do not work?
      oActiveX&#058;SetProp( "Visible", .T. )
      oActiveX&#058;SetProp( "Toolbar", .T. )
      oActiveX&#058;SetProp( "Statusbar", .T. )
      oActiveX&#058;SetProp( "MenuBar", .F. )

      oActiveX&#058;Do( "Navigate", oWebMap:cLink )
      sysrefresh()
      // MsgInfo( oActiveX&#058;GetProp( "StatusBar" ) )

      ACTIVATE WINDOW oWnd

      sysrefresh()
   endif

return nil

FUNCTION VALIDA_GET1( cmpara_uf )

   IF GETASYNCKEY( VK_UP ) // Para nao perder o foco do dialgo
      RETURN( .F. )
   ENDIF

   IF EMPTY( cmpara_uf )

      MsgInfo( OemToAnsi( "OPERA€ÇO INVµLIDA!             " )+CRLF+ ;
               OemToAnsi( "DIGITIE O NOME DA UF...        " )+CRLF+ ;
               OemToAnsi( "TECLE <ENTER> PARA CONTINUAR..." ),      ;
               OemToAnsi( "OPERA€ÇO INVµLIDA!             " ) )

      lLigaBotao := .F.

      RETURN( .F. )

   ENDIF

RETURN( .T. )

FUNCTION VALIDA_GET2( cmpara_cid )

   IF EMPTY( cmpara_cid )

      MsgInfo( OemToAnsi( "OPERA€ÇO INVµLIDA!             " )+CRLF+ ;
               OemToAnsi( "DIGITIE O NOME DA CIDADE...    " )+CRLF+ ;
               OemToAnsi( "TECLE <ENTER> PARA CONTINUAR..." ),      ;
               OemToAnsi( "OPERA€ÇO INVµLIDA!             " ) )

      lLigaBotao := .F.

      RETURN( .F. )

   ENDIF

RETURN( .T. )

FUNCTION VALIDA_BOTAO( cmpara_rua, oBusca )

   IF EMPTY( cmpara_rua )

      MsgInfo( OemToAnsi( "OPERA€ÇO INVµLIDA!             " )+CRLF+ ;
               OemToAnsi( "DIGITIE O NOME DA RUA...       " )+CRLF+ ;
               OemToAnsi( "TECLE <ENTER> PARA CONTINUAR..." ),      ;
               OemToAnsi( "OPERA€ÇO INVµLIDA!             " ) )

      lLigaBotao := .F.

      RETURN( .F. )

   ENDIF

   // TUDO NORMAL, VAI BUSCAR NO GOOGLE

   lLigaBotao := .T.

   oBusca:Enable()
   oBusca:Refresh()

RETURN( .T. )

#include "Hbclass.ch"

CREATE CLASS WebMap

   VAR aAddress
   VAR nZoomLevel
   VAR cMapType    // 'MAP' = regular map, 'ROUTE' = route
   VAR oIe
   VAR cLink
   VAR cWhatsNear
   METHOD New
   METHOD AddStop
   METHOD AddStopSep
   METHOD GenLink

END CLASS

METHOD New( xAddress, nZoomLevel )

   if nZoomLevel == nil
      // default to 0 for auto calc size
      ::nZoomLevel := 0
   else
      ::nZoomLevel := nZoomLevel
   endif

   ::cLink := ''
   ::cWhatsNear := ''

   // Initialize address array
   do case
   case xAddress == nil
      ::aAddress := {}
   case valtype( xAddress ) == 'A'
      ::aAddress := xAddress
   otherwise
      ::aAddress := { xAddress }
   endcase

   // if address passed on command line lets auto create link string
   if len( ::aAddress ) > 0
      ::GenLink()
   endif

RETURN( self )

//////////////////////////////////////////
////// Method AddStop
//////////////////////////////////////////
// Purpose - To add a pre-formatted address
//            to ::aAddress
//
METHOD AddStop( cAddress )
   if cAddress != nil
      // convert spaces to +
      aadd( ::aAddress, strtran( trim( cAddress ),' ', '+' ) )
   endif
RETURN nil

//////////////////////////////////////////
////// Method AddStopSep
//////////////////////////////////////////
// Purpose - To add an address to ::aAddress
//           when you have seperate street,
//           city, zip etc that need to be
//           formated into Google Map format
// Note - You can format address yourself or just
//        type address string like in google maps
//        using :AddStop() instead of :AddStopSep()
//
METHOD AddStopSep( cStreet, cCity, cState, cZip, cCountry )
   local cAddr2

   *   default( @cStreet, '' )
   *   default( @cCity, '' )
   *   default( @cState, '' )
   *   default( @cZip, '' )
   *   default( @cCountry, '' )
   DEFAULT cStreet:= ""
   DEFAULT cCity:= ""
   DEFAULT cState:= ""
   DEFAULT cZip:= ""
   DEFAULT cCountry:= ""

   cAddr2 := ltrim( trim( cCity )+' ' )
   cAddr2 += ltrim( trim( cState )+' ' )
   cAddr2 += ltrim( trim( cZip )+' ' )
   cAddr2 += ltrim( trim( cCountry ) )

   if at( ',', cAddr2 ) > 0
      // Remove commas from this portion of address
      cAddr2 := strtran( cAddr2,',', ' ' )
      // Remove extra spaces if any
      cAddr2 := strtran( cAddr2,'  ', ' ' )
   endif

   do case
   case .not. empty( cStreet ) .and. .not. empty( cAddr2 )
      ::AddStop( trim( cStreet)+', '+cAddr2 )
   case empty( cStreet ) .and. .not. empty( cAddr2 )
      ::AddStop( cAddr2 )
   case .not. empty( cStreet ) .and. empty( cAddr2 )
      ::AddStop( trim( cStreet) )
   endcase

RETURN nil
//////////////////////////////////////////
////// Method GenLink
//////////////////////////////////////////
// Purpose - To generate link string that
//           can be passed to Internet Explorer
//           Shell or link string can be emailed
METHOD GenLink()

   local nCounter, nFor

   ::cLink := 'http://maps.google.com/maps?'

   do case
   case len( ::aAddress ) = 0
      // this will just display country map
      ::cMapType := 'MAP'
   case len( ::aAddress ) > 1
      // must be route so update map type
      ::cMapType := 'ROUTE'
   otherwise
      ::cMapType := 'MAP'
   endcase

   for nFor := 1 to len( ::aAddress )
      do case
      case nFor = 1
         if ::cMapType = 'ROUTE'
            ::cLink += 'saddr='+::aAddress[ nFor ]
         else
            // In order to use info near address
            // Must be in map mode and not route mode
            if empty( ::cWhatsNear )
               ::cLink += 'q='+::aAddress[ nFor ]
            else
               ::cLink += 'q='+trim(::cWhatsNear)
               ::cLink += chr(38)+'near='+::aAddress[ nFor ]
            endif
         endif
      case nFor = 2
         ::cLink += chr(38)+'daddr='+::aAddress[ nFor ]
      otherwise
         ::cLink += ',+to:'+::aAddress[ nFor ]
      endcase
   next

   if .not. empty( ::cLink )
      // Extra options.
      // I have commented out some of the ones that are not required
      // ::cLink += chr(38)+'hl=en'
      // ::cLink += chr(38)+'mra=pi'
      // ::cLink += chr(38)+'mrcr=1'
      // ::cLink += chr(38)+'sll=31.244355,-95.99896'
      // ::cLink += chr(38)+'sspn=2.934965,5.108643'
      // ::cLink += chr(38)+'ie=UTF8'
      if ::nZoomLevel > 0
         ::cLink += chr(38)+'z='+ltrim( str( ::nZoomLevel ) )
      endif
      // ::cLink += chr(38)+'om=1'
   endif

RETURN( ::cLink )

// CALLES.RC
/*
MAP DIALOG 170, 66, 315, 215
STYLE DS_ABSALIGN | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Google Maps Localização"
FONT 8, "MS Sans Serif"

{
 EDITTEXT 200, 8, 17, 302, 12, WS_BORDER | WS_TABSTOP
 EDITTEXT 300, 8, 42, 150, 12, WS_BORDER | WS_TABSTOP
 EDITTEXT 400, 160, 42, 150, 12, WS_BORDER | WS_TABSTOP
 CONTROL "Near", 140, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 8, 71, 167, 67
 EDITTEXT 141, 189, 71, 22, 12, WS_BORDER | WS_TABSTOP
 DEFPUSHBUTTON "&Mostrar no Navegador", 150, 19, 190, 110, 14
 PUSHBUTTON "Mostrar &Dentro do Sistema", 1, 132, 190, 110, 14
 PUSHBUTTON "&Saida", 2, 245, 190, 50, 14
 EDITTEXT 202, 10, 122, 190, 12, ES_WANTRETURN | WS_BORDER | WS_TABSTOP
 EDITTEXT 302, 209, 122, 100, 12, ES_WANTRETURN | WS_BORDER | WS_TABSTOP
 EDITTEXT 203, 10, 138, 190, 12, WS_BORDER | WS_TABSTOP
 EDITTEXT 303, 209, 138, 100, 12, WS_BORDER | WS_TABSTOP
 EDITTEXT 204, 10, 155, 190, 12, WS_BORDER | WS_TABSTOP
 EDITTEXT 304, 209, 155, 100, 12, WS_BORDER | WS_TABSTOP
 EDITTEXT 205, 10, 171, 189, 12, WS_BORDER | WS_TABSTOP
 EDITTEXT 305, 209, 171, 100, 12, WS_BORDER | WS_TABSTOP
 LTEXT "Endereço e Número", -1, 8, 6, 190, 8
 LTEXT "Cidade ou CEP", -1, 8, 32, 92, 8
 LTEXT "País", -1, 159, 32, 92, 8
 LTEXT "Extras que estão perto do endereço acima", -1, 8, 60, 170, 8
 LTEXT "Para mais direções digite mais endereços", -1, 8, 96, 190, 8
 LTEXT "Endereço e Número", -1, 10, 111, 189, 9
 LTEXT "Cidade ou CEP", -1, 209, 112, 92, 8
 LTEXT "Nível de Zoom ", -1, 189, 60, 100, 8
 LTEXT "0 ou em branco = Melhor Ajuste", -1, 214, 73, 100, 8
}
*/

 


Saludos
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7214
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Como ir a Google Maps?

Postby Armando » Thu Aug 08, 2019 1:54 pm

Foreros:

Muchas gracias a todos por sus respuestas, voy a probar y avisare el resultado.

Saludos
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3061
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Como ir a Google Maps?

Postby Armando » Thu Aug 08, 2019 5:44 pm

Amigos del foro:

Estoy intentando con el ejemplo de hmpaquito (Se ajusta mas a mis necesidades) compila bien
pero al ejecutarlo me tira un error

Code: Select all  Expand view

   Error description: (DOS Error -2147352567) WINOLE/1007  Se superó el tiempo de espera para la operación
 (0x80072EE2): WinHttp.WinHttpRequest

Stack Calls
===========
   Called from:  => TOLEAUTO:SEND( 0 )
   Called from: Source\AppKdx.Prg => VERMAPA2( 39 )
   Called from: Source\AppKdx.Prg => MAIN( 10 )
 


El código de la línea 39 es:
Code: Select all  Expand view

   Local cWeb  := "http://maps.google.es/maps/place/"
   local cMap
   local cRet  := ""
   local oOle
   local nPos1
   local nPos2
   local aCoor := { 0, 0, 0 }
   cPostal_Code := StrTran( AllTrim( cPostal_Code ), ' ', '+' )
   cStreet      := StrTran( AllTrim( cStreet ), ' ', '+' )
   cNumber      := StrTran( AllTrim( cNumber ), ' ', '+' )
   cLocality    := StrTran( AllTrim( cLocality ), ' ', '+' )
   cState       := StrTran( AllTrim( cState ), ' ', '+' )
   cNation      := StrTran( AllTrim( cNation ), ' ', '+' )
   cMap     :=  AllTrim( cPostal_Code ) + "+" + AllTrim( cStreet ) + "+" + ;
                AllTrim( cNumber ) + "+" + AllTrim( cLocality ) + "+" + ;
                AllTrim( cState ) + "+" + AllTrim( cNation )
   oOle  := CreateObject("Winhttp.WinHttpRequest.5.1")
   oOle:Open( "GET", cWeb + AllTrim( cMap ), .F. )
   oOle:Send()                                                                  <<===== AQUI
   cURL := oOle:ResponseText
 


Gracias por el apoyo, saludos
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3061
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Como ir a Google Maps?

Postby hmpaquito » Thu Aug 08, 2019 9:06 pm

Armando

ShellExecute(cWeb + AllTrim( cMap ))

Salu2
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: Como ir a Google Maps?

Postby Armando » Fri Aug 09, 2019 2:49 am

hmpaquito:

Copie tu ejemplo y lo trate de hacer funcionar sin éxito, me tira
este error.

Code: Select all  Expand view

Application
===========
   Path and name: C:\AppKdx\AppKdx.Exe (32 bits)
   Size: 3,950,592 bytes
   Compiler version: Harbour 3.2.0dev (r1904111533)
   FiveWin  version: FWH 19.05
   C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
   Windows version: 6.2, Build 9200

   Time from start: 0 hours 0 mins 1 secs
   Error occurred at: 08/08/19, 21:48:45
   Error description: Error BASE/1081  Argument error: +
   Args:
     [   1] = N   0
     [   2] = C   ,

Stack Calls
===========
   Called from: Source\AppKdx.Prg => VIEWLEAFLET( 90 )
   Called from: Source\AppKdx.Prg => MAIN( 13 )
 


Esta es la línea 90
Code: Select all  Expand view

   cInitMap  += aData[ 1 ][ 3 ] + ", " + aData[ 1 ][ 2 ] + " ], 13);" + CRLF
 


Sera que me falta alguna LIB?

Saludos
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3061
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Como ir a Google Maps?

Postby hmpaquito » Fri Aug 09, 2019 7:27 am

Armando,

Imposible conocer cual es el origen del error sin el código.

Por los argumentos decir que aData[ 1 ][ 3 ] lleva un valor numerico de cero. Probablemente necesita ser convertido a cadena o asignado como ""

Saludos
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: Como ir a Google Maps?

Postby Armando » Fri Aug 09, 2019 3:22 pm

hmpaquito:

Llevas razón y me disculpo, el código que estoy usando es el que pusiste
en el foro en Inglés, algo que recomendó tu hijo, solo cambié el path de
cWeb.

Copio y pego el código aquí y al enviarlo al foro me tira el siguiente error
por esto es que no mando todo el código

Internet Explorer no puede leer este formato de página web

Code: Select all  Expand view

#include "FiveWin.ch"

Static cUrl     := ""

Function Main()

   Local aDatas := {}
   SET 3DLOOK OFF

   AAdd( aDatas, VerMapa2( "28850", "Calle Manuel Sandoval", "1", "Torrejon de Ardoz", "Madrid", "Spain" ) )
   AAdd( aDatas, VerMapa2( "28850", "Calle Buenos Aires", "1", "Torrejon de Ardoz", "Madrid", "Spain" ) )
   AAdd( aDatas, VerMapa2( "28850", "Calle Ferrocarril", "10", "Torrejon de Ardoz", "Madrid", "Spain" ) )
   ViewLeafLet( aDatas )

Return nil

//----------------------------------------------------------------------------//

Function VerMapa2( cPostal_Code, cStreet, cNumber, cLocality, cState, cNation )
   
   Local cWeb  := "http://maps.google.es/maps/place/"
   local cMap
   local cRet  := ""
   local oOle
   local nPos1
   local nPos2
   local aCoor := { 0, 0, 0 }
   cPostal_Code := StrTran( AllTrim( cPostal_Code ), ' ', '+' )
   cStreet      := StrTran( AllTrim( cStreet ), ' ', '+' )
   cNumber      := StrTran( AllTrim( cNumber ), ' ', '+' )
   cLocality    := StrTran( AllTrim( cLocality ), ' ', '+' )
   cState       := StrTran( AllTrim( cState ), ' ', '+' )
   cNation      := StrTran( AllTrim( cNation ), ' ', '+' )
   cMap     :=  AllTrim( cPostal_Code ) + "+" + AllTrim( cStreet ) + "+" + ;
                AllTrim( cNumber ) + "+" + AllTrim( cLocality ) + "+" + ;
                AllTrim( cState ) + "+" + AllTrim( cNation )
   oOle  := CreateObject("Winhttp.WinHttpRequest.5.1")
   oOle:Open( "GET", cWeb + AllTrim( cMap ), .F. )
   oOle:Send()
   cURL := oOle:ResponseText

   nPos1  := At( "cacheResponse([[[", Left( cURL, 2048 ) )
   if !Empty( nPos1 )
      cRet   := Substr( Left( cURL, 1024 ), nPos1 + 17, 2048 - nPos1 )
      nPos2  := At( "]", cRet )
      if !Empty( nPos2 )
         cRet   := Left( cRet, nPos2 - 1 )
         aCoor  := hb_ATokens( cRet, "," )
      endif
   endif
   //XBrowse( aCoor )

Return aCoor

//----------------------------------------------------------------------------//

Function ViewLeafLet(aData)
   
   local cMapFile   := "D:\fwh\fwhteam\samples\GMaps.htm"
   local cHtmlContent1
   local cHtmlContent2
   local cHtmlContent3
   local cInitMap   := "   var mymap = L.map('mapid').setView( [ "
   local cAppendStr := "   L.polygon([" + CRLF
   local oOle
   local i

 Return nil
 


Saludos
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3061
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Como ir a Google Maps?

Postby hmpaquito » Fri Aug 09, 2019 3:36 pm

Armando,

Los hijos debe ser una cosa grande y me hubiera gustado, pero no tengo hijos.

Quizá, quien si tiene un hijo, según comentó en ese hilo y que hace programas, es Cristóbal, que es quien puso ese ejemplo, que no trabaja para Google Maps sino para LeafLet y que generosamente donó a la comunidad.

Saludos.
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: Como ir a Google Maps?

Postby Armando » Fri Aug 09, 2019 3:43 pm

hmpaquito:

:oops: :oops: :oops: , lamento la confusión, pero vale no?

La confusión es buena! :D

Voy a consultar a Cristóbal.
Saludos
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3061
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 80 guests

cron