• Willkommen im Geoclub - dem größten deutschsprachigen Geocaching-Forum. Registriere dich kostenlos, um alle Inhalte zu sehen und neue Beiträge zu erstellen.

Online / Offline Google Maps im HTML Export

chr2k

Geomaster
Ar@gon schrieb:
Habe mitlerweile das gesamte Makro an meine Wünsche angepasst.
Jetzt läuft es auch in meiner Umgebung.

Danke Trotzdem

was musstest du beim relativen pfad eingeben? ich komm da auch nicht so ganz klar.

danke
 

Ar@gon

Geocacher
Die Pfade, die bei einer Standardinstallation einzugeben sind sind ja schon im Thread beschrieben worden.
Mein Probleme war, dass die verschiedenen Verzeichnise bei mir auf unterschiedlichen Partitionen verteilt liegen. Habe alles ausprobiert und letztlich dann direkt im Makro geändert. D.h. ich habe ein Comando zum wechseln der Partion eingefügt.

Im Marco findes Du eine Zeile
SET $Data = AppendFile("$googlemapdir"+"\googlemap.bat","cd " + "$googlemapdir" + $_NewLine)
Für meine Umgebung habe ich folgende Zeile davor eingefügt
SET $Data = AppendFile("$googlemapdir"+"\googlemap.bat","e:" + $_NewLine)

Jetzt wechselt das Macro erst auf Platte e:. bevor es in das entsprechende Verzeichnis wechselt.
 

chr2k

Geomaster
Ar@gon schrieb:
Die Pfade, die bei einer Standardinstallation einzugeben sind sind ja schon im Thread beschrieben worden.
Ar@gon schrieb:
Mein Probleme war, dass die verschiedenen Verzeichnise bei mir auf unterschiedlichen Partitionen verteilt liegen.

Bei mir ist es so das gsak mit macros auf C liegt. wget.exe und die restlichen dateiein liegen in verschiedenen unterverzeichnissen in D:\mobile_dateien\

Ist das bei dann auch so? Falls ich dein posting richtig verstehe...

Danke
Christian
 

chr2k

Geomaster
Es hat sich dann recht spät, um 1 Uhr erledigt. :)

Man muss das Macro noch an anderer Stelle bearbeiten, damit die Batch-Datei richtig erstellt wird.

Gruß Christian
 

chr2k

Geomaster
JamesDoe schrieb:
So die erste Version des Scriptes ist nun fertig. Download unter:

http://www.geocacher.info/geogc/OfflineGoogleMap2.txt

Leider funktioniert der Download nicht mehr.

Hat jemand noch die original Verison? Oder iene funktionierende? Ich hab leider kein Backup der original Verison und irgendwie haut mir das Macro oder irgendein GSAK Option ein "D:" vor die relative pda pfadangabe (weiß dazu jemadn evlt was?).

Danke

Gruß Christian
 

Joggl

Geomaster
chr2k schrieb:
Leider funktioniert der Download nicht mehr.

Hat jemand noch die original Verison? Oder iene funktionierende? Ich hab leider kein Backup der original Verison und irgendwie haut mir das Macro oder irgendein GSAK Option ein "D:" vor die relative pda pfadangabe (weiß dazu jemadn evlt was?).

Danke

Gruß Christian

###############################################
#
# Based on a script from mtrax
# with modifications from Bert Geenen
# and happyworld-gc.de.vu
#
# and by me (James Doe)
#
# Version 1.0.2 - 16.03.2007
#
#----------------------------------------------
#
# The script is now able to get the google-maps
# offline, so they can be integratet in your
# html-file for the pda without going online
# while being hunting for a cache.
#
# After a nights sleep i have decided that both
# ways are useful, so i removed the
# modifications done by happyworld, and used
# them for a new function inside the original
# script.
#
###############################################

$datafile=$_Install + "\Macros\offlinegooglemap2.dat"
$dataconfigmap=$_Install + "\Macros\offlinegooglemap2config.dat"

###############################################
#
# debug STATUS=on
#
###############################################
# get folder from saved settings if file exists
IF (FileExists($datafile))

# Yes? Read config values and assign to variables
FILEREAD File=$datafile
$googlemapdir=EXTRACT($line, ";", 1)
$htmlmapdir=EXTRACT($line, ";", 2)
$wget=EXTRACT($line, ";", 3)
ENDREAD

ELSE
if ShowForm($ConfigIt)

if $ciCancel
#cancelled with Cancel button
Cancel
endif
if $ciGo
GOSUB Name="WriteConfig"
endif
else
#cancelled with [X] button
Cancel
endif

<data> varname=$ConfigIt
Name=ConfigForm
Type=Form
caption=Config the script

Name=Label
Type=Label
Left=100
Top=5
Caption=Config the Google Map Script
style=bold
size=12

Name=Label1
Type=Label
Left=120
Top=40
style=bold
Caption=Choose the folder where the maps should be stored

Name=GMLabel
Type=Label
Left=5
Top=60
Caption=Maps

Name=googlemapdir
Type=Folder
Left= 120
width = 200
Top=60

Name=Label2
Type=Label
Left=120
Top=95
style=bold
Caption=The path which should appear in the user-note

Name=HMDLabel
Type=Label
Left=5
Top=115
Caption=Relative Path

Name=htmlmapdir
Type=Edit
Left= 120
width = 200
Top=115

Name=Label3
Type=Label
Left=120
Top=150
style=bold
Caption=Where the programm wget is located

Name=Label3a
Type=Label
Left=120
Top=165
style=bold
Caption=get it at -> http://users.ugent.be/~bpuype/wget/

Name=WGetLabel
Type=Label
Left=5
Top=185
Caption=WGet

Name=wget
Type=Folder
Left= 120
width = 200
Top=185

Name = ciGo
type = Button
left = 15
top = 215
height = 25
width = 79
caption = OK

Name = ciCancel
type = Button
left = 140
top = 215
height = 25
width = 75
caption = Cancel
<EndData>
EndIf

###############################################
#
# Check if the map config exists, else writing
# it with default entrys
#
###############################################

IF (FileExists($dataconfigmap))

# Yes? Read config values and assign to variables
FILEREAD File=$dataconfigmap
$hoehe=EXTRACT($line, ";", 1)
$breite=EXTRACT($line, ";", 2)
$zoom=EXTRACT($line, ";", 3)
$wait=EXTRACT($line, ";", 4)
ENDREAD
ELSE
$hoehe = "400"
$breite = "400"
$zoom = "2000"
$wait = "3"
$UChoice=$hoehe + ";" + $breite + ";" + $zoom + ";" + $wait + ";"
$SavedFile=PUTFILE($dataconfigmap, $UChoice)
IF Left($SavedFile, 7) = "*Error*"
CANCEL Msg="Unable to write to $dataconfigmap!"
ENDIF
ENDIF

###############################################
#
# Writing the global config-file
#
###############################################

BEGINSUB Name="WriteConfig"
$UChoice=$googlemapdir + ";" + $htmlmapdir + ";" + $wget + ";"
$SavedFile=PUTFILE($datafile, $UChoice)
IF Left($SavedFile, 7) = "*Error*"
CANCEL Msg="Unable to write to $datafile!"
ENDIF
ENDSUB

###############################################
#
# Shows the user-interface to choose the
# action the script should preform
#
# Original by Bert Geenen
# I just add a new action.
#
###############################################

GOSUB Name="ChooseAction"

BEGINSUB Name="ChooseAction"
$rbInsert = False
$rbOffline = False
$rbRemove = False
$rbConfig = False
if ShowForm($ChooseAction)

if $btCancel
#cancelled with Cancel button
endif

if $btGo

#Sort to anything but the UserNote field, to avoid early exit while
#processing records. First, save current sort field.
$CurrentSort = $_SortBy
SORT By="Name"

if $rbInsert
GOSUB Name="CreateNotes"
endif
if $rbOffline
GOSUB Name="CreateOfflineNotes"
endif
if $rbRemove
GOSUB Name="ClearNotes"
endif
if $rbConfig
GOSUB Name="ConfigMap"
endif

#Restore old sort sequence
$SortData = Extract($CurrentSort, "=", 1)
$Sequence = Extract($CurrentSort, "=", 2)
SORT By=$SortData Sequence=$Sequence

endif

else

#cancelled with [X] button

endif

<Data> Varname=$ChooseAction
Name = Form1
type = form
left = 287
top = 351
height = 244
width = 236
caption=Google Maps in Notes

Name = lbChoose
type = Label
left = 15
top = 13
height = 13
width = 111
Caption = Please choose action...

Name = frmGroup
type = GroupBox
left = 14
top = 33
height = 120
width = 203

Name = rbInsert
type = RadioButton
left = 10
top = 15
height = 17
width = 15
container = frmGroup

Name = lbInsert
type = Label
left = 30
top = 18
height = 13
width = 134
container = frmGroup
caption = Insert Google Maps in Notes

Name = rbOffline
type = RadioButton
left = 10
top = 40
height = 17
width = 15
container = frmGroup

Name = lbOffline
type = Label
left = 30
top = 43
height = 13
width = 134
container = frmGroup
caption = Insert Offline Google Maps in Notes

Name = rbRemove
type = RadioButton
left = 10
top = 65
height = 17
width = 15
container = frmGroup

Name = lbRemove
type = Label
left = 30
top = 68
height = 13
width = 160
container = frmGroup
caption = Remove Google Maps from Notes

Name = rbConfig
type = RadioButton
left = 10
top = 90
height = 17
width = 15
container = frmGroup

Name = lbConfig
type = Label
left = 30
top = 93
height = 13
width = 160
container = frmGroup
caption = Config Map Details

Name = btGo
type = Button
left = 15
top = 162
height = 25
width = 79
caption = Go!

Name = btCancel
type = Button
left = 140
top = 162
height = 25
width = 75
caption = Cancel
<EndData>
ENDSUB

BEGINSUB Name="CreateNotes"
#*******************************************************
# gmapnote.txt - google maps insert into user notes
# Version 0.1a by mtrax
# 24/01/2007 Initial version tested in Beta V7
#
# This will run against your current filter and update
# your database usernotes to insert a Google Map
# it will insert Image ref after your own notes and will
# try and bypass update if Image already exists
#
#*******************************************************

$debugcode = False

$Gmapdata = "Google Maps insert <br>"
$x = 0
$temp = GetEnvV("temp")
$mapdata = ""
Goto Position=Top

While .not. $_eol
$x = $x + 1
$gmoffset=4294967296
$gmlat=Val($d_Latitude) * 1e6
$gmlon=Val($d_Longitude) * 1e6
If ($gmlat < 0)
$gmlat=$gmlat + $gmoffset
EndIf
$sgmlat=NumtoStr(Int($gmlat))
$sgmlon=NumtoStr(Int($gmlon))

$gmapimg="<img src='http://maps.google.com/mapdata?Point=b&Point.latitude_e6="+ $sgmlat +"&Point.longitude_e6="+ $sgmlon +"&Point.iconid=15&Point=e&latitude_e6="+ $sgmlat +"&longitude_e6="+ $sgmlon +"&zm=" + $zoom + "&w=" + $breite + "&h=" + $hoehe + "&cc=us&min_priority=1' BORDER=1>"
#$mapdata = $mapdata + $d_Name +" : "+$d_Latitude + " ," + $d_Longitude +$_NewLine + $gmapimg + $_NewLine

# $mapdata = $mapdata + $d_Name +" : "+$d_Latitude +"("+ NumtoStr($gmx) + ") ," + $d_Longitude + " gmy ("+ NumtoStr($gmy) + " )"+$_NewLine

if At($Gmapdata,$d_UserNote) = 0
$oldnote=$d_UserNote
$d_UserNote=$Gmapdata + $_NewLine + $gmapimg + $_NewLine + $oldnote
$mapdata = $mapdata + "Updating Notes for: " + $d_Name + $_NewLine
else
$mapdata = $mapdata + "skipped Notes update: " + $d_Name + $_NewLine
EndIf

Goto Position=Next

EndWhile

$mapdata = $mapdata + "Total records:"+ NumToStr($x)

if $debugcode
$FileName = $temp + "\gmapdata.txt"
$Error = PutFile($FileName,$mapdata)
OpenFile file="$FileName"
EndIf

ENDSUB

BEGINSUB Name="CreateOfflineNotes"
#*******************************************************
# gmapnote.txt - google maps insert into user notes
# Version 0.1a mtrax
# 24/01/2007 Initial version tested in Beta V7
#
# This will run against your current filter and update
# your database usernotes to insert a Google Map
# it will insert Image ref after your own notes and will
# try and bypass update if Image already exists
#
# Modified by happyworld
# Modified by JamesDoe
#*******************************************************

$debugcode = False

$EraseFiles = $wget + "\googlemap.bat"
IF FileExists ($EraseFiles)
FILEERASE File=$EraseFiles
ENDIF

$Gmapdata = "Google Maps insert <br>"
$x = 0
$temp = GetEnvV("temp")
$mapdata = ""
Goto Position=Top
SET $Data = AppendFile("$googlemapdir"+"\googlemap.bat","cd " + "$googlemapdir" + $_NewLine)

$ThisRecord = 0

While .not. $_eol
$x = $x + 1
$gmoffset=4294967296
$gmlat=Val($d_Latitude) * 1e6
$gmlon=Val($d_Longitude) * 1e6
If ($gmlat < 0)
$gmlat=$gmlat + $gmoffset
EndIf
$sgmlat=NumtoStr(Int($gmlat))
$sgmlon=NumtoStr(Int($gmlon))

$status = "Cache: " + "$ThisRecord" + " of " + "$_Count"
SHOWSTATUS Height=150 Width=400 Left=200 Top=200 msg="$status"
$gmapimg="<img src='" + $htmlmapdir + $d_code + "map.gif'><br><br>"
$FILEGET="$googlemapdir" + "" + "$d_code" + "map.gif"
IF .NOT. FileExists($FILEGET)
$ThisRecord = $ThisRecord + 1
$gmapimga=Chr(34) + "http://maps.google.com/mapdata?Point=b&Point.latitude_e6="+ $sgmlat +"&Point.longitude_e6="+ $sgmlon +"&Point.iconid=15&Point=e&latitude_e6="+ $sgmlat +"&longitude_e6="+ $sgmlon +"&zm="+ $zoom +"&w="+ $breite +"&h="+ $hoehe +"&cc=us&min_priority=1"+Chr(34)
$Data=Chr(34) + "$wget" + "" + Chr(34) + "wget.exe -O " + $d_Code+"map.gif" + " " + $gmapimga + $_NewLine
SET $Data = AppendFile("$googlemapdir" + "\googlemap.bat","$Data")
SET $Data = AppendFile("$googlemapdir" + "\googlemap.bat","@ping localhost -n "+ $wait +" >NUL" + $_NewLine)
IF Left($Data,7) = "*Error*"
Pause Msg="$Data"
CANCEL
ENDIF
ENDIF

if At($Gmapdata,$d_UserNote) = 0
$oldnote=$d_UserNote
$d_UserNote=$Gmapdata + $_NewLine + $gmapimg + $_NewLine + $oldnote
$mapdata = $mapdata + "Updating Notes for: " + $d_Name + $_NewLine
else
$mapdata = $mapdata + "skipped Notes update: " + $d_Name + $_NewLine
EndIf

Goto Position=Next

EndWhile

$mapdata = $mapdata + "Total records:"+ NumToStr($x)

if $debugcode
$FileName = $temp + "\gmapdata.txt"
$Error = PutFile($FileName,$mapdata)
OpenFile file="$FileName"
EndIf
SET $Data = AppendFile("$googlemapdir" + "\googlemap.bat","del googlemap.bat")
$Data = quote("$googlemapdir" + "\googlemap.bat")
RUNPGM pgm=$Data wait=no
ENDSUB

BEGINSUB Name="ClearNotes"

#*******************************************************
# cleargmapnote.txt - google maps insert into user notes
# Version 0.1 by mtrax
# 24/01/2007 Initial version tested in Beta V7
#
# This will run against your current filter and update
# your database usernotes to remove a Google Map
#
#*******************************************************

$debugcode = False

$Gmapdata = "Google Maps insert <br>"
$x = 0
$temp = GetEnvV("temp")
$mapdata = ""
Goto Position=Top

While .not. $_eol

$x = $x + 1

If At($Gmapdata,$d_UserNote) <> 0
$oldnote=$d_UserNote
$sregexp=$Gmapdata + $_NewLine + "<img.*>" + $_NewLine
$newnote=RegExReplace($sregexp, $oldnote, "")
$mapdata = $mapdata + "old note: " +$oldnote +$_NewLine + "new note: " + $newnote + $_NewLine
$d_UserNote=$newnote
EndIf

Goto Position=Next

EndWhile

$mapdata = $mapdata + "Total records:"+ NumToStr($x)

if $debugcode
$FileName = $temp + "\gmapdata.txt"
$Error = PutFile($FileName,$mapdata)
OpenFile file="$FileName"
EndIf

ENDSUB

BEGINSUB Name="ConfigMap"
if ShowForm($ConfigMap)
if $cmGo
GOSUB Name="WriteConfigMap"
endif
if $cmCancel
#cancelled with Cancel button
endif
else
#cancelled with [X] button
Cancel
endif

<data> varname=$ConfigMap
Name=ConfigForm
Type=Form
height=325
caption=Config the Map-"Design"

Name=Label
Type=Label
Left=100
Top=5
Caption=Config the Google Map Design
style=bold
size=12

Name=Label1
Type=Label
Left=120
Top=40
style=bold
Caption=Choose the height of the map

Name=HLabel
Type=Label
Left=5
Top=60
Caption=Height

Name=hoehe
Type=Edit
Left= 120
width = 40
Top=60

Name=HLabel1
Type=Label
Left=170
Top=60
Caption=px

Name=Label2
Type=Label
Left=120
Top=95
style=bold
Caption=Choose the width of the map

Name=blabel
Type=Label
Left=5
Top=115
Caption=Width

Name=breite
Type=Edit
Left= 120
width = 40
Top=115

Name=blabel1
Type=Label
Left=170
Top=115
Caption=px

Name=Label3
Type=Label
Left=120
Top=150
style=bold
Caption=The Zoom-Factor in feet(?) 2000 or 3000 will be fine

Name=ZLabel
Type=Label
Left=5
Top=170
Caption=Zoom

Name=zoom
Type=Edit
Left= 120
width = 60
Top=170

Name=ZLabel1
Type=Label
Left=190
Top=170
Caption=feet

Name=Label4
Type=Label
Left=120
Top=205
style=bold
Caption=Seconds to wait before each request

Name=wLabel
Type=Label
Left=5
Top=225
Caption=Delay

Name=wait
Type=Edit
Left= 120
width = 20
Top=225

Name=wLabel1
Type=Label
Left=170
Top=225
Caption=Seconds

Name = cmGo
type = Button
left = 15
top = 260
height = 25
width = 79
caption = OK

Name = cmCancel
type = Button
left = 140
top = 260
height = 25
width = 75
caption = Cancel
<EndData>
ENDSUB

BEGINSUB Name="WriteConfigMap"
$UChoice=$hoehe + ";" + $breite + ";" + $zoom + ";" + $wait + ";"
$SavedFile=PUTFILE($dataconfigmap, $UChoice)
IF Left($SavedFile, 7) = "*Error*"
CANCEL Msg="Unable to write to $dataconfigmap!"
ENDIF
GOSUB Name="ChooseAction"
ENDSUB
 

Hödeken

Geonewbie
Also ich habe heute mit dem Macro etwas experimentiert. Zunächst klappte auch alles, doch jetzt werden die Pfade zu den Maps beim HTML-Export nicht umgewandelt und die GCxxxmap.gif-Dateien auch nicht kopiert. Im Quelletext der erzeugten HTML-Dateien ist noch der ursprüngliche Pfad enthalten, der auf das GSAK-Maps-Verzeichnis verweist.
Im GSAK werden die Maps auch richtig hinter "Google Maps insert" angezeigt.

Spoilerbilder werden aber korrekt umgewandelt und kopiert. Der Haken im HTML-Export bei "Convert and Copy file:/// images" ist natürlich gesetzt.

GSAK erkennt also offensichtlich nicht, dass es sich bei dem Notes-Eintrag um ein zu exportierendes Bild handelt? Das steht in den User Notes: Google Maps insert <br>
<img src='..\maps\GCQY1Pmap.gif'><br><br>

Nachtrag: Es stellte sich heraus, dass die relative Pfadangabe das Problem war. Nur die Syntax <img src= "file:///deinroot\deinordner\deinemap.gif"> funktioniert.
 

chr2k

Geomaster
So ein ähnliches Problem habe ich momentan auch (der dateiname der ...ma.gif datei ist anders... zwei buchsaben, dann zig zahlen und dann .gif - echt merkwürdig!) .

Da ich jetzt aber meine HTML Cachebeschreibungen unbedingt brauchte, habe ich die Google Map Bilderals Hyperlink und NICHT als User Note einfügen lassen.

Da ich dieses Problem aber nochmal mit dem original Code ausschließen möchte, hab ich die Tage ja nach diesem gefragt.

Ich meld mich dann wieder.
 

jpjfire

Geonewbie
Please forgive the English, as I don't know German. I have three sons that are studying the German language in school, but they have not progressed far enough to be of much help.

My question, I have installed offlinegooglemaps2 in GSAK, but cannot get the maps to export into the html file that I put on my Palm PDA. I think the problem is in what I enter into the "relative path". I have been saving the map images to "...desktop\googlemaps". What exactly should I enter into the relative path to have the maps show up in the exported html file? Thank you.

jpjfire
 
Oben