Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #6173 > unrolled thread

Google Maps Functions Integration

Started byWhizzwilly <whizzwilly@hotmail.co.uk>
First post2013-10-30 11:01 -0700
Last post2013-11-01 21:11 +0100
Articles 6 — 3 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Google Maps Functions Integration Whizzwilly <whizzwilly@hotmail.co.uk> - 2013-10-30 11:01 -0700
    Re: Google Maps Functions Integration "Gerhard Bunzel" <g.bunzel@domonet.de> - 2013-10-31 00:54 +0100
      Re: Google Maps Functions Integration Whizzwilly <whizzwilly@hotmail.co.uk> - 2013-10-31 03:13 -0700
    Re: Google Maps Functions Integration "Wolfgang Riedmann" <wriedmann@gmail.com> - 2013-10-31 13:45 +0100
      Re: Google Maps Functions Integration Whizzwilly <whizzwilly@hotmail.co.uk> - 2013-11-01 10:19 -0700
        Re: Google Maps Functions Integration "Wolfgang Riedmann" <wriedmann@gmail.com> - 2013-11-01 21:11 +0100

#6173 — Google Maps Functions Integration

FromWhizzwilly <whizzwilly@hotmail.co.uk>
Date2013-10-30 11:01 -0700
SubjectGoogle Maps Functions Integration
Message-ID<99e97844-dbf7-4108-92bb-9c66248018c2@googlegroups.com>
Hello


Is there a google maps function to calculate driving distances between 2 places (United Kingdom) and can it be accessed from within a VO 2.8 application.

I know i can calculate the distances if i go on the google maps webpage and key it in manually (for mileage expenses) but because i have many journeys to input it would save me a lot of time if i could automate this from within the application.

I don't know if such a request is possible but if any member could point me in the right direction i would be very grateful.

If it is possible then what other google map functions are available.

Regards

Paul

[toc] | [next] | [standalone]


#6177

From"Gerhard Bunzel" <g.bunzel@domonet.de>
Date2013-10-31 00:54 +0100
Message-ID<l4s66a$8oa$1@news.m-online.net>
In reply to#6173
Paul,

here are two samples for google maps parameters:

...to go from Berlin to Munich - "Oktoberfest":

https://maps.google.com/?hlÞ&t=m&saddr=Alexanderplatz,+10178,+Berlin,+Deutschland&daddrºvariaring+10,+80336,+München,+Deutschland


...and with a stop at Dresden - 'Semperoper' in english:

https://maps.google.com/?hl=en&t=m&saddr=Alexanderplatz,+10178,+Berlin,+Deutschland,+to:Theaterplatz+2,+01067,+Dresden,+Deutschland&daddrºvariaring+10,+80336,+München,+Deutschland


?hl=en - Map in english
?hlÞ - Map in german

remove &t=m to see the route as satellite image

&saddr=  starting address
&daddr=  destination address
,+to to add a stop



Here is a small class to generate a link - not tested to the end - but it's 
working:

  LOCAL cLink AS STRING

  oMap := WebMap{}
  oMap:AddStopSep(AllTrim(SELF:oDCbBrowser:Server:FIELDGET(#STRASSE)),
AllTrim(SELF:oDCbBrowser:Server:FIELDGET(#ORT)),,
AllTrim(SELF:oDCbBrowser:Server:FIELDGET(#PLZ)),
AllTrim(SELF:oDCbBrowser:Server:FIELDGET(#LAND)))
  oMap:GenLink()
  cLink := oMap:MapLink

  OpenObject(cLink, NULL_PTR)



CLASS WebMap
 PROTECT aAddress   AS ARRAY
 PROTECT nZoomLevel AS INT
 PROTECT cMapType   AS STRING    // 'MAP' = regular map, 'ROUTE' = route
 PROTECT cLink      AS STRING
 PROTECT cWhatsNear AS STRING

 DECLARE METHOD GenLink

 DECLARE ACCESS MapLink

METHOD Init ( xAddress, nZoomLevel ) CLASS WebMap

   IF nZoomLevel == NIL
      // default to 0 for auto calc size
      SELF:nZoomLevel := 0
   ELSE
      SELF:nZoomLevel := nZoomLevel
   ENDIF
   SELF:cLink      := NULL_STRING
   SELF:cWhatsNear := NULL_STRING

   /******
 aWhatsNear := { ;
       '', ;
       'Hotel', ;
       'Gas', ;
       'Food', ;
       'Parks', ;
       'Car Parts', ;
       'Truck Parts', ;
       'Railroads' ;
       }
   ******/

   // Initialize address array
   DO CASE
      CASE xAddress == NIL
         SELF:aAddress := {}
      CASE ValType( xAddress ) == 'A'
         SELF:aAddress := xAddress
      OTHERWISE
         SELF:aAddress := { xAddress }
   ENDCASE
   // if address passed on command line lets auto create link string
   IF ALen( SELF:aAddress ) > 0
      SELF:GenLink()
   ENDIF

 RETURN SELF

METHOD AddStop ( cAddress ) CLASS WebMap

//////////////////////////////////////////
////// Method AddStop
//////////////////////////////////////////
// Purpose - To add a pre-formatted address
//            to SELF:aAddress
//

   IF cAddress != NIL
      // convert spaces to +
      AAdd( SELF:aAddress, StrTran( Trim( cAddress ),' ', '+' ) )
   ENDIF

 RETURN

METHOD AddStopSep ( cStreet, cCity, cState, cZip, cCountry ) CLASS WebMap
   LOCAL cAddr2 AS STRING

//////////////////////////////////////////
////// 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()
//

   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 )
         SELF:AddStop( Trim( cStreet)+', '+cAddr2 )
      CASE Empty( cStreet ) .and. .not. Empty( cAddr2 )
         SELF:AddStop( cAddr2 )
      CASE .not. Empty( cStreet ) .and. Empty( cAddr2 )
         SELF:AddStop( Trim( cStreet) )
   ENDCASE

 RETURN

METHOD GenLink () AS STRING PASCAL CLASS WebMap
 LOCAL nFor      AS DWORD

//////////////////////////////////////////
////// Method GenLink
//////////////////////////////////////////
// Purpose - To generate link string that
//           can be passed to Internet Explorer
//           Shell or link string can be emailed


   SELF:cLink := 'http://maps.google.com/maps?'
   DO CASE
      CASE ALen( SELF:aAddress ) == 0
         // this will just display country map
         SELF:cMapType := 'MAP'
      CASE ALen( SELF:aAddress ) > 1
         // must be route so update map type
         SELF:cMapType := 'ROUTE'
      OTHERWISE
         SELF:cMapType := 'MAP'
   ENDCASE
   FOR nFor := 1 UPTO ALen( SELF:aAddress )
      DO CASE
         CASE nFor == 1
            IF SELF:cMapType == 'ROUTE'
               SELF:cLink += 'saddr=' + SELF:aAddress[ nFor ]
            ELSE
               // In order to use info near address
               // Must be in map mode and not route mode
               IF Empty( SELF:cWhatsNear )
                  SELF:cLink += 'q=' + SELF:aAddress[ nFor ]
               ELSE
                  SELF:cLink += 'q=' + AllTrim(SELF:cWhatsNear)
                  SELF:cLink += _CHR(38) + 'near=' + SELF:aAddress[ nFor ]
               ENDIF
            ENDIF
         CASE nFor == 2
            SELF:cLink += _CHR(38) + 'daddr=' + SELF:aAddress[ nFor ]
         OTHERWISE
            SELF:cLink += ',+to:' + SELF:aAddress[ nFor ]
      ENDCASE
   NEXT
   IF .not. Empty( SELF:cLink )
      // Extra options.
      // I have commented out some of the ones that are not required
      // ::cLink += chr(38)+'hlÞ'
      // ::cLink += chr(38)+'t=m'
      // ::cLink += chr(38)+'mra=pi'
      // ::cLink += chr(38)+'mrcr=1'
      // ::cLink += chr(38)+'sll1.244355,-95.99896'
      // ::cLink += chr(38)+'sspn=2.934965,5.108643'
      // ::cLink += chr(38)+'ie=UTF8'
      IF SELF:nZoomLevel > 0
         SELF:cLink += _CHR(38)+'z=' + NTrim( SELF:nZoomLevel )
      ENDIF
      // ::cLink += chr(38)+'om=1'
   ENDIF

 RETURN SELF:cLink

ACCESS MapLink AS STRING PASCAL CLASS WebMap
 RETURN SELF:cLink



HTH

Gerhard Bunzel



"Whizzwilly" <whizzwilly@hotmail.co.uk> schrieb im Newsbeitrag 
news:99e97844-dbf7-4108-92bb-9c66248018c2@googlegroups.com...
> Hello
>
>
> Is there a google maps function to calculate driving distances between 2 
> places (United Kingdom) and can it be accessed from within a VO 2.8 
> application.
>
> I know i can calculate the distances if i go on the google maps webpage 
> and key it in manually (for mileage expenses) but because i have many 
> journeys to input it would save me a lot of time if i could automate this 
> from within the application.
>
> I don't know if such a request is possible but if any member could point 
> me in the right direction i would be very grateful.
>
> If it is possible then what other google map functions are available.
>
> Regards
>
> Paul
>
> 

[toc] | [prev] | [next] | [standalone]


#6180

FromWhizzwilly <whizzwilly@hotmail.co.uk>
Date2013-10-31 03:13 -0700
Message-ID<e1e8a832-0223-4df4-9b15-699d86262cef@googlegroups.com>
In reply to#6177
On Wednesday, 30 October 2013 23:54:43 UTC, Gerhard Bunzel  wrote:
> Paul,
> 
> 
> 
> here are two samples for google maps parameters:
> 
> 
> 
> ...to go from Berlin to Munich - "Oktoberfest":
> 
> 
> 
> https://maps.google.com/?hl=de&t=m&saddr=Alexanderplatz,+10178,+Berlin,+Deutschland&daddr=Bavariaring+10,+80336,+München,+Deutschland
> 
> 
> 
> 
> 
> ...and with a stop at Dresden - 'Semperoper' in english:
> 
> 
> 
> https://maps.google.com/?hl=en&t=m&saddr=Alexanderplatz,+10178,+Berlin,+Deutschland,+to:Theaterplatz+2,+01067,+Dresden,+Deutschland&daddr=Bavariaring+10,+80336,+München,+Deutschland
> 
> 
> 
> 
> 
> ?hl=en - Map in english
> 
> ?hl=de - Map in german
> 
> 
> 
> remove &t=m to see the route as satellite image
> 
> 
> 
> &saddr=  starting address
> 
> &daddr=  destination address
> 
> ,+to to add a stop
> 
> 
> 
> 
> 
> 
> 
> Here is a small class to generate a link - not tested to the end - but it's 
> 
> working:
> 
> 
> 
>   LOCAL cLink AS STRING
> 
> 
> 
>   oMap := WebMap{}
> 
>   oMap:AddStopSep(AllTrim(SELF:oDCbBrowser:Server:FIELDGET(#STRASSE)),
> 
> AllTrim(SELF:oDCbBrowser:Server:FIELDGET(#ORT)),,
> 
> AllTrim(SELF:oDCbBrowser:Server:FIELDGET(#PLZ)),
> 
> AllTrim(SELF:oDCbBrowser:Server:FIELDGET(#LAND)))
> 
>   oMap:GenLink()
> 
>   cLink := oMap:MapLink
> 
> 
> 
>   OpenObject(cLink, NULL_PTR)
> 
> 
> 
> 
> 
> 
> 
> CLASS WebMap
> 
>  PROTECT aAddress   AS ARRAY
> 
>  PROTECT nZoomLevel AS INT
> 
>  PROTECT cMapType   AS STRING    // 'MAP' = regular map, 'ROUTE' = route
> 
>  PROTECT cLink      AS STRING
> 
>  PROTECT cWhatsNear AS STRING
> 
> 
> 
>  DECLARE METHOD GenLink
> 
> 
> 
>  DECLARE ACCESS MapLink
> 
> 
> 
> METHOD Init ( xAddress, nZoomLevel ) CLASS WebMap
> 
> 
> 
>    IF nZoomLevel == NIL
> 
>       // default to 0 for auto calc size
> 
>       SELF:nZoomLevel := 0
> 
>    ELSE
> 
>       SELF:nZoomLevel := nZoomLevel
> 
>    ENDIF
> 
>    SELF:cLink      := NULL_STRING
> 
>    SELF:cWhatsNear := NULL_STRING
> 
> 
> 
>    /******
> 
>  aWhatsNear := { ;
> 
>        '', ;
> 
>        'Hotel', ;
> 
>        'Gas', ;
> 
>        'Food', ;
> 
>        'Parks', ;
> 
>        'Car Parts', ;
> 
>        'Truck Parts', ;
> 
>        'Railroads' ;
> 
>        }
> 
>    ******/
> 
> 
> 
>    // Initialize address array
> 
>    DO CASE
> 
>       CASE xAddress == NIL
> 
>          SELF:aAddress := {}
> 
>       CASE ValType( xAddress ) == 'A'
> 
>          SELF:aAddress := xAddress
> 
>       OTHERWISE
> 
>          SELF:aAddress := { xAddress }
> 
>    ENDCASE
> 
>    // if address passed on command line lets auto create link string
> 
>    IF ALen( SELF:aAddress ) > 0
> 
>       SELF:GenLink()
> 
>    ENDIF
> 
> 
> 
>  RETURN SELF
> 
> 
> 
> METHOD AddStop ( cAddress ) CLASS WebMap
> 
> 
> 
> //////////////////////////////////////////
> 
> ////// Method AddStop
> 
> //////////////////////////////////////////
> 
> // Purpose - To add a pre-formatted address
> 
> //            to SELF:aAddress
> 
> //
> 
> 
> 
>    IF cAddress != NIL
> 
>       // convert spaces to +
> 
>       AAdd( SELF:aAddress, StrTran( Trim( cAddress ),' ', '+' ) )
> 
>    ENDIF
> 
> 
> 
>  RETURN
> 
> 
> 
> METHOD AddStopSep ( cStreet, cCity, cState, cZip, cCountry ) CLASS WebMap
> 
>    LOCAL cAddr2 AS STRING
> 
> 
> 
> //////////////////////////////////////////
> 
> ////// 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()
> 
> //
> 
> 
> 
>    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 )
> 
>          SELF:AddStop( Trim( cStreet)+', '+cAddr2 )
> 
>       CASE Empty( cStreet ) .and. .not. Empty( cAddr2 )
> 
>          SELF:AddStop( cAddr2 )
> 
>       CASE .not. Empty( cStreet ) .and. Empty( cAddr2 )
> 
>          SELF:AddStop( Trim( cStreet) )
> 
>    ENDCASE
> 
> 
> 
>  RETURN
> 
> 
> 
> METHOD GenLink () AS STRING PASCAL CLASS WebMap
> 
>  LOCAL nFor      AS DWORD
> 
> 
> 
> //////////////////////////////////////////
> 
> ////// Method GenLink
> 
> //////////////////////////////////////////
> 
> // Purpose - To generate link string that
> 
> //           can be passed to Internet Explorer
> 
> //           Shell or link string can be emailed
> 
> 
> 
> 
> 
>    SELF:cLink := 'http://maps.google.com/maps?'
> 
>    DO CASE
> 
>       CASE ALen( SELF:aAddress ) == 0
> 
>          // this will just display country map
> 
>          SELF:cMapType := 'MAP'
> 
>       CASE ALen( SELF:aAddress ) > 1
> 
>          // must be route so update map type
> 
>          SELF:cMapType := 'ROUTE'
> 
>       OTHERWISE
> 
>          SELF:cMapType := 'MAP'
> 
>    ENDCASE
> 
>    FOR nFor := 1 UPTO ALen( SELF:aAddress )
> 
>       DO CASE
> 
>          CASE nFor == 1
> 
>             IF SELF:cMapType == 'ROUTE'
> 
>                SELF:cLink += 'saddr=' + SELF:aAddress[ nFor ]
> 
>             ELSE
> 
>                // In order to use info near address
> 
>                // Must be in map mode and not route mode
> 
>                IF Empty( SELF:cWhatsNear )
> 
>                   SELF:cLink += 'q=' + SELF:aAddress[ nFor ]
> 
>                ELSE
> 
>                   SELF:cLink += 'q=' + AllTrim(SELF:cWhatsNear)
> 
>                   SELF:cLink += _CHR(38) + 'near=' + SELF:aAddress[ nFor ]
> 
>                ENDIF
> 
>             ENDIF
> 
>          CASE nFor == 2
> 
>             SELF:cLink += _CHR(38) + 'daddr=' + SELF:aAddress[ nFor ]
> 
>          OTHERWISE
> 
>             SELF:cLink += ',+to:' + SELF:aAddress[ nFor ]
> 
>       ENDCASE
> 
>    NEXT
> 
>    IF .not. Empty( SELF:cLink )
> 
>       // Extra options.
> 
>       // I have commented out some of the ones that are not required
> 
>       // ::cLink += chr(38)+'hl=de'
> 
>       // ::cLink += chr(38)+'t=m'
> 
>       // ::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 SELF:nZoomLevel > 0
> 
>          SELF:cLink += _CHR(38)+'z=' + NTrim( SELF:nZoomLevel )
> 
>       ENDIF
> 
>       // ::cLink += chr(38)+'om=1'
> 
>    ENDIF
> 
> 
> 
>  RETURN SELF:cLink
> 
> 
> 
> ACCESS MapLink AS STRING PASCAL CLASS WebMap
> 
>  RETURN SELF:cLink
> 
> 
> 
> 
> 
> 
> 
> HTH
> 
> 
> 
> Gerhard Bunzel
> 
> 
> 
> 
> 
> 
> 
> "Whizzwilly" <whizzwilly@hotmail.co.uk> schrieb im Newsbeitrag 
> 
> news:99e97844-dbf7-4108-92bb-9c66248018c2@googlegroups.com...
> 
> > Hello
> 
> >
> 
> >
> 
> > Is there a google maps function to calculate driving distances between 2 
> 
> > places (United Kingdom) and can it be accessed from within a VO 2.8 
> 
> > application.
> 
> >
> 
> > I know i can calculate the distances if i go on the google maps webpage 
> 
> > and key it in manually (for mileage expenses) but because i have many 
> 
> > journeys to input it would save me a lot of time if i could automate this 
> 
> > from within the application.
> 
> >
> 
> > I don't know if such a request is possible but if any member could point 
> 
> > me in the right direction i would be very grateful.
> 
> >
> 
> > If it is possible then what other google map functions are available.
> 
> >
> 
> > Regards
> 
> >
> 
> > Paul
> 
> >
> 
> >



On Wednesday, 30 October 2013 23:54:43 UTC, Gerhard Bunzel  wrote:
> Paul,
> 
> 
> 
> here are two samples for google maps parameters:
> 
> 
> 
> ...to go from Berlin to Munich - "Oktoberfest":
> 
> 
> 
> https://maps.google.com/?hl=de&t=m&saddr=Alexanderplatz,+10178,+Berlin,+Deutschland&daddr=Bavariaring+10,+80336,+München,+Deutschland
> 
> 
> 
> 
> 
> ...and with a stop at Dresden - 'Semperoper' in english:
> 
> 
> 
> https://maps.google.com/?hl=en&t=m&saddr=Alexanderplatz,+10178,+Berlin,+Deutschland,+to:Theaterplatz+2,+01067,+Dresden,+Deutschland&daddr=Bavariaring+10,+80336,+München,+Deutschland
> 
> 
> 
> 
> 
> ?hl=en - Map in english
> 
> ?hl=de - Map in german
> 
> 
> 
> remove &t=m to see the route as satellite image
> 
> 
> 
> &saddr=  starting address
> 
> &daddr=  destination address
> 
> ,+to to add a stop
> 
> 
> 
> 
> 
> 
> 
> Here is a small class to generate a link - not tested to the end - but it's 
> 
> working:
> 
> 
> 
>   LOCAL cLink AS STRING
> 
> 
> 
>   oMap := WebMap{}
> 
>   oMap:AddStopSep(AllTrim(SELF:oDCbBrowser:Server:FIELDGET(#STRASSE)),
> 
> AllTrim(SELF:oDCbBrowser:Server:FIELDGET(#ORT)),,
> 
> AllTrim(SELF:oDCbBrowser:Server:FIELDGET(#PLZ)),
> 
> AllTrim(SELF:oDCbBrowser:Server:FIELDGET(#LAND)))
> 
>   oMap:GenLink()
> 
>   cLink := oMap:MapLink
> 
> 
> 
>   OpenObject(cLink, NULL_PTR)
> 
> 
> 
> 
> 
> 
> 
> CLASS WebMap
> 
>  PROTECT aAddress   AS ARRAY
> 
>  PROTECT nZoomLevel AS INT
> 
>  PROTECT cMapType   AS STRING    // 'MAP' = regular map, 'ROUTE' = route
> 
>  PROTECT cLink      AS STRING
> 
>  PROTECT cWhatsNear AS STRING
> 
> 
> 
>  DECLARE METHOD GenLink
> 
> 
> 
>  DECLARE ACCESS MapLink
> 
> 
> 
> METHOD Init ( xAddress, nZoomLevel ) CLASS WebMap
> 
> 
> 
>    IF nZoomLevel == NIL
> 
>       // default to 0 for auto calc size
> 
>       SELF:nZoomLevel := 0
> 
>    ELSE
> 
>       SELF:nZoomLevel := nZoomLevel
> 
>    ENDIF
> 
>    SELF:cLink      := NULL_STRING
> 
>    SELF:cWhatsNear := NULL_STRING
> 
> 
> 
>    /******
> 
>  aWhatsNear := { ;
> 
>        '', ;
> 
>        'Hotel', ;
> 
>        'Gas', ;
> 
>        'Food', ;
> 
>        'Parks', ;
> 
>        'Car Parts', ;
> 
>        'Truck Parts', ;
> 
>        'Railroads' ;
> 
>        }
> 
>    ******/
> 
> 
> 
>    // Initialize address array
> 
>    DO CASE
> 
>       CASE xAddress == NIL
> 
>          SELF:aAddress := {}
> 
>       CASE ValType( xAddress ) == 'A'
> 
>          SELF:aAddress := xAddress
> 
>       OTHERWISE
> 
>          SELF:aAddress := { xAddress }
> 
>    ENDCASE
> 
>    // if address passed on command line lets auto create link string
> 
>    IF ALen( SELF:aAddress ) > 0
> 
>       SELF:GenLink()
> 
>    ENDIF
> 
> 
> 
>  RETURN SELF
> 
> 
> 
> METHOD AddStop ( cAddress ) CLASS WebMap
> 
> 
> 
> //////////////////////////////////////////
> 
> ////// Method AddStop
> 
> //////////////////////////////////////////
> 
> // Purpose - To add a pre-formatted address
> 
> //            to SELF:aAddress
> 
> //
> 
> 
> 
>    IF cAddress != NIL
> 
>       // convert spaces to +
> 
>       AAdd( SELF:aAddress, StrTran( Trim( cAddress ),' ', '+' ) )
> 
>    ENDIF
> 
> 
> 
>  RETURN
> 
> 
> 
> METHOD AddStopSep ( cStreet, cCity, cState, cZip, cCountry ) CLASS WebMap
> 
>    LOCAL cAddr2 AS STRING
> 
> 
> 
> //////////////////////////////////////////
> 
> ////// 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()
> 
> //
> 
> 
> 
>    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 )
> 
>          SELF:AddStop( Trim( cStreet)+', '+cAddr2 )
> 
>       CASE Empty( cStreet ) .and. .not. Empty( cAddr2 )
> 
>          SELF:AddStop( cAddr2 )
> 
>       CASE .not. Empty( cStreet ) .and. Empty( cAddr2 )
> 
>          SELF:AddStop( Trim( cStreet) )
> 
>    ENDCASE
> 
> 
> 
>  RETURN
> 
> 
> 
> METHOD GenLink () AS STRING PASCAL CLASS WebMap
> 
>  LOCAL nFor      AS DWORD
> 
> 
> 
> //////////////////////////////////////////
> 
> ////// Method GenLink
> 
> //////////////////////////////////////////
> 
> // Purpose - To generate link string that
> 
> //           can be passed to Internet Explorer
> 
> //           Shell or link string can be emailed
> 
> 
> 
> 
> 
>    SELF:cLink := 'http://maps.google.com/maps?'
> 
>    DO CASE
> 
>       CASE ALen( SELF:aAddress ) == 0
> 
>          // this will just display country map
> 
>          SELF:cMapType := 'MAP'
> 
>       CASE ALen( SELF:aAddress ) > 1
> 
>          // must be route so update map type
> 
>          SELF:cMapType := 'ROUTE'
> 
>       OTHERWISE
> 
>          SELF:cMapType := 'MAP'
> 
>    ENDCASE
> 
>    FOR nFor := 1 UPTO ALen( SELF:aAddress )
> 
>       DO CASE
> 
>          CASE nFor == 1
> 
>             IF SELF:cMapType == 'ROUTE'
> 
>                SELF:cLink += 'saddr=' + SELF:aAddress[ nFor ]
> 
>             ELSE
> 
>                // In order to use info near address
> 
>                // Must be in map mode and not route mode
> 
>                IF Empty( SELF:cWhatsNear )
> 
>                   SELF:cLink += 'q=' + SELF:aAddress[ nFor ]
> 
>                ELSE
> 
>                   SELF:cLink += 'q=' + AllTrim(SELF:cWhatsNear)
> 
>                   SELF:cLink += _CHR(38) + 'near=' + SELF:aAddress[ nFor ]
> 
>                ENDIF
> 
>             ENDIF
> 
>          CASE nFor == 2
> 
>             SELF:cLink += _CHR(38) + 'daddr=' + SELF:aAddress[ nFor ]
> 
>          OTHERWISE
> 
>             SELF:cLink += ',+to:' + SELF:aAddress[ nFor ]
> 
>       ENDCASE
> 
>    NEXT
> 
>    IF .not. Empty( SELF:cLink )
> 
>       // Extra options.
> 
>       // I have commented out some of the ones that are not required
> 
>       // ::cLink += chr(38)+'hl=de'
> 
>       // ::cLink += chr(38)+'t=m'
> 
>       // ::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 SELF:nZoomLevel > 0
> 
>          SELF:cLink += _CHR(38)+'z=' + NTrim( SELF:nZoomLevel )
> 
>       ENDIF
> 
>       // ::cLink += chr(38)+'om=1'
> 
>    ENDIF
> 
> 
> 
>  RETURN SELF:cLink
> 
> 
> 
> ACCESS MapLink AS STRING PASCAL CLASS WebMap
> 
>  RETURN SELF:cLink
> 
> 
> 
> 
> 
> 
> 
> HTH
> 
> 
> 
> Gerhard Bunzel
> 
> 
> 
> 
> 
> 
> 
> "Whizzwilly" <whizzwilly@hotmail.co.uk> schrieb im Newsbeitrag 
> 
> news:99e97844-dbf7-4108-92bb-9c66248018c2@googlegroups.com...
> 
> > Hello
> 
> >
> 
> >
> 
> > Is there a google maps function to calculate driving distances between 2 
> 
> > places (United Kingdom) and can it be accessed from within a VO 2.8 
> 
> > application.
> 
> >
> 
> > I know i can calculate the distances if i go on the google maps webpage 
> 
> > and key it in manually (for mileage expenses) but because i have many 
> 
> > journeys to input it would save me a lot of time if i could automate this 
> 
> > from within the application.
> 
> >
> 
> > I don't know if such a request is possible but if any member could point 
> 
> > me in the right direction i would be very grateful.
> 
> >
> 
> > If it is possible then what other google map functions are available.
> 
> >
> 
> > Regards
> 
> >
> 
> > Paul
> 
> >
> 
> >



On Wednesday, 30 October 2013 23:54:43 UTC, Gerhard Bunzel  wrote:
> Paul,
> 
> 
> 
> here are two samples for google maps parameters:
> 
> 
> 
> ...to go from Berlin to Munich - "Oktoberfest":
> 
> 
> 
> https://maps.google.com/?hl=de&t=m&saddr=Alexanderplatz,+10178,+Berlin,+Deutschland&daddr=Bavariaring+10,+80336,+München,+Deutschland
> 
> 
> 
> 
> 
> ...and with a stop at Dresden - 'Semperoper' in english:
> 
> 
> 
> https://maps.google.com/?hl=en&t=m&saddr=Alexanderplatz,+10178,+Berlin,+Deutschland,+to:Theaterplatz+2,+01067,+Dresden,+Deutschland&daddr=Bavariaring+10,+80336,+München,+Deutschland
> 
> 
> 
> 
> 
> ?hl=en - Map in english
> 
> ?hl=de - Map in german
> 
> 
> 
> remove &t=m to see the route as satellite image
> 
> 
> 
> &saddr=  starting address
> 
> &daddr=  destination address
> 
> ,+to to add a stop
> 
> 
> 
> 
> 
> 
> 
> Here is a small class to generate a link - not tested to the end - but it's 
> 
> working:
> 
> 
> 
>   LOCAL cLink AS STRING
> 
> 
> 
>   oMap := WebMap{}
> 
>   oMap:AddStopSep(AllTrim(SELF:oDCbBrowser:Server:FIELDGET(#STRASSE)),
> 
> AllTrim(SELF:oDCbBrowser:Server:FIELDGET(#ORT)),,
> 
> AllTrim(SELF:oDCbBrowser:Server:FIELDGET(#PLZ)),
> 
> AllTrim(SELF:oDCbBrowser:Server:FIELDGET(#LAND)))
> 
>   oMap:GenLink()
> 
>   cLink := oMap:MapLink
> 
> 
> 
>   OpenObject(cLink, NULL_PTR)
> 
> 
> 
> 
> 
> 
> 
> CLASS WebMap
> 
>  PROTECT aAddress   AS ARRAY
> 
>  PROTECT nZoomLevel AS INT
> 
>  PROTECT cMapType   AS STRING    // 'MAP' = regular map, 'ROUTE' = route
> 
>  PROTECT cLink      AS STRING
> 
>  PROTECT cWhatsNear AS STRING
> 
> 
> 
>  DECLARE METHOD GenLink
> 
> 
> 
>  DECLARE ACCESS MapLink
> 
> 
> 
> METHOD Init ( xAddress, nZoomLevel ) CLASS WebMap
> 
> 
> 
>    IF nZoomLevel == NIL
> 
>       // default to 0 for auto calc size
> 
>       SELF:nZoomLevel := 0
> 
>    ELSE
> 
>       SELF:nZoomLevel := nZoomLevel
> 
>    ENDIF
> 
>    SELF:cLink      := NULL_STRING
> 
>    SELF:cWhatsNear := NULL_STRING
> 
> 
> 
>    /******
> 
>  aWhatsNear := { ;
> 
>        '', ;
> 
>        'Hotel', ;
> 
>        'Gas', ;
> 
>        'Food', ;
> 
>        'Parks', ;
> 
>        'Car Parts', ;
> 
>        'Truck Parts', ;
> 
>        'Railroads' ;
> 
>        }
> 
>    ******/
> 
> 
> 
>    // Initialize address array
> 
>    DO CASE
> 
>       CASE xAddress == NIL
> 
>          SELF:aAddress := {}
> 
>       CASE ValType( xAddress ) == 'A'
> 
>          SELF:aAddress := xAddress
> 
>       OTHERWISE
> 
>          SELF:aAddress := { xAddress }
> 
>    ENDCASE
> 
>    // if address passed on command line lets auto create link string
> 
>    IF ALen( SELF:aAddress ) > 0
> 
>       SELF:GenLink()
> 
>    ENDIF
> 
> 
> 
>  RETURN SELF
> 
> 
> 
> METHOD AddStop ( cAddress ) CLASS WebMap
> 
> 
> 
> //////////////////////////////////////////
> 
> ////// Method AddStop
> 
> //////////////////////////////////////////
> 
> // Purpose - To add a pre-formatted address
> 
> //            to SELF:aAddress
> 
> //
> 
> 
> 
>    IF cAddress != NIL
> 
>       // convert spaces to +
> 
>       AAdd( SELF:aAddress, StrTran( Trim( cAddress ),' ', '+' ) )
> 
>    ENDIF
> 
> 
> 
>  RETURN
> 
> 
> 
> METHOD AddStopSep ( cStreet, cCity, cState, cZip, cCountry ) CLASS WebMap
> 
>    LOCAL cAddr2 AS STRING
> 
> 
> 
> //////////////////////////////////////////
> 
> ////// 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()
> 
> //
> 
> 
> 
>    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 )
> 
>          SELF:AddStop( Trim( cStreet)+', '+cAddr2 )
> 
>       CASE Empty( cStreet ) .and. .not. Empty( cAddr2 )
> 
>          SELF:AddStop( cAddr2 )
> 
>       CASE .not. Empty( cStreet ) .and. Empty( cAddr2 )
> 
>          SELF:AddStop( Trim( cStreet) )
> 
>    ENDCASE
> 
> 
> 
>  RETURN
> 
> 
> 
> METHOD GenLink () AS STRING PASCAL CLASS WebMap
> 
>  LOCAL nFor      AS DWORD
> 
> 
> 
> //////////////////////////////////////////
> 
> ////// Method GenLink
> 
> //////////////////////////////////////////
> 
> // Purpose - To generate link string that
> 
> //           can be passed to Internet Explorer
> 
> //           Shell or link string can be emailed
> 
> 
> 
> 
> 
>    SELF:cLink := 'http://maps.google.com/maps?'
> 
>    DO CASE
> 
>       CASE ALen( SELF:aAddress ) == 0
> 
>          // this will just display country map
> 
>          SELF:cMapType := 'MAP'
> 
>       CASE ALen( SELF:aAddress ) > 1
> 
>          // must be route so update map type
> 
>          SELF:cMapType := 'ROUTE'
> 
>       OTHERWISE
> 
>          SELF:cMapType := 'MAP'
> 
>    ENDCASE
> 
>    FOR nFor := 1 UPTO ALen( SELF:aAddress )
> 
>       DO CASE
> 
>          CASE nFor == 1
> 
>             IF SELF:cMapType == 'ROUTE'
> 
>                SELF:cLink += 'saddr=' + SELF:aAddress[ nFor ]
> 
>             ELSE
> 
>                // In order to use info near address
> 
>                // Must be in map mode and not route mode
> 
>                IF Empty( SELF:cWhatsNear )
> 
>                   SELF:cLink += 'q=' + SELF:aAddress[ nFor ]
> 
>                ELSE
> 
>                   SELF:cLink += 'q=' + AllTrim(SELF:cWhatsNear)
> 
>                   SELF:cLink += _CHR(38) + 'near=' + SELF:aAddress[ nFor ]
> 
>                ENDIF
> 
>             ENDIF
> 
>          CASE nFor == 2
> 
>             SELF:cLink += _CHR(38) + 'daddr=' + SELF:aAddress[ nFor ]
> 
>          OTHERWISE
> 
>             SELF:cLink += ',+to:' + SELF:aAddress[ nFor ]
> 
>       ENDCASE
> 
>    NEXT
> 
>    IF .not. Empty( SELF:cLink )
> 
>       // Extra options.
> 
>       // I have commented out some of the ones that are not required
> 
>       // ::cLink += chr(38)+'hl=de'
> 
>       // ::cLink += chr(38)+'t=m'
> 
>       // ::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 SELF:nZoomLevel > 0
> 
>          SELF:cLink += _CHR(38)+'z=' + NTrim( SELF:nZoomLevel )
> 
>       ENDIF
> 
>       // ::cLink += chr(38)+'om=1'
> 
>    ENDIF
> 
> 
> 
>  RETURN SELF:cLink
> 
> 
> 
> ACCESS MapLink AS STRING PASCAL CLASS WebMap
> 
>  RETURN SELF:cLink
> 
> 
> 
> 
> 
> 
> 
> HTH
> 
> 
> 
> Gerhard Bunzel
> 
> 
> 
> 
> 
> 
> 
> "Whizzwilly" <whizzwilly@hotmail.co.uk> schrieb im Newsbeitrag 
> 
> news:99e97844-dbf7-4108-92bb-9c66248018c2@googlegroups.com...
> 
> > Hello
> 
> >
> 
> >
> 
> > Is there a google maps function to calculate driving distances between 2 
> 
> > places (United Kingdom) and can it be accessed from within a VO 2.8 
> 
> > application.
> 
> >
> 
> > I know i can calculate the distances if i go on the google maps webpage 
> 
> > and key it in manually (for mileage expenses) but because i have many 
> 
> > journeys to input it would save me a lot of time if i could automate this 
> 
> > from within the application.
> 
> >
> 
> > I don't know if such a request is possible but if any member could point 
> 
> > me in the right direction i would be very grateful.
> 
> >
> 
> > If it is possible then what other google map functions are available.
> 
> >
> 
> > Regards
> 
> >
> 
> > Paul
> 
> >
> 
> >

Hi Gerhard

Thanks for your reply and it contains some useful info however it does not cover what i am trying to achieve at the moment. I will explain a bit more.

I have a database for all my site addresses which includes postcodes and ordnance survey x & y coordinates ( each 6 digits commonly called eastings & northings). For example  Postcode = OL12 8HN , x = 389116  y = 420880

Every week i print a report from within my VO application showing which sites i have visited and i need to show the driving distance mileage from my home to each site on this report. At the moment i just calculate the distance as the crow flies using the x & y coordinates and pythagoras theorem but the actual driving distance mileage is considerably higher. Therefore what i need is the ability to access a google maps function (or any other function available on the internet) which can take either the start & destination postcodes or the x & y coordinates as parameters and return the driving distance as a value and then i can store this value for later access.

I hope this explains my situation and I hope you or any other member can be of further help.

Kind regards

Paul 

[toc] | [prev] | [next] | [standalone]


#6182

From"Wolfgang Riedmann" <wriedmann@gmail.com>
Date2013-10-31 13:45 +0100
Message-ID<bdf1noFh4rvU1@mid.individual.net>
In reply to#6173
Hi Paul,

> Is there a google maps function to calculate driving distances
> between 2 places (United Kingdom) and can it be accessed from within
> a VO 2.8 application.
> 
> I know i can calculate the distances if i go on the google maps
> webpage and key it in manually (for mileage expenses) but because i
> have many journeys to input it would save me a lot of time if i could
> automate this from within the application.

this is very easy, but limited if you don't like to pay for it. Please
read Google's terms about a commercial use of the map functions.

You can send a http request to Google's servers and they will return an
XML file with the requested information:

This is the code I'm using:

cHostName := "maps.google.it"
cURL := ParmSubst(
"maps/api/directions/xml?origin=%1&destination=%2&sensor=false",
self:_FixAdresse( _cStartAdresse ), self:_FixAdresse( _cZielAdresse ) )

oHttp := clsHttpComm{ cHostName }
oHttp:ServerName	:= cHostName
while ( _nLastCall + 0.30 ) >= Seconds()
	Sleep( 300 )
	debOut( "Sleeping 300 milli-seconds" ) 
end
		        
_cXMLResult			:= oHttp:GetResult( cURL ) 
if oHttp:Error
	return false
endif


You need to pass in the adress in the format Google Maps likes - try on
their Maps page.

HTH

Wolfgang



-- 

[toc] | [prev] | [next] | [standalone]


#6190

FromWhizzwilly <whizzwilly@hotmail.co.uk>
Date2013-11-01 10:19 -0700
Message-ID<c2610e08-87d3-46a3-bc03-60a62252c06f@googlegroups.com>
In reply to#6182
Hi Wolfgang

Thanks for your reply.

This is exactly the way i would like to do it but i don't have any experience of internet access programming from within VO at all. 

I presume i need to include the VO Internet library but which classes & methods do i use eg. CHttp  

> 
> oHttp := clsHttpComm{ cHostName }

What is clsHttpComm function. I have looked in the help files at CHttp classes and this is not listed. 

> 
> oHttp:ServerName	:= cHostName
> 

> _cXMLResult		:= oHttp:GetResult( cURL ) 
> 

What VO classes & methods is your GetResult method using?

I really don't have a clue so any more help would be greatly appreciated.

Kind regards

Paul

[toc] | [prev] | [next] | [standalone]


#6192

From"Wolfgang Riedmann" <wriedmann@gmail.com>
Date2013-11-01 21:11 +0100
Message-ID<bdig6rF97ofU1@mid.individual.net>
In reply to#6190
Hi Paul,

> This is exactly the way i would like to do it but i don't have any
> experience of internet access programming from within VO at all.
> 
> What is clsHttpComm function. I have looked in the help files at
> CHttp classes and this is not listed.

unfortunately cHttpComm is a heavily enhanced subclass of the cHttp
class.

> What VO classes & methods is your GetResult method using?

the GetResult method encapsulates a ConnectRemote call, a
GetDocumentFromServer and a CloseRemote call (with all the obvious
error checkings).

The cHttp class is very easy to use - play a little bit with it and you
will have a success very early.

Wolfgang


-- 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web