FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Plotting locations on Google Maps
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Plotting locations on Google Maps
Posted: Fri Mar 10, 2017 04:22 AM
TimStone wrote:The translation time for the geocode is quite long when creating a map. So I decided to get the codes and store them in the database for each address.

Obviously this will take time because google has to search its database based on the address provided by you and then return the most accurate result from a bunch of data. If your list is too long then it increases the time further. For this reason, I keep the Lat and Lng in the database. May be you can run this routine once in a while to update the Lat and Lng in your Customer address DBF/Table. For large list of address there are services from Google named Google App Scripts.

My initial example in this thread was to display a Google Map based on the available Lat and Lng. I created the sample to get the Lat and Lng based on the address when you said that your requirement was to display a Googe Map based on the Address details that you have in your database. It is just a sample to demonstrate that this is possible using FiveWin. Its my mistake that, I have not gone deep into catching the run time errors if there are no results from Google.

TimStone wrote:Thoughts on trapping hjson values that do not have an array would be appreciated.

You should add the lat long to the array only if hJson["status"] == "OK"
OR you can put a try catch

Anyway here is one of the methods to consider to gracefully control the run time error which may occur if the searched address is not found by Google.
Code (fw): Select all Collapse
#Include "FiveWin.ch"

//-----------------------------
Function Main()
聽 聽 Local aLatLng:={} 
聽 聽 Local aAddress:={ {"Anser","K K" 聽 聽 聽 聽 聽 聽, "just dummy so that it 聽", "will not give" 聽 聽 聽 ,"any results" },;
聽 聽 聽 聽 聽 聽聽 聽 聽 聽 聽 聽{"Eiffel Tower","Champ de Mars" 聽 聽 聽 聽 聽 聽, "5 Avenue Anatole France", "75007 Paris" 聽 聽 聽 聽 ,"France" },;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 {"Taj Mahal" 聽 ,"Dharmapuri, Forest Colony", "Tajganj, Agra" 聽 聽 聽 聽 聽, "Uttar Pradesh 282001","India" 聽 } }

聽 聽 // This function will grab the Lat and Lng information from Google and returns an array
聽 聽 aLatLng:=GetLatLng(aAddress)

聽 聽 // Displays Markers on a Google Map
聽 聽 ViewGoogleMap(aLatLng)
Return NIL

//------------------------------------------//
Function GetLatLng(aData)
聽 Local i,cName,cAddress,cCity,cState,cCountry,aLatLng:={},nLatitude,nLongitude
聽 Local oHttp, cURL, lNetError, cResponse,hJson
聽 
聽 For i:=1 to Len(aData)
聽 
聽 聽 cName:=STRTRAN(ALLTRIM(aData[i][1])," ","+")
聽 聽 cName:=STRTRAN(ALLTRIM(aData[i][1]),"&"," E ")
聽 聽 cAddress:=STRTRAN(ALLTRIM(aData[i][2]),",","")
聽 聽 cAddress:=STRTRAN(ALLTRIM(aData[i][2])," ","+")
聽 聽 cCity:=STRTRAN(ALLTRIM(aData[i][3])," ","+")
聽 聽 cCountry:=STRTRAN(ALLTRIM(aData[i][5])," ","+") 聽
聽 聽 cState:=aData[i][4]
聽 聽 
聽 聽 oHttp:=CreateObject("Microsoft.XMLHTTP")
聽 聽 cURL:="http://maps.google.com/maps/api/geocode/json?address="+cAddress+"+"+cCity+"+-+"+cState+"+"+cCountry+"&sensor=false"
聽 聽 oHttp:Open("GET",cURL,.F.)
聽 聽 lNetError:=.F.
聽 聽 TRY
聽 聽 聽 聽 oHttp:Send()
聽 聽 CATCH oError
聽 聽 聽 聽 lNetError:=.T.
聽 聽 END TRY
聽 聽 
聽 聽 IF !lNetError
聽 聽 聽 cResponse := oHttp:ResponseBody
聽 聽 ELSE
聽 聽 聽 // Search Error. Could not find the details on Google Maps.
聽 聽 聽 Loop
聽 聽 ENDIF 聽 聽

聽 聽 hb_jsonDecode(cResponse,@hJson)
聽 聽 IF hJson["status"] == "OK"
聽 聽 聽 聽 nLatitude:= hJson["results"][1]["geometry"]["location"]["lat"]
聽 聽 聽 聽 nLongitude:=hJson["results"][1]["geometry"]["location"]["lng"] 聽 聽
聽 聽 聽 聽 Aadd(aLatLng,{aData[i][1],nLatitude, nLongitude} )
聽 聽 ENDIF
聽 聽 
聽 Next
聽 
Return aLatLng

//-----------------------------------------------------------------------/
Function ViewGoogleMap(aData)
聽 聽Local cMapFile:="D:\GMaps.htm", cHtmlContent1,cHtmlContent2, oOle, i
聽 聽Local cAppendStr:="var locations = ["+CRLF
聽 聽
聽 聽If Len(aData) == 0
聽 聽 聽 MsgInfo("Location data not available in the list")
聽 聽 聽 Return
聽 聽Endif
聽 聽
聽 聽For i:=1 to Len(aData)
聽 聽 聽 聽cAppendStr+=Space(4)+"['" +aData[i][1] +"',"+Ltrim(Str(aData[i][2]))+","+ Ltrim(Str(aData[i][3]))+ If( i < Len(aData), "],", "]") +CRLF
聽 聽Next
聽 聽cAppendStr+="];"+CRLF

TEXT INTO cHtmlContent1
聽 聽 
聽 聽 <html>
聽 聽 <head>
聽 聽 聽 
聽 聽 聽 <title>Google Maps Multiple Markers</title>
聽 聽 聽 <script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
聽 聽 </head>
聽 聽 <body>
聽 聽 聽 <div id="map" style="height: 100%; width: 100%;">
聽 聽 </div>
聽 聽 <script type="text/javascript">
聽 聽 
ENDTEXT
聽 聽 
聽 聽 
TEXT INTO cHtmlContent2 聽 聽
聽 聽 聽 聽 
聽 聽 聽 聽 var map = new google.maps.Map(document.getElementById('map'), {
聽 聽 聽 聽 聽 zoom: 0, 聽 聽 聽 聽 聽 
聽 聽 聽 聽 聽 mapTypeId: google.maps.MapTypeId.ROADMAP
聽 聽 聽 聽 });
聽 聽 聽 聽 var bounds = new google.maps.LatLngBounds();
聽 聽 聽 聽 var infowindow = new google.maps.InfoWindow();
聽 聽 
聽 聽 聽 聽 var marker, i;
聽 聽 
聽 聽 聽 聽 for (i = 0; i < locations.length; i++) { 
聽 聽 聽 聽 聽var position = new google.maps.LatLng(locations[i][1], locations[i][2]);
聽 聽 聽 聽 聽 聽 bounds.extend(position);
聽 聽 聽 聽 聽 marker = new google.maps.Marker({
聽 聽 聽 聽 聽 聽 position: new google.maps.LatLng(locations[i][1], locations[i][2]), 聽 聽 聽 聽
聽 聽 聽 聽 聽 聽 map: map
聽 聽 聽 聽 聽 });
聽 聽 
聽 聽 聽 聽 聽 google.maps.event.addListener(marker, 'click', (function(marker, i) {
聽 聽 聽 聽 聽 聽 return function() {
聽 聽 聽 聽 聽 聽 聽 infowindow.setContent(locations[i][0]);
聽 聽 聽 聽 聽 聽 聽 infowindow.open(map, marker);
聽 聽 聽 聽 聽 聽 }
聽 聽 聽 聽 聽 })(marker, i));

聽 聽 聽 聽 聽 // Automatically center the map fitting all markers on the screen
聽 聽 聽 聽 聽 map.fitBounds(bounds);
聽 聽 聽 聽 聽
聽 聽 聽 聽 }
聽 聽 聽 </script>
聽 聽 </body>
聽 聽 </html>
聽 聽 
ENDTEXT

聽 聽 聽MEMOWRIT( cMapFile, cHtmlContent1+cAppendStr+cHtmlContent2 )

聽 聽 聽Shellexecute( NIL, "open", cMapFile ) 聽 聽 
聽 聽
Return
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Plotting locations on Google Maps
Posted: Fri Mar 10, 2017 05:14 AM
May be you can run this routine once in a while to update the Lat and Lng in your Customer address DBF/Table.

It is a good idea to find latlong and save it in database when adding a contact or modifying the address of a contact.
Regards



G. N. Rao.

Hyderabad, India
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Plotting locations on Google Maps
Posted: Fri Mar 10, 2017 05:44 AM
nageswaragunupudi wrote:
May be you can run this routine once in a while to update the Lat and Lng in your Customer address DBF/Table.

It is a good idea to find latlong and save it in database when adding a contact or modifying the address of a contact.
.
Yes. you are right. That's the right way to do.
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: Plotting locations on Google Maps
Posted: Fri Mar 10, 2017 05:41 PM

As I noted previously, I have been doing exactly what was suggested ... and that is to get the coordinates and save them to the database. I did find a way yesterday to trap no data found responses, but apparently there are other types of responses also so I will be working more on this today.

What I am trying to do is build a map that shows where clients come from over a period of time. Hidden deeply inside the Google documents, however, I found that you the API apparently only allows for 15 markers. That is strange because I see applications frequently that show far more than 15 points. I suppose I will have to work on that issue.

The reason for the maps is that they are often used in marketing programs to show areas that yield the best results from communications by businesses.

Thanks for the ideas ... they are being incorporated ... and my goal will to ultimately build a class that allows us greater use of Google Maps from within FWH.

Tim

Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Plotting locations on Google Maps
Posted: Fri Mar 10, 2017 06:28 PM
The most important thing is that: I consider that the Anserkk example is the best way to do this work
But, I have another way of getting this data (latitude and longitude)
Then you can apply the function to draw the map

Code (fw): Select all Collapse
#include "FiveWin.ch"

Static cUrl     := ""

Function Main()

   SET 3DLOOK OFF
   VerMapa2( "", "Calle Gran Via", "17", "Madrid", "Madrid", "Spain" )
   VerMapa2( "75007", "Avenue Anatole France", "5", "", "Paris", "France" )

   
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

//----------------------------------------------------------------------------//
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: Plotting locations on Google Maps
Posted: Wed Mar 15, 2017 05:08 PM

A few observations:

1) I built a utility to do just the geocode, and save the result to the database. GOOGLE LIMITS ACTIVITY - a) You need a key ( free ), and b) you still have a limit of the number of searches you can do in a 24 hour period. Google says the key lets you do 25,000, but I find it only allows 2500. I have to run the routine over several days before I can get results for the whole database.

2) It is very common to add to an address. For example, 241 South St. Apt 6 Anytown, NY is submitted as 241+South+St.+Apt+6+Anytown,+NY and because of the apartment and number, this will not decode. Make sure you use only the street number and name.

3) I wanted to plot many locations on the map to show where customers live. I see this done a lot, but Google Maps has a limit of 15 points we can plot at one time. They do have an alternative for clustering locations which shows one pin in an area.

Mapping is very popular now, and Google seems to be the main resource people use.

Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Plotting locations on Google Maps
Posted: Wed Mar 15, 2017 09:16 PM
My son, has recommended this lib

http://leafletjs.com/index.html

This is a sample
If you have the length and latitude, you do not need to run the function VerMapa2()

Code (fw): Select all Collapse
#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

聽 聽TEXT INTO cHtmlContent1
聽 聽
聽 聽<!DOCTYPE html>
聽 聽<html>
聽 聽<head>
聽 聽 聽 聽<title>Quick Start - Leaflet</title>

聽 聽 聽 聽<meta charset="utf-8" />
聽 聽 聽 聽<meta name="viewport" content="width=device-width, initial-scale=1.0">
聽 聽 
聽 聽 聽 聽<link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" />

聽 聽 聽 聽<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" />
聽 聽 聽 聽<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
聽 聽</head>
聽 聽<body>
聽 聽 聽 <div id="mapid" style="width: 700px; height: 560px;"></div>
聽 聽 聽 <script>
聽 聽ENDTEXT

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

聽 聽TEXT INTO cHtmlContent2
聽 聽 L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=[REDACTED:MAPBOX_PUBLIC]', {
聽 聽 聽 聽 maxZoom: 18,
聽 聽 聽 聽 attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
聽 聽 聽 聽 聽 聽 '<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
聽 聽 聽 聽 聽 聽 'Imagery 漏 <a href="http://mapbox.com">Mapbox</a>',
聽 聽 聽 聽 id: 'mapbox.streets'
聽 聽 }).addTo(mymap);

聽 聽ENDTEXT

聽 聽For i := 1 to Len( aData )
聽 聽 聽 cAppendStr += Space( 4 ) + "[ " + aData[ i ][ 3 ] + ", " + ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 Ltrim( aData[ i ][ 2 ] )
聽 聽 聽 if i < Len( aData )
聽 聽 聽 聽 聽cAppendStr += "]," + CRLF
聽 聽 聽 else
聽 聽 聽 聽 聽cAppendStr += "]" + CRLF 聽 聽 聽
聽 聽 聽 endif
聽 聽Next
聽 聽cAppendStr += "]).addTo(mymap).bindPopup('I am a polygon.');" + CRLF + CRLF

聽 聽For i := 1 to Len( aData )
聽 聽 聽 cAppendStr += "L.marker( "
聽 聽 聽 cAppendStr += "[ " + aData[ i ][ 3 ] + ", " + ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 Ltrim( aData[ i ][ 2 ] ) + " ] )."
聽 聽 聽 cAppendStr += "addTo(mymap).bindPopup('<b>Marker" + Str( i ) + " !</b><br />I am a popup.').openPopup();" + CRLF + CRLF
聽 聽Next
聽 聽
聽 聽TEXT INTO cHtmlContent3
聽 聽 var popup = L.popup();

聽 聽 function onMapClick(e) {
聽 聽 聽 聽 popup
聽 聽 聽 聽 聽 聽 .setLatLng(e.latlng)
聽 聽 聽 聽 聽 聽 .setContent("Position is: " + e.latlng.toString())
聽 聽 聽 聽 聽 聽 .openOn(mymap);
聽 聽 }

聽 聽mymap.on('click', onMapClick);

聽 聽</script>

聽 聽</body>
聽 聽</html>

聽 聽ENDTEXT

聽 聽MEMOWRIT( cMapFile, cHtmlContent1 + cInitMap + cHtmlContent2 + cAppendStr + cHtmlContent3 )

聽 聽oOle := CreateObject( "InternetExplorer.Application" )
聽 聽oOle:Width 聽 聽 := 750
聽 聽oOle:Height 聽 聽:= 650
聽 聽oOle:Visible 聽 := .T. 聽 聽 // Displays the Browser
聽 聽oOle:ToolBar 聽 := .F. 聽 聽 // Disables the toolbar
聽 聽oOle:StatusBar := .F. 聽 聽 // Disables status bar
聽 聽oOle:MenuBar 聽 := .F. 聽 聽 // Disables the menu bar
聽 聽oOle:Navigate( cMapFile ) // Open the Webpage
聽 聽SysRefresh()
聽 聽
Return nil

//----------------------------------------------------------------------------//
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: Plotting locations on Google Maps
Posted: Wed Mar 15, 2017 09:28 PM

Thank you. I will explore that resource.

Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Plotting locations on Google Maps
Posted: Thu Mar 16, 2017 12:22 PM

Guys,

Do you know if is possible show a text beside the mark for all locations plotted? Something Like tooltips.

I know if I click in the mark, the text is shown, but i would like to show the text without be necessary to click in the mark. Is it possible?

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Bel茅m-Pa-Brazil
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Plotting locations on Google Maps
Posted: Thu Mar 16, 2017 01:35 PM

Look, Is that something you need?

http://leafletjs.com/examples/choropleth/

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Plotting locations on Google Maps
Posted: Thu Mar 16, 2017 02:39 PM
Cnavarro,

No, is something like this:


But for to be shown for all points, without be necessary to do a click over them.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Bel茅m-Pa-Brazil
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Plotting locations on Google Maps
Posted: Thu Mar 16, 2017 03:14 PM
Yes, but I think you can not define popup and tooltip to the same marker



In my previous sample, replace

Code (fw): Select all Collapse
   For i := 1 to Len( aData )
      cAppendStr += "L.marker( "
      cAppendStr += "[ " + aData[ i ][ 3 ] + ", " + ;
                    Ltrim( aData[ i ][ 2 ] ) + " ] )."
      cAppendStr += "addTo(mymap).bindPopup('<b>Marker" + Str( i ) + " !</b><br />I am a popup.').openPopup();" + CRLF + CRLF
   Next


with

Code (fw): Select all Collapse
   For i := 1 to Len( aData )
      cAppendStr += "L.marker( "
      cAppendStr += "[ " + aData[ i ][ 3 ] + ", " + ;
                    Ltrim( aData[ i ][ 2 ] ) + " ] ).addTo(mymap).bindTooltip('my tooltip text').openTooltip();" + CRLF + CRLF
   Next
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Plotting locations on Google Maps
Posted: Thu Mar 16, 2017 03:55 PM
Change images for markers



Code (fw): Select all Collapse
   For i := 1 to Len( aData )
      cAppendStr += "L.marker( "
      cAppendStr += "[ " + aData[ i ][ 3 ] + ", " + ;
                    Ltrim( aData[ i ][ 2 ] ) + " ], {icon: greenIcon} )."
      cAppendStr += "addTo(mymap).bindPopup('<b>Marker" + Str( i ) + " !</b><br />I am a popup.').openPopup();" + CRLF + CRLF
   Next
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Plotting locations on Google Maps
Posted: Fri Mar 17, 2017 11:27 AM

Cnavarro,

You are creating the markers trough its address, isn't it ?
What i need to change for to do this trough lat/lng?

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Bel茅m-Pa-Brazil
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Plotting locations on Google Maps
Posted: Fri Mar 17, 2017 01:41 PM

Sorry, I do not understand your question and your needs

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces