' todo ' deltadem initial à zero ' 20170614 reprise low cost pout .csv simple trié ' 20140706 reprise pour traiter .csv de GeoTr ' ' ----------------- version pour documeznta tion freq=10 ' période de demande de points version=" par flavigny@free.fr, 20170614" dim flog dim fs set fs=createobject("scripting.filesystemobject") ' options imprimerbaliselu=false imprimergpslu=true ' mettrepunaises =false' true mettrepetitsclous =true mettregrosclous =false mettrefeux=true mettrepunaisedemande=true lignenmea= true ' couleurs B V R Couleurtracenmea="07ffe0000" ' lignebalise=false Couleurtracebalise="07f00ff00" 'balise altitudebalise=0 ' imposible augme,nteer pour forcer affichage malgré talus et immeubles altitudenmea=0 miseenveillesec=180 couleurrouge="07f0000ff" couleurbleue="07fff0000" topdebut="" topfin="" topdebutdef="20001211135000" topfindef= "20991231235959" lastindice=-1 Couleur1= "07fff0000" 'bleu Couleur2= "07f0000ff" 'rouge Couleur= "07f000000" 'noir ' tableau pour mémoriser les vitesses gps qstarz depuis debut trajet ' 20151219 mettre négatif -1 si trop de demande dimlag=200000 dim tabvitesse(200000) for i=1 to dimlag tabvitesse(i)=0 next '------------- datepregmt=0 datepre=0 ' détection arret vitessenulle=3 nbcritique=5 ' msgbox "critique=" & critique dim litoutsave gmtnmeadep=-1 fgmtnmeafin=0 depart=false yanmea=true gmtlag=1 dateheurefin="" dateheuredeb="" gmtbalisedeb=0 gmtbalisefin=0 ' mettrepointsnmea=mettrepetitsclous or mettregrosclous or mettrefeux ' xbalise=0 ybalise=0 wbalise=64 '32 hbalise=64 '16 xqstarz=0 yqstarz=0 wqstarz= 32 hqstarz= 16 tessellate=1 dim histoacq(181) 'acq de la page web dim histodelta(181) ' nb de secondes depuis point précédent dim histogps(181) ' EN ATTente temps entre demande dim histodem(181) ' distribution delai entre demande for i=0 to 180 histoacq(i)=0 histodelta(i)=0 histogps(i)=0 histodem(i)=0 next ' paramètres: ' -------------------- paramètres à ajuster Set WshShell = WScript.CreateObject("WScript.Shell") dim fnmea dim nmea dim tout(10000) litout=0 racine="" ' pourrait êyre qstarze ? rouge=false noir=true extcouleur="" if wscript.arguments.count=1 then racine=wscript.arguments(0) 'msgbox "exec ===" & racine & "===" else racine=inputbox("fichier .hcs produit par CsvPlusHtM le web geotraceur" & vbcrlf & "éventuellement debut-fin=fichier" & vbcrlf & _ "debut et fin: AAAAMMJJhhmm ou AAAMMJJ") if racine="" then wscript.quit end if nmeacoul="" if instr(racine,"_rouge")>0 then extensioncouleur="_rouge" rouge=true nmeacoul=racine racine=mid(racine,1,instr(racine,"_rouge")-1) & mid(racine,instr(racine,"_rouge")+6) Couleurtracenmea=couleurrouge elseif instr(racine,"_noire")>0 then extensioncouleur="_noire" noir=true nmeacoul=racine racine=mid(racine,1,instr(racine,"_noire")-1) & mid(racine,instr(racine,"_rouge")+6) Couleurtracenmea=couleurbleue elseif instr(racine,".hcs")>0 then lignenmea=false mettrepunaises =true mettrepetitsclous =false lignebalise=true elseif instr(racine,".nmea")>0 then lignenmea=true mettrepunaises =true mettrepetitsclous =true lignebalise=true end if ' lextension=-1 nmeaseul=false if len(racine)>5 then if mid(racine,len(racine)-4)=".nmea" then nmeaseul=true lextension=5 end if end if if not nmeaseul then if len(racine)<4 then msgbox ".hcs obligatoire touvé:" & vbcrlf & racine wscript.quit end if if not nmeaseul and mid(racine,len(racine)-3)<>".hcs" then msgbox ".hcs ou .nmea obligatoire, trouvé:" & vbcrlf & racine wscript.quit end if lextension=4 end if ' po end if ' msgbox "recu===" & racine & "===" 'if fs.fileexists(racine) then msgbox "existe encore===" &racine & "===" ' oter chemin inutile=instrrev(racine ,"\") chemin="" if inutile>0 then chemin=mid(racine,1,inutile) racine=mid(racine,inutile+1) end if ' isoler restriction =debut-fin ' !!!!!!à revoir politique completion yadeb=false completer=false if instr(racine,"=")>0 then yadeb=true np=instr(racine,"-") ' si pas de tiret , debut termine à = if np=0 then np=instr(racine,"=") completer=true end if topdebutrecu=mid(racine,1,np-1) 'msgbox "topdebutrecu" & topdebutrecu & vbcrlf & topfin topdebut=topdebutrecu ' étendre les intervalle si début seulement if len(topdebutrecu)=10 then topdebut=topdebutrecu & "0000" topfin= topdebutrecu & "5959" end if if len(topdebutrecu)=8 then topdebut=topdebutrecu & "000000" topfin= topdebutrecu & "235959" end if ' msgbox "topdebut" & topdebut & vbcrlf & topfin racine=mid(racine,np+1) np=instr(racine,"=") ' msgbox "topfin " & np if (np>1) then topfin=mid(racine,1,np-1) if len(topfin)=8 then topfin=topfin & "2359" end if racine=mid(racine,np+1) end if racine=mid(racine, 1,len(racine)-lextension) if topdebut="" and topfin="" then extension="" gmttopfin=datevb(topfindef,331) gmttopfin=datevb(topfindef,332) else extension= "_" &topdebut & "_" & topfin ' msgbox topdebut & " " & len(topdebut) gmttopdebut=datevb(topdebut,334)-gmtlag/24 gmttopfin=datevb(topfin,336)-gmtlag/24 end if ' msgbox "deb : " & topdebut & vbcrlf & "fin: " & topfin ' ---------------- fin de la zone personalisable ' out xx=instrrev(chemin,"\") out=mid(chemin,1,xx-1) xx=instrrev(out,"\") out=mid(out,1,xx) & "kml\" nomfi= out & racine & extension & extensioncouleur & ".kml" nomlog= out & racine & extension & extensioncouleur & ".log" ' ' msgbox nomfi set fo=fs.createtextfile(nomfi,true) set flog=fs.createtextfile(nomlog,true) ' msgbox "fait ouverture de fichier " & vbcrlf & nomfi & vbcrlf & nomlog dim mbox dim fi mbox=chemin & racine & ".hcs" nmea=chemin & racine & extensioncouleur & ".nmea" 'msgbox "andiamo " & vbcrlf & mbox if not fs.fileexists(mbox) then msgbox "pas trouvé le fichier " & vbcrlf & "===" & mbox & "=== len:" & len(mbox) & vbcrlf & "racine===" & racine & "===" wscript.quit else ' msgbox "trouvé le fichier " & vbcrlf & "===" & mbox & "===" end if 'msgbox "lire mbox " & vbcrlf & mbox set fi=fs.opentextfile(mbox ,1) ' msgbox nmea if not fs.fileexists(nmea) then ' msgbox"sans nmea" & vbcrlf & nmea yanmea=false else set fnmea=fs.opentextfile(nmea ,1) end if ' msgbox "ouverture" ouverture ' msgbox "charger" charger prtinput=true prologue fo.writeline " <!-- inventaire (44) charger balise trouve GMT dep= " & gmtbalisedeb & " fin= " & gmtbalisefin & "-->" fo.writeline " <!-- inventaire (44) créneau cmd GMT dep= " & gmttopdeb & " fin= " & c & "-->" ' gmttopdebut or ladateheuregmt>gmttopfin fo.writeline " <!-- inventaire lignenmea " & lignenmea & " yanmea:"& yanmea &" -->" if lignenmea and yanmea then loadettracenmea else end if fo.writeline " <!-- inventaire now principal -->" principal fo.writeline "<!-- si nmea tracer " & mettrepointsnmea & " " &yanmea & " -->" if mettrepointsnmea and yanmea then pointsnmea fo.writeline " <!-- inventaire " & lignenmea & " "& yanmea &" -->" fo.writeline " <!-- inventaire lignebalise " & lignebalise &" -->" if lignebalise then trajet epilogue message="" fo.close prthisto wscript.quit ' pas de end du pp! ' ------------------------ ' ------------------------ ' ------------------------ ' ------------------------ ' ------------------------ function indice(at) 'int((dateactgmt-0.01/(24*3600) )*24*3600*1000) ind=int(((at+0.01/(24*3600) )-gmtbalisedeb)*24*3600) if ind<0 then ind=0 end if if ind > dimlag then msgbox "indice au dela du possible" & ind wscript.quit end if indice=ind end function sub principal ' autres variables dim li ' ' gestion on error HORS SERVICE, toute erreur est fatale pendant le développement! ' on error resume next on error goto 0 ' dim mbox dim lilus lilus=0 litoutsave=litout '' écrire le debut du fichier .kml ' msgbox "(3) prologue fait litout=" & litout ' compter les points dans le créneau ptstot=0 fo.writeline " <!-- debut de principal litout=" &litout & " -->" annule=0 while litout > 0 li=tout(litout) 'fo.writeline " <!-- reprendrre =="&li& "== -->" litout=litout-1 if len(li)>0 then n1=instr(li,";") li=mid(li,n1+1) n1=instr(li,";") ladateheure=datevb(mid(li,1,n1-1),66) ladateheuregmt=ladateheure-gmtlag/24 ' appliquer filtre demande if (ladateheuregmt<gmttopdebut or ladateheure>gmttopfin) then ' msgbox "refus " & vbcrlf & ladateheure & vbcrlf & topdebut & " " & topfin annule=annule+1 else 'msgbox "te gmt " & vbcrlf & ladateheure & vbcrlf & topdebut & " " & topfin ptstot=ptstot+1 '1 end if end if wend ' traitement litout=litoutsave fo.writeline "<!-- traitement des " & litout & " points balise annule=" & annule & " ptstot="& ptstot & " -->" ' while litout > 0 fo.writeline "<!-- litout a =" & litout & " ==" & li & "== -->" li=tout(litout) 'fo.writeline "<!-- litout b=" & litout & "- -" & li & "-->" li2txt=li librut=li litout=litout-1 if instr(li,";;;;")>0 then fo.writeline "<!-- raz for ;;;; -->" tout(litout+1)="" 'fo.writeline "<!-- zeroed -->" else ' msgbox "ligne non vide"&li lilus=lilus+1 xc="" yc="" full=li n1=instr(li,";") li=mid(li,n1+1) ' <!-- 34241030954;20140618!1716;48.825517;2.392417;Quai de Bercy. 94200. Charenton. Îl ' on error resume next n1=instr(li,";") if n1=0 then msgbox "pas de ; dans " & vbcrlf&li ' ezeze** end if l=mid(li,1,n1-1) on error goto 0 ladateheuregmt=datevb(l,99) ladateheureloc= locale(datevb(l,88)) ' msgbox "112: lilus=" & lilus & vbcrlf & "dateheureGMT="& ladateheure & vbcrlf &li& vbcrlf & full li=mid(li,n1+1) 'msgbox l if len(l)<>14 then msgbox " pas 14!" dateact= datevb(l,1) if datepre<>0 then elapse=dateact-datepre datepre=dateact ' position relative nbsecdepuisdepart=indice(ladateheuregmt) '=' contruire vecteur historique 20" lag=" " if yanmea then for i=0 to 19 if nbsecdepuisdepart-i >0 then ' fo.writeline " <!-- i=" &nbsecdepuisdepart& " " & lag & " -->" lag=lag & tabvitesse(nbsecdepuisdepart-i)&" " end if next 'i end if if false then else 'msgbox "accepte " & vbcrlf & ladateheure & vbcrlf & topdebut & " " & topfin ptsloc=ptsloc+1 '1 ' msgbox "on affiche " & vbcrlf & li if prtinput then fo.writeline "<!-- accept= " & librut & "-->" lipo=li coord=li np=instr(li,";") on error resume next yc=mid(li,1,np-1) 'erreur if err.number>0 then msgbox "yc " & err.description & vbcrlf & "li:" & li & vbcrlf & "librut=" & librut & vbcrlf & np on error goto 0 li=mid(li,np+1) np=instr(li,";") if err.number>0 then msgbox "xc " & err.description & vbcrlf & "li:" & li & vbcrlf & librut & vbcrlf & np xc=mid(li,1,np-1) if err.number>0 then msgbox "erreur xc librut=" & librut end if on error goto 0 li=mid(li,np+1) np=instr(li,";") desc=mid(li,1,np-1) ' 20170615 traitement accents nextvit=mid(li,np+1) np=instr(nextvit,";") vitesse=mid(nextvit,1,np-1) nextvit=mid(nextvit,np+1) np=instr(nextvit,";") nextvit=mid(nextvit,np+1) np=instr(nextvit,";") acq=mid(nextvit,1,np-1) nextvit=mid(nextvit,np+1) np=instr(nextvit,";") pdop=mid(nextvit,1,np-1) nextvit=mid(nextvit,np+1) np=instr(nextvit,";") pdop=mid(nextvit,1,np-1) nextvit=mid(nextvit,np+1) np=instr(nextvit,";") pdop=mid(nextvit,1,np-1) nextvit=mid(nextvit,np+1) np=instr(nextvit,";") pdop=mid(nextvit,1,np-1) nextvit=mid(nextvit,np+1) np=instr(nextvit,";") recule=mid(nextvit,1,np-1) if recule<>"" then recule="reçu le: " & mid(recule,1,10) & " " & mid(recule,15,8) end if fo.writeline "<!-- recu " & recule & "-->" if mid(acq,1,1)="*" then acq=180 if mid(acq,1,1)="+" then acq=180 if len(acq)=0 then acq=0 fo.writeline"<!-- acq=" &acq & "= -->" iacq=0+acq ' délai d'acquisition délivré par page web if iacq<0 then msgbox "iaq négatif" ' if iacq>180 then msgbox "iaq déborde " & iacq if iacq>180 then iacq=180 histoacq(iacq)=histoacq(iacq)+1 acqa=acq acqsec=0 if len(acq)=""then else if mid(acq,1,1)>"9" then acqsec=0+acq end if ' ' if acqa<>"" then acqa=" acq=" & acq & """" if pdop<>"" then acqa=acqa & " pdop=" & pdop if acqa<>"" then acqa="<br/>"&acqa xc=virg2point(xc) yc=virg2point(yc) totale=totale & xc & " " & yc & "," if (len(xc)>0) and (len(yc)>0) then if prtinput then fo.writeline "<!-- " & li & "-->" linew=li 'msgbox acqa & vbcrlf & acq demandepre=demande & "(prev)" demande="" if (acq<>"") and (acq<>"*****") and (acq<>"++++") then ' msgbox "acq=" & acq demandenum= locale(dateact-acq/(24*60*60)) demande= "<br/>demande à " & demandenum acqsec=acq end if ' vo circ=40000000 y1=circ/360 x1=y1 * cos(1.7*v(yc)/90) if (xcpre<>"") and(ycpre<>"") then dx=(v(xc)-v(xcpre)) *x1 dy=(v(yc)-v(ycpre))*y1 d=int(sqr(dx*dx+dy*dy)) end if xcpre=xc ycpre=yc ela="" if elapse<>0 then ela=" ~:" &int(36*d/(elapse*24*60*60))/10 deltapoint=int(0.01+elapse*24*60*60 ) if (deltapoint<=180) and (deltapoint>=0) then histodelta(deltapoint)=histodelta(deltapoint)+1 if demandenumpre=""then deltademsec=0 ' pour le premier! demandenumpre=demandenum depart=true ' 20170615 else deltademsec=int(0.01+24*3600*(demandenum-demandenumpre)) ' msgbox deltademsec & vbcrlf & demandenumpre & vbcrlf & demandenum if (deltademsec<=180) and (deltademsec>=0) then histodem(deltademsec)=1+histodem(deltademsec) i1=int(deltademsec/10) i2=deltademsec-10*i1 if (i2<>0) or (deltademsec=0) then depart=true flog.writeline "rupture à: " & demande & " dem précédente: " & demandenumpre & " demande:" & demandedemnum& """" end if end if ' ' inverseer vitesse topdema nde ind=indice(ladateheuregmt-acqsec/(24*3600)) fo.writeline "<!-- inversé " & ind & " à:" & ladateheuregmt & " moins:" & acqsec & """ soit gmt:" & ladateheuregmt-acqsec/(24*3600) & "-->" if yanmea then tabvitesse(ind)= -1- tabvitesse(ind) end if if mettrepunaises then deltadem1000= int(demandenum*24*3600*1000) - int(demandenumpre*24*3600*1000) deltademsec=int((deltadem1000+2)/1000) fo.writeline "<!--deltademsec:" & deltademsec & " deltadem1000: " & deltadem1000 & " dem: " & int(demandenum*24*3600*1000) & " pre:" & int(demandenumpre*24*3600*1000) & "-->" 'moyenne fo.writeline " <Placemark>" fo.writeline " <description># " & ptsloc & ": " & ladateheureloc _ & "<br/>" & desc & "<br/> " & xc & "*" & yc & _ "<br/> dist:" & d & _ "<br/> vit. Gps: " & vitesse & ela & acqa & _ " <br/>Delta dem: " & deltademsec & """" & _ " point=" & deltapoint & """ " & demande & _ demandepre & _ "<br/>"&recule & _ "<br/>" & lag & _ " </description>" ' paragraphe douteux brut=deltademsec mod freq cadence=(brut<=1) or (brut>=freq-1) or (deltademsec <10) ' essai afficher depart 'if depart and (deltademsec<>11) then if ptsloc=1 or deltademsec>190 then fo.writeline " <styleUrl>#eveil</styleUrl>" elseif not cadence then fo.writeline " <styleUrl>#stop</styleUrl>" 'traffic elseif deltademsec=10 then fo.writeline " <styleUrl>#pourbalise</styleUrl>" elseif i2=0 then fo.writeline " <styleUrl>#pourbalisecarre</styleUrl>" elseif deltademsec=11 then fo.writeline " <styleUrl>#depart11</styleUrl>" else fo.writeline " <styleUrl>#pourbalise</styleUrl>" end if depart=false fo.writeline " <Point><coordinates>" & xc & "," & yc & " </coordinates></Point>" fo.writeline " </Placemark>" end if ' msgbox trouveloc & len(loctrie) & " " & trouve179 & len(gpstrie) demandenumpre=demandenum end if ' top end if ' non vide end if' ;;; end if ' de trop:! wend ' fichier end sub ' principal '------------------- sub prthisto tot=0 totdelta=0 totdem=0 ni=0 ' ciolmoptedes opoints pour % for i=0 to 180 ni=ni+histoacq(i) next for i=0 to 180 tot=tot+histoacq(i) totdem=totdem+histodem(i) totdelta=totdelta+histodelta(i) if (histoacq(i)<>0) or (histodelta(i)<>0) then flog.writeline i & """: #acq:" & histoacq(i)& " " & tot & " " & int(100*tot/Ni) & "%" & _ " #delta:" & histodelta(i) & " " & int(100*totdelta/Ni) & "%" & _ " #dem:" & histodem(i) & " " & int(100*totdem/Ni) & "%" end if next flog.close end sub '---------------------------- sub pointsnmea 'msgbox"(5)pointsnmea" fo.writeline " <!-- inventaire pointsnmea -->" lag=" " ' nmea nbnmea=0 xpre="" ypre="" if not fs.fileexists(nmea) then msgbox "fichier nmea pas trouvé:" & vbcrlf & nmea wscript.quit end if set fnmea=fs.opentextfile(nmea ,1) fo.writeline"<!--debut points nmea-->" while not fnmea.atendofstream li=fnmea.readline if imprimergpslu then fo.writeline "<!-- " & li & "-->" if 1=instr(li,"$GPRMC") then ' prendre date for i=1 to 9 li=mid(li,instr(li,",")+1) if i=7 then vitesseq=mid(li,1,instr(li,",")-1) vitesseq=mid(vitesseq,1,instr(vitesseq,".")-1)&mid(vitesseq,instr(vitesseq,".")+1,1) vitesseq=int(1.852*vitesseq)/10 vitessekmh=int(vitesseq) end if next 'i darev= mid(li,1,instr(li,",")-1) da="20"&mid(darev,5,2)&mid(darev,3,2) & mid(darev,1,2) ' msgbox "da="&da end if if 1=instr(li,"$GPGSA") then for i=1 to 17 ifini=instr(li,",") act=mid(li,1,ifini-1) li=mid(li,ifini+1) if i=16 then pdop=act if i=17 then vdop=act next 'i ifini=instr(li,"*") hdop=mid(li,1,ifini-1) end if if 1=instr(li,"$GPGGA") then li=mid(li,instr(li,",")+1) davb=da&mid(li,1,instr(li,".")-1) l=da&li da=davb dateactgmt=datevb(da,2) if not danslestemps(1,dateactgmt) then ' fo.writeline "<!-- rejet " & dateactgmt & " " &gmtbalisedeb & "><" & gmtbalisefin & " -->" else ' dans les temps fo.writeline "<!-- acept " & dateactgmt & " " &gmtbalisedeb & "><" & gmtbalisefin & " >>>" & lag & " -->" sommeil=(dateactgmt-datepregmt)*24*60*60 datepreloc=locale(datepregmt) datepregmt=dateactgmt lag=mid(lag,1,len(lag)-1) while mid(lag,len(lag),1)<>" " lag=mid(lag,1,len(lag)-1) wend lag=vitessekmh & " " & lag dateactlocale=locale(dateactgmt) li=mid(li,instr(li,",")+1) ' msgbox da n=instr(li,",") Y=mid(li,1,n-1) yg=y li=mid(li,n+1) n=instr(li,",") NS=mid(li,1,n-1) li=mid(li,n+1) if NS<>"N" then Y="-" & Y ' n=instr(li,",") X=mid(li,1,n-1) xg=x li=mid(li,n+1) n=instr(li,",") EW=mid(li,1,n-1) li=mid(li,n+1) if EW<>"E" then X="-" & X ' msgbox da & vbcrlf & y & vbcrlf & x nbnmea=nbnmea+1 gros=tabvitesse(indice(dateactgmt))+1<0 if gros then fo.writeline "<!-- gros à " & locale(dateactgmt) & "-->" '00227.0868 xfrac="0,"&mid(x,7) xmin= mid(x,4,2) xdec=0+xmin+xfrac xearth=mid(x,1,3)+xdec/60 yfrac="0,"&mid(y,6) ymin=mid(y,3,2) ydec=0+ymin+yfrac yearth=mid(y,1,2)+ydec/60 nexturl="" if vitessekmh>vitessenulle then stoped=false fo.writeline " <!-- stoped mis a false -->" else ' if stoped then ' deja arret else fo.writeline " <!--stoped vitesse nulle a GMt:" & dateactgmt & " -->" indarret=indice(dateactgmt) ' copmpter durée à venir duree=0 isuiv=0 while duree=0 and indarret+isuiv<lastindice isuiv=isuiv+1 ' fo.writeline "<!-- point suivant =" &duree & " " & tabvitesse(indarret+isuiv) &" -->" if tabvitesse(indarret+isuiv)>vitessenulle then duree=isuiv wend fo.writeline "<!-- duree=" &duree &" -->" if duree>=nbcritique then fo.writeline " <!--stoped for " & duree & " "" -->" stoped=true nexturl="#stop" end if end if ' vitesse nulle end if if stoped then if nexturl="" then nexturl="#pourqstarz" elseif gros then if mettreglosclous then nexturl="#pourqstarzgros" else nexturl="#pourqstarz" end if else if mettrepetitsclous then nexturl="#pourqstarz" end if end if if sommeil>miseenveillesec then ' miseenveillesec then nexturl="eveil" ' msgbox "eveil a " & dateactgmt & vbcrlf &nexturl fo.writeline " <!-- veille de: " & datepreloc & " a: " & dateactlocale & " -->" end if fo.writeline " <!-- nexturl=" & nexturl & " -->" if nexturl<>"" then fo.writeline " <Placemark>" fo.writeline " <description>#" & nbnmea & " le" & dateactlocale & "<br/>vitesse: " & vitesseq fo.writeline "<br/>" & xearth & " " & yearth if (hdop&vdop&pdop) <>"" then fo.writeline "<br/>DOP: P="& pdop & " H=" & hdop & " V=" & vdop fo.writeline " <br/>" & lag if stoped then fo.writeline "<br/>arret pour " &duree & " "" " if sommeil>miseenveillesec then fo.writeline "<br/>point précédent le: " & datepreloc & " " fo.writeline "</description>" ' punaise ' fo.writeline " <styleUrl>" &nexturl&"</styleUrl>" ' fo.writeline " <Point><coordinates>" & virg2point(xearth) & "," & virg2point(yearth) & " </coordinates></Point>" fo.writeline " </Placemark>" ' un de trop ? xpre=x ypre=x end if ' dans les temps end if ' (1) end if ' (1) wend fo.writeline"<!-- fin des " & nbnmea &" points nmea-->" fnmea.close end sub function locale(da) locale=da+gmtlag/24 end function function datevb(l,appel) 'msgbox "datevb appel " & appel & vbcrlf & l 'flog.writeline l '"if len(l)<>14 then ' msgbox "erreur datevb appel: " & appel & vbcrlf & l & vbcrlf & len(l) ' wscript.quit 'end if 'on error goto labas datevb=cdate(mid(l,1,4)&"/" & mid(l,5,2) & "/" & mid(l,7,2))+ _ timevalue(mid(l,9,2)&":" &mid(l,11,2) &":"& mid(l,13,2)) 'goto ok 'labas: 'msgbox l 'ok: 'on error goto 0 ' heure locale hiver end function function danslestemps(appel,dtgmt) if(dtgmt>=gmtbalisedeb) and (dtgmt<=gmtbalisefin) then f=true else f=false end if danslestemps=f end function function v(n) vv="" for i=1 to len(n) c1=mid(n,i,1) if c1="." then c1="," vv= vv&c1 next v=vv end function sub ajouter (x,y,ladateheure,ladatelast,liste,ptdif) liste=liste & x & "," & y & ":" & ladateheure ptdif=ptdif+1 ' msgbox liste end sub sub epilogue ' msgbox "epilogue" fo.writeline " </Folder>" fo.writeline " </Folder>" fo.writeline "<!-- EPILOGUE -->" fo.writeline "</Document>" fo.writeline "</kml>" end sub sub punaise (nom,dessus,url) fo.writeline " <StyleMap id=""" & nom & """>" fo.writeline " <Pair>" fo.writeline " <key>normal</key>" fo.writeline " <styleUrl>"&dessus&"</styleUrl>" fo.writeline " </Pair>" fo.writeline " <Pair>" fo.writeline " <key>highlight</key>" ' #default+nicon=0x467+hicon=0x477_copy0 fo.writeline " <styleUrl>anti"&dessus&"</styleUrl>" fo.writeline " </Pair>" fo.writeline " </StyleMap>" ' icone repos fo.writeline " <Style id=""" & dessus& """>" fo.writeline " <IconStyle>" fo.writeline " <scale>1</scale>" fo.writeline " <Icon>" fo.writeline " <href>" & url & "</href>" fo.writeline " <w>"&wbalise&"</w>" fo.writeline " <h>"& hbalise&"</h>" fo.writeline " <x>"&xbalise&"</x> " fo.writeline " <y>"&ybalise&"</y> " fo.writeline " </Icon>" fo.writeline " </IconStyle>" fo.writeline " </Style>" fo.writeline " <Style id=""anti" & dessus & """>" fo.writeline " <IconStyle>" fo.writeline " <scale>2</scale>" fo.writeline " <Icon>" fo.writeline " <href>" & url & "</href>" ' fo.writeline " <href>" & url & "</href>" 'fo.writeline " <w>32</w>" 'fo.writeline " <h>32</h>" fo.writeline " </Icon>" fo.writeline " </IconStyle>" fo.writeline " </Style>" ' ' fin "normal end sub' punaise ' sub punaisesimple (nom,dessus,url) fo.writeline " <StyleMap id=""" & nom & """>" fo.writeline " <Pair>" fo.writeline " <key>normal</key>" fo.writeline " <styleUrl>"&dessus&"</styleUrl>" fo.writeline " </Pair>" fo.writeline " <Pair>" fo.writeline " <key>highlight</key>" ' #default+nicon=0x467+hicon=0x477_copy0 fo.writeline " <styleUrl>anti"&dessus&"</styleUrl>" fo.writeline " </Pair>" fo.writeline " </StyleMap>" ' icone repos fo.writeline " <Style id=""" & dessus& """>" fo.writeline " <IconStyle>" fo.writeline " <scale>1</scale>" fo.writeline " <Icon>" fo.writeline " <href>" & url & "</href>" fo.writeline " <w>"&wbalise&"</w>" fo.writeline " <h>"& hbalise&"</h>" fo.writeline " <x>"&xbalise&"</x> " fo.writeline " <y>"&ybalise&"</y> " fo.writeline " </Icon>" fo.writeline " </IconStyle>" fo.writeline " </Style>" fo.writeline " <Style id=""anti" & dessus & """>" fo.writeline " <IconStyle>" fo.writeline " <scale>2</scale>" fo.writeline " <Icon>" fo.writeline " <href>" & url & "</href>" ' fo.writeline " <href>" & url & "</href>" 'fo.writeline " <w>1</w>" 'fo.writeline " <h>1</h>" fo.writeline " </Icon>" fo.writeline " </IconStyle>" fo.writeline " </Style>" ' ' fin "normal end sub' punaise ' ' sub documentation fo.writeline " <!-- version du programme: " & Version & "-->" fo.writeline " <!-- filtre: " & " " & topdebut & "a" & topfin & "-->" fo.writeline " <!-- fichier traite!: " & racine & ".csv -->" if yanmea then fo.writeline " <!-- fichier traite!: " & racine & ".nmea -->" fo.writeline " <!-- restriction créneau topdebut: " & topdebut & " -->" fo.writeline " <!-- topfin : " & topfin & " -->" fo.writeline " <!-- petits clous à la seconde: " & mettrepetitsclous & " -->" fo.writeline " <!-- gros clous à la demande: " & mettregrosclous & " -->" fo.writeline " <!-- lignebalise: " & lignebalise &" -->" fo.writeline " <!-- ALTITUDE: " & altitudebalise &" -->" fo.writeline " <!-- lignenmea: " & lignenmea &" -->" fo.writeline " <!-- ALTITUDE: " & altitudenmea &" -->" fo.writeline " <!-- pour arret vitesse nulle<=: " & vitessenulle & "kmh pendant mini " & nbcritique & """ -->" fo.writeline " <!-- creneau restereint -->" fo.writeline " <!-- gmttopdebut: " & gmttopdebut &" -->" fo.writeline " <!-- gmttopfin " & gmttopfin &" -->" ' end sub sub ouverture fo.writeline "<?xml version=""1.0"" encoding=""UTF-8""?>" fo.writeline "<kml xmlns=""http://earth.google.com/kml/2.1"">" end sub sub prologue documentation fo.writeline "<Document>" fo.writeline " <name>" & nomfi & "</name>" ' fo.writeline " <Style id=""bleu"">" fo.writeline " <IconStyle>" fo.writeline " <Icon>" fo.writeline " <href>root://icons/palette-4.png</href>" fo.writeline " <x>192</x>" ' 224 fo.writeline " <y>192</y>" fo.writeline " <w>32</w>" fo.writeline " <h>32</h>" fo.writeline " </Icon>" fo.writeline " </IconStyle>" fo.writeline " <LineStyle id=""khLineStyle989_copy0; "">" ' uhn fo.writeline " <color>" & couleur1 & "</color>" fo.writeline " <width>4</width>" fo.writeline " </LineStyle>" fo.writeline " </Style>" ' fo.writeline " <Style id=""tracenmea"">" fo.writeline " <IconStyle>" fo.writeline " <Icon>" fo.writeline " <href>root://icons/palette-4.png</href>" fo.writeline " <x>192</x>" ' 224 fo.writeline " <y>192</y>" fo.writeline " <w>32</w>" fo.writeline " <h>32</h>" fo.writeline " </Icon>" fo.writeline " </IconStyle>" fo.writeline " <LineStyle id=""khLineStyle989_copy0; "">" ' uhn fo.writeline " <color>" & couleurtracenmea & "</color>" fo.writeline " <width>4</width>" fo.writeline " </LineStyle>" fo.writeline " </Style>" ' fo.writeline " <Style id=""Couleurtracebalise"">" fo.writeline " <IconStyle>" fo.writeline " <Icon>" fo.writeline " <href>root://icons/palette-4.png</href>" fo.writeline " <x>192</x>" ' 224 fo.writeline " <y>192</y>" fo.writeline " <w>32</w>" fo.writeline " <h>32</h>" fo.writeline " </Icon>" fo.writeline " </IconStyle>" fo.writeline " <LineStyle id=""khLineStyle989_copy0; "">" ' uhn fo.writeline " <color>" & Couleurtracebalise &"</color>" fo.writeline " <width>4</width>" fo.writeline " </LineStyle>" fo.writeline " </Style>" ' fo.writeline " <Style id=""bleu"">" fo.writeline " <IconStyle>" fo.writeline " <Icon>" fo.writeline " <href>root://icons/palette-4.png</href>" fo.writeline " <x>192</x>" ' 224 fo.writeline " <y>192</y>" fo.writeline " <w>32</w>" fo.writeline " <h>32</h>" fo.writeline " </Icon>" fo.writeline " </IconStyle>" fo.writeline " <LineStyle id=""khLineStyle989_copy0; "">" ' uhn fo.writeline " <color>" & couleur1 & "</color>" fo.writeline " <width>4</width>" fo.writeline " </LineStyle>" fo.writeline " </Style>" ' ' '----------------------------------------- ' sans doute par defaur punaise "pourbalise","pof","http://maps.google.com/mapfiles/kml/pushpin/blue-pushpin.png" '----------------------------------------- ' balise en point "normal" ' carré pointé punaise "pourbalisecarre","pofcarre","http://maps.google.com/mapfiles/kml/shapes/placemark_square.png" ' tremblement de terre! punaise "eveil","pofeveil","http://maps.google.com/mapfiles/kml/shapes/earthquake.png" '------------' ' punaise verte punaise "departbalise","departpof","http://maps.google.com/mapfiles/kml/pushpin/grn-pushpin.png" ' traffic light punaise "stop","stoppof","http://www.google.com/mapfiles/traffic.png" '--- ' punaise blanche punaise "depart11","departpof11","http://maps.google.com/mapfiles/kml/pushpin/wht-pushpin.png" '---- ' punaise "pourqstarz","fop", fo.writeline " <StyleMap id=""pourqstarz"">" fo.writeline " <Pair>" fo.writeline " <key>normal</key>" fo.writeline " <styleUrl>fop</styleUrl>" fo.writeline " </Pair>" fo.writeline " <Pair>" fo.writeline " <key>highlight</key>" ' #default+nicon=0x467+hicon=0x477_copy0 fo.writeline " <styleUrl>antifop</styleUrl>" fo.writeline " </Pair>" fo.writeline " </StyleMap>" ' icone repos fo.writeline " <Style id=""fop"">" fo.writeline " <IconStyle>" fo.writeline " <Icon>" fo.writeline " <href>http://maps.google.com/mapfiles/kml/pushpin/blue-pushpin.png</href>" fo.writeline " <w>"&wqstarz&"</w>" fo.writeline " <h>"&hqstarz&"</h>" fo.writeline " <x>"&xqstarz&"</x> " fo.writeline " <y>"&yqstarz&"</y> " fo.writeline " </Icon>" fo.writeline " </IconStyle>" fo.writeline " </Style>" fo.writeline " <Style id=""antifop"">" fo.writeline " <IconStyle>" fo.writeline " <Icon>" fo.writeline " <href>http://maps.google.com/mapfiles/kml/pushpin/blue-pushpin.png</href>" 'fo.writeline " <w>32</w>" 'fo.writeline " <h>32</h>" 'fo.writeline " <w>1</w>" 'fo.writeline " <h>1</h>" fo.writeline " <w>"&wqstarz&"</w>" fo.writeline " <h>"&hqstarz&"</h>" fo.writeline " <x>"&xqstarz&"</x> " fo.writeline " <y>"&yqstarz&"</y> " fo.writeline " </Icon>" fo.writeline " </IconStyle>" fo.writeline " </Style>" ' punaise "pourqstarzgros","fop", fo.writeline " <StyleMap id=""pourqstarzgros"">" fo.writeline " <Pair>" fo.writeline " <key>normal</key>" fo.writeline " <styleUrl>fopgros</styleUrl>" fo.writeline " </Pair>" fo.writeline " <Pair>" fo.writeline " <key>highlight</key>" ' #default+nicon=0x467+hicon=0x477_copy0 fo.writeline " <styleUrl>antifopgros</styleUrl>" fo.writeline " </Pair>" fo.writeline " </StyleMap>" ' icone repos fo.writeline " <Style id=""fopgros"">" fo.writeline " <IconStyle>" fo.writeline " <scale>2</scale>" fo.writeline " <Icon>" fo.writeline " <href>http://maps.google.com/mapfiles/kml/pushpin/blue-pushpin.png</href>" fo.writeline " <w>"&wqstarz&"</w>" fo.writeline " <h>"&hqstarz&"</h>" fo.writeline " <x>"&xqstarz&"</x> " fo.writeline " <y>"&yqstarz&"</y> " fo.writeline " </Icon>" fo.writeline " </IconStyle>" fo.writeline " </Style>" fo.writeline " <Style id=""antifopgros"">" fo.writeline " <IconStyle>" fo.writeline " <scale>2</scale>" fo.writeline " <Icon>" fo.writeline " <href>http://maps.google.com/mapfiles/kml/pushpin/blue-pushpin.png</href>" 'fo.writeline " <w>32</w>" 'fo.writeline " <h>32</h>" fo.writeline " </Icon>" fo.writeline " </IconStyle>" fo.writeline " </Style>" fo.writeline " <StyleMap id=""default+nicon=0x467+hicon=0x477"">" fo.writeline " <Pair>" fo.writeline " <key>normal</key>" fo.writeline " <styleUrl>bleu</styleUrl>" fo.writeline " </Pair>" fo.writeline " <Pair>" fo.writeline " <key>highlight</key>" fo.writeline " <styleUrl>default+icon=0x477</styleUrl>" fo.writeline " </Pair>" fo.writeline " </StyleMap>" fo.writeline " <Style id=""Default + Icon = 0; x477_copy0; "">" fo.writeline " <IconStyle>" fo.writeline " <scale>1.1</scale>" fo.writeline " <Icon>" fo.writeline " <href>root://icons/palette-3.png</href>" fo.writeline " <x>224</x>" fo.writeline " <w>32</w>" fo.writeline " <h>32</h>" fo.writeline " </Icon>" fo.writeline " </IconStyle>" fo.writeline " <LabelStyle>" fo.writeline " <scale>1.1</scale>" fo.writeline " </LabelStyle>" fo.writeline " </Style>" fo.writeline " <Style id=""Default+Icon=0x477"">" ' a fo.writeline " <IconStyle>" fo.writeline " <scale>1.1</scale>" fo.writeline " <Icon>" fo.writeline " <href>root://icons/palette-4.png</href>" fo.writeline " <x>224</x>" fo.writeline " <y>224</y>" fo.writeline " <w>32</w>" fo.writeline " <h>32</h>" fo.writeline " </Icon>" fo.writeline " </IconStyle>" fo.writeline " <LabelStyle>" fo.writeline " <scale>1.1</scale>" fo.writeline " </LabelStyle>" fo.writeline " <LineStyle id=""khLineStyle989_copy1"">" '2 fo.writeline " <color>" & couleur2 & "</color>" fo.writeline " <width>4</width>" fo.writeline " </LineStyle>" fo.writeline " </Style>" fo.writeline " <Folder>" fo.writeline " <name>Lieux temporaires</name>" fo.writeline " <open>1</open>" fo.writeline " <Folder>" fo.writeline " <name>2007-06-09:06:22:06</name>" fo.writeline " <open>1</open>" fo.writeline " <Placemark>" fo.writeline " <name>TrackPoints</name>" fo.writeline " <description>2007-06-09:06:22:06</description>" fo.writeline " <styleUrl>#default+nicon=0x467+hicon=0x477</styleUrl>" fo.writeline " </Placemark>" end sub sub charger ' gestion on error HORS SERVICE, toute erreur est fatale pendant le développement! ' on error resume next ' on error goto 0 ' xx=fi.readline ' msgbox"en tete " & xx while not fi.atendofstream ' traduire li=fi.readline() 'msgbox "fi line:" & vbcrlf & li liprt=li if imprimerbaliselu then fo.writeline "<!-- lu balise==" & li & "== -->" li127="" for ili=1 to len(li) cun=mid(li,ili,1) if cun>"~" then cun="~" li127=li127 & cun next li=li127 b=li ' msgbox li if instr(li,";;;;")>0 then ' fo.writeline "<!-- ignore ;;;; -->" else n1=instr(li,";") if n1=0 then msgbox "pas de ;"& n1 kkjkjkj end if balise=mid(li,1,n1-1) li=mid(li,n1+1) ' fo.writeline "<!-- li=" & liprt & " -->" n1=instr(li,";") l=mid(li,1,n1-1) 'fo.writeline "<!-- l=" & l & " -->" len14=n1-1 ' lest la date en 14 'fo.writeline "<!-- ladateheureloc=" & l & " ----- " & len14 & " -->" 'msgbox "ladateheure:" & vbcrlf & l ladateheureloc=datevb(l,20) 'msgbox ladateheuregmt ladateheuregmt=ladateheureloc-gmtlag/24 if ladateheuregmt<gmttopdebut or ladateheuregmt>gmttopfin then if imprimerbaliselu then fo.writeline " <!-- rejet -->" else litout=litout+1 if imprimerbaliselu then fo.writeline " <!-- accepté "& litout & "==" & li & "== -->" ' msgbox l & vbcrlf & ladateheure l=mid(li,n1+1) n1=instr(l,";") xv=mid(l,1,n1-1) xp=virg2point(xv) l=mid(l,n1+1) n1=instr(l,";") yv=mid(l,1,n1-1) yp=virg2point(yv) l=mid(l,n1+1) if gmtbalisefin=0 then gmtbalisefin=ladateheuregmt ' msgbox "gmt " & ladateheuregmt &vbcrlf & "loc:"&ladateheureloc end if gmtbalisedeb=ladateheuregmt ladateheure=dateheure14(ladateheuregmt) tout(litout)= balise & ";" & ladateheure & ";" & xp & ";" & yp & ";" & l ' fo.writeline "<!-- charge litout=" & litout & ": " & tout(litout) & " -->" ' 0msgbox b & vbcrlf & tout(litout) & vbcrlf & l end if' ;;; end if wend ' fichier ' reverse=tout(litout)>tout(1) ' msgbox "fin de fichier reverse=" & reverse &vbcrlf & tout(1) & vbcrlf & tout(litout) if reverse then msgbox "plus jeune entête obligatoirement" wscript.quit end if ' msgbox "fin de charger litout=" & litout end sub ' function dateheure14(t) dateheure14=year(t)& c2(month(t))& c2(day(t)) & c2(hour(t)) & c2(minute(t)) &c2(second(t)) end function function c2(n) if n<10 then c2="0" & n else c2=n end if end function function virg2point(c) n="" for i=1 to len(c) un=mid(c,i,1) if un="," then un="." n=n&un next virg2point=n end function ''''''''''''''''''''''''''' sub loadettracenmea segnmea=0 ' msgbox "tracenmea" ' nmea nbnmea=0 xpre="" ypre="" fo.writeline "<Placemark><name>TrackPoints</name><description>qstarz </description>" 'fo.writeline " <styleUrl>#default+nicon=0x467+hicon=0x477</styleUrl>" fo.writeline " <styleUrl>#tracenmea</styleUrl>" fo.writeline " <!-- debut de ligne nmea -->" fo.writeline " <LineString><tessellate>" & tessellate & "</tessellate><altitudeMode>relativeToGround</altitudeMode> <coordinates>" set fnmea=fs.opentextfile(nmea ,1) while not fnmea.atendofstream li=fnmea.readline likeep=li if imprimergpslu then fo.writeline "<!-- nmea==" & li & "== -->" if 1=instr(li,"$GPRMC") then ' prendre date for i=1 to 9 li=mid(li,instr(li,",")+1) if i=7 then vitesseq=mid(li,1,instr(li,",")-1) vitesseq=mid(vitesseq,1,instr(vitesseq,".")-1)&mid(vitesseq,instr(vitesseq,".")+1,1) vitesseq=int(1.852*vitesseq)/10 vitessekmh=int(vitesseq) ' fo.writeline "<!--vitesse kmh=" & vitessekmh & " " & likeep & "-->" end if next 'i darev=mid(li,1,instr(li,",")-1) da="20"&mid(darev,5,2)& mid(darev,3,2)&mid(darev,1,2) end if if 1=instr(li,"$GPGGA") then li=mid(li,instr(li,",")+1) da=da&mid(li,1,instr(li,".")-1) if len(da)<>14 then msgbox "nmea pas 14 " & vbcrlf & da dateactgmt=datevb(da,10) dateactloc=locale(dateactgmt) if danslestemps (77,dateactgmt) then if gmtnmeadep=-1 then gmtnmeadep =dateactgmt ' msgbox "dep nmea gmt mis a " & dateactgmt & vbcrlf & "baliose deb=" & gmtbalisedeb & vbcrlf & " balisefion" & gmtbalisefin end if ' msgbox "da=" & da li=mid(li,instr(li,",")+1) ' msgbox da n=instr(li,",") Y=mid(li,1,n-1) li=mid(li,n+1) n=instr(li,",") NS=mid(li,1,n-1) li=mid(li,n+1) if NS<>"N" then Y="-" & Y ' n=instr(li,",") X=mid(li,1,n-1) li=mid(li,n+1) n=instr(li,",") EW=mid(li,1,n-1) li=mid(li,n+1) if EW<>"E" then X="-" & X ' msgbox da & vbcrlf & y & vbcrlf & x nbnmea=nbnmea+1 cetindice=indice(dateactgmt) tabvitesse(cetindice)=vitessekmh if cetindice>lastindice then lastindice=cetindice fo.writeline "<!-- enregistre:" & vitessekmh & " en indice=" & indice(dateactgmt) & "-->" if xpre<>"" then end if '00227.0868 xfrac="0,"&mid(x,7) xmin= mid(x,4,2) xdec=0+xmin+xfrac xearth=mid(x,1,3)+xdec/60 fo.writeline "<!-- Gmt gps:" & dateactgmt & " mssec:" & int(dateactgmt *24*3600*1000) & " indice:" & indice(dateactgmt) & " vitesse:" & vitessekmh & " x=" & x & " xfrac=" & xfrac & " xmin=" & xmin & " xdec=" & xdec & " earth=" &xearth & "-->" yfrac="0,"&mid(y,6) ymin=mid(y,3,2) ydec=0+ymin+yfrac yearth=mid(y,1,2)+ydec/60 'msgbox da & vbcrlf & dateheuredeb& vbcrlf & dateheurefin segnmea=segnmea+1 fo.writeline virg2point(xearth) & "," & virg2point(yearth) & "," & altitudenmea xpre=x ypre=x end if 'danslestemps end if wend fo.writeline "<!-- fin de " & segnmea & " traceenmea -->" fo.writeline "</coordinates></LineString></Placemark>" fnmea.close end sub ' ----------------------------------------- sub trajet 'balises geotraceur fo.writeline "<Placemark><name>TrackPoints</name>" fo.writeline " <description>ligne reliant les points de la balise</description>" fo.writeline " <styleUrl>#Couleurtracebalise</styleUrl>" fo.writeline " <LineString><tessellate>" &tessellate & " </tessellate><altitudeMode>relativeToGround</altitudeMode> <coordinates>" for ni=1 to litoutsave if tout(ni)<>"" then d0=instr(tout(ni),";") d1=instr(d0+1,tout(ni),";") d2=instr(d1+1,tout(ni),";") d3=instr(d2+1,tout(ni),";") fo.writeline mid(tout(ni),d2+1,d3-d2-1) & "," & mid(tout(ni),d1+1,d2-d1-1) & ","& altitudebalise end if next 'ni fo.writeline "</coordinates></LineString></Placemark>" end sub function critique(a) ' pour l'éra diquer end function