Hi,
I'am tring the GOEARTH.PRG and GMAPD.PRG in sample dir, but i got the same problem: Error in script page....
And didn't get any MAP !
Any help ?
FWH 16.02
HARBOUR 3.2.0dev
Tks
<!DOCTYPE html>
<html>
<head>
<!-- This stylesheet contains specific styles for displaying the map
on this page. Replace it with your own styles as described in the
documentation:
https://developers.google.com/maps/documentation/javascript/tutorial -->
<link rel="stylesheet" href="/maps/documentation/javascript/demos/demos.css">
</head>
<body>
<div id="map"></div>
<script>
function initMap() {
// Create a map object and specify the DOM element for display.
var map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -34.397, lng: 150.644},
scrollwheel: false,
zoom: 8
});
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap"
async defer></script>
</body>
</html>
#Include "FiveWin.ch"
//-----------------------------
Function Main()
TestGoogleMap("Eiffel Tower","Champ de Mars", "5 Avenue Anatole France", "75007 Paris", "France")
Return NIL
//-----------------------------------------------------------------------/
Function TestGoogleMap(cName,cAddress,cCity,cState,cCountry)
Local oHttp, cURL, lNetError, cBuffer, cLatLongDtls, cLatitude, cLongitude
Local cMapFile, cHtmlContent, oOle
cName:=STRTRAN(ALLTRIM(cName)," ","+")
cName:=STRTRAN(ALLTRIM(cName),"&"," E ")
cAddress:=STRTRAN(ALLTRIM(cAddress),",","")
cAddress:=STRTRAN(ALLTRIM(cAddress)," ","+")
cCity:=STRTRAN(ALLTRIM(cCity)," ","+")
cCountry:=STRTRAN(ALLTRIM(cCountry)," ","+")
IF IsInternet()
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
cBuffer := oHttp:ResponseBody
ELSE
MsgInfo("Search Error. Could not find the details","Google Maps")
Return
ENDIF
cLatLongDtls:=AT("location",cBuffer)
IF cLatLongDtls == ""
MsgInfo("Search Error. Could not find the details","Google Maps")
ELSE
cBuffer:=RIGHT( cBuffer,LEN(cBuffer)-cLatLongDtls )
cLatitude:=SUBSTR(cBuffer,AT("lat",cBuffer)+6,14);cLatitude:=ALLTRIM( LEFT(cLatitude,AT(",",cLatitude)-1) )
cLongitude:=ALLTRIM(SUBSTR(cBuffer,AT("lng",cBuffer)+6,14))
cMapFile := "C:\GMaps.htm"
/* Method 1 */
cHtmlContent:= ;
'<!DOCTYPE html>' + ;
'<html>' + ;
' <head>' + ;
' <style>' + ;
' #map {' + ;
' height: 400px;' + ;
' width: 100%;' + ;
' }' + ;
' </style>' + ;
' </head>' + ;
' <body>' + ;
' <h3>My Google Maps Demo</h3>' + ;
' <div id="map"></div>' + ;
' <script>' + ;
' function initMap() {' + ;
' var uluru = {lat: '+cLatitude+', lng: '+cLongitude+'};' + ;
' var map = new google.maps.Map(document.getElementById("map"), {' + ;
' zoom: 14,' + ;
' center: uluru' + ;
' });' + ;
' var marker = new google.maps.Marker({' + ;
' position: uluru,' + ;
' map: map' + ;
' });' + ;
' }' + ;
' </script>' + ;
' <script async defer' + ;
' src="https://maps.googleapis.com/maps/api/js?key=&callback=initMap">' + ;
' </script>' + ;
' </body>' + ;
'</html> '
/* Method 2. This is another option. If you plan to use then comment the Previous HTML Content
cHtmlContent:='<iframe width="625" height="450" frameborder="0" scrolling="no" marginheight="0"'+;
' marginwidth="0" src="http://maps.google.com/?ie=UTF8&hq=&'+;
'hnear='+;
'&ll='+cLatitude+','+cLongitude+'&spn='+cLatitude+','+cLongitude+'&z=17&output=embed">'
*/
MEMOWRIT( cMapFile, cHtmlContent )
oOle:=CreateObject("InternetExplorer.Application")
oOle:width:=675
oOle:height:=520
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()
ENDIF
ENDIF
Return
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 82 guests