Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. maps mit Streckendarstellung

    NEWS

    • Neues Video "KI im Smart Home" - ioBroker plus n8n

    • Neues Video über Aliase, virtuelle Geräte und Kategorien

    • Wir empfehlen: Node.js 22.x

    maps mit Streckendarstellung

    This topic has been deleted. Only users with topic management privileges can see it.
    • bahnuhr
      bahnuhr Forum Testing Most Active @liv-in-sky last edited by

      @liv-in-sky sagte in maps mit Streckendarstellung:

      leaflet

      leaflet hatte ich hinbekommen.
      Was nicht geklappt hatte war das ganze bei google maps.

      Hab ich aber jetzt auch hinbekommen.

      Danke dir trotzdem.

      Stelle code mit google maps dann mal ein.

      liv-in-sky 1 Reply Last reply Reply Quote 0
      • liv-in-sky
        liv-in-sky @bahnuhr last edited by

        @bahnuhr sagte in maps mit Streckendarstellung:

        Stelle code mit google maps dann mal ein

        das wäre super - braucht man da ein google login ?

        bahnuhr 1 Reply Last reply Reply Quote 0
        • bahnuhr
          bahnuhr Forum Testing Most Active @liv-in-sky last edited by

          @liv-in-sky sagte in maps mit Streckendarstellung:

          google login ?

          ja, google key brauchst du.
          Ohne klappt es nicht.

          liv-in-sky 2 Replies Last reply Reply Quote 0
          • liv-in-sky
            liv-in-sky @bahnuhr last edited by

            @bahnuhr

            ich hasse das bei google - macht alles so mega komplex

            1 Reply Last reply Reply Quote 0
            • liv-in-sky
              liv-in-sky @bahnuhr last edited by liv-in-sky

              @bahnuhr

              langsam nimmt es form an - paar kleinigkeiten sind noch zu machen - danke für das animieren und einstellen deiner scripte- hätte sonst wohl nicht damit begonnen

              rot: blitzer
              grün : wo bin ich gerade
              schwarz: die tour
              plus die temperatur für winter(glatteis)

              alles online verfolgbar (traccar) - lasse mir das u.a. im auto anzeigen

              Image 084.png

              bahnuhr 1 Reply Last reply Reply Quote 1
              • bahnuhr
                bahnuhr Forum Testing Most Active @liv-in-sky last edited by

                @liv-in-sky
                auch gut.
                Stell doch dein Script mal ein.

                Was ist traccar ?

                liv-in-sky 1 Reply Last reply Reply Quote 0
                • liv-in-sky
                  liv-in-sky @bahnuhr last edited by

                  @bahnuhr traccar ist ein client auf dem handy und ein server im netzwerk (free) für geolocation

                  das script enthält alle meine coordinaten - und ist schnell zusammengebastelt und war nicht zur verbreitung gedacht

                  falls du es gerne hättest - gerne über email (dann im chat angeben)

                  bahnuhr 1 Reply Last reply Reply Quote 0
                  • bahnuhr
                    bahnuhr Forum Testing Most Active @liv-in-sky last edited by bahnuhr

                    @liv-in-sky

                    alles klar
                    mich würde insbesondere die Punkte:
                    Kreis, Blitzer, Temp
                    interssieren.

                    Hast PN. Danke vorab.

                    liv-in-sky 3 Replies Last reply Reply Quote 0
                    • liv-in-sky
                      liv-in-sky @bahnuhr last edited by liv-in-sky

                      @bahnuhr

                      ok - die blitzer sind hier gemacht: https://forum.iobroker.net/post/512330

                      temperatur ist einmal ein sonoff mit messung daheim - und netatmo-crawler - adapter

                      das blockly ist in einem ganzen system integriert - ich schreibe alle routen in jsons um die zur abrechnung (fahrkosten) zu haben - daher nur als bild - darin wird auf eine distance von 500 meter die koordinaten in ein json gspeichert, welches dann die html datei mit den circles erzeugt

                      Image 085.png

                      die funktion leaflet-writing schreibt ein fortlaufendes json für all dir koordinaten

                      let jarry=JSON.parse(getState("0_userdata.0.CONTROL-OWN.TRACCAR.LeafletJSON").val);
                      
                      jarry.push({
                                "pos":pos,
                                "stamp":stamp,
                                "geozaun":geozaun
                      
                      
                      })
                      
                      setState("0_userdata.0.CONTROL-OWN.TRACCAR.LeafletJSON",JSON.stringify(jarry));
                      

                      die funktion leaflet-draw macht das eigentliche html file und speichert das

                      hier zum download - kenntwort schicke ich dir
                      am besten du öffnest es mit notepad++ , damit alle zeichen richtig übersetzt werden

                      leaflet-draw.7z

                      P 1 Reply Last reply Reply Quote 0
                      • liv-in-sky
                        liv-in-sky @bahnuhr last edited by liv-in-sky

                        @bahnuhr

                        traccar adapter sieht so aus:

                        Image 086.png

                        netatmo-crawler:

                        Image 087.png

                        1 Reply Last reply Reply Quote 0
                        • liv-in-sky
                          liv-in-sky @bahnuhr last edited by

                          @bahnuhr

                          das beste, was ich bis jetzt gefunden habe, um text darzustellen - mit transparenten hintergrund

                          Image 088.png

                          im style tag:

                            .my-label {
                            @charset "utf-8";
                              position: absolute;
                              width:150px;
                              font-size:35px;
                          	background:transparent;
                          }
                          

                          einbinden im script tag:

                          var marker = new L.marker([50.539, 11.99], { opacity: 0.01 }); //opacity may be set to zero
                          marker.bindTooltip('17 °C', {permanent: true, className: "my-label", offset: [0, 50] });
                          marker.addTo(map);
                          
                          1 Reply Last reply Reply Quote 0
                          • P
                            padman @liv-in-sky last edited by

                            @liv-in-sky Mit Begeisterung lese ich grad diesen Beitrag. Könnte ich auch das Password bekommen?

                            liv-in-sky 1 Reply Last reply Reply Quote 0
                            • liv-in-sky
                              liv-in-sky @padman last edited by

                              @padman

                              da sind viele daten drin - habe ein paar geändert - das kennwort ist im chat

                              leaflet-draw-changed.7z

                              1 Reply Last reply Reply Quote 0
                              • K
                                Kanumouse @bahnuhr last edited by

                                @bahnuhr

                                Hi,
                                ich habe heute endlich den Bosch-ebike-Adapter zum Laufen bekommen.
                                Danach wollte ich auf deine Erfahrungen zurückgreifen und habe dein Script und die View importiert.
                                Das bekomme ich leider nicht zum Laufen, ich denke, da fehlt irgend etwas.
                                Wie werden die Objekte/Variablen unter javascript.0 gefüllt?
                                Ich denke, irgend etwas fehlt mir auch in der View?

                                bahnuhr 1 Reply Last reply Reply Quote 0
                                • bahnuhr
                                  bahnuhr Forum Testing Most Active @Kanumouse last edited by

                                  @kanumouse
                                  Da fehlt gar nix.
                                  Läuft einwandfrei.

                                  Bitte alles genau anschauen und versuchen zu verstehen..

                                  K 1 Reply Last reply Reply Quote 0
                                  • K
                                    Kanumouse @bahnuhr last edited by

                                    @bahnuhr
                                    Ich habe mir schon den Kopf zerbrochen, komme aber leider nicht weiter.
                                    Du hast sicherlich recht, dass ich irgend etwas nicht verstehe.

                                    K 1 Reply Last reply Reply Quote 0
                                    • K
                                      Kanumouse @Kanumouse last edited by Kanumouse

                                      @bahnuhr
                                      Hast du vielleicht einen Tipp für mich?
                                      Wenn ich das richtig verstehe, ist mir nicht klar wie die javascript.0.Geräte.Fahrrad.Touren-Variable als JSON gefüllt wird???
                                      Ich weiß nicht, wie die Daten der Trips aus der ebike-Instanz als Ausgangsdaten für den Script verwendet werden, sehe ich offensichtlich nicht durch.

                                      bahnuhr 1 Reply Last reply Reply Quote 0
                                      • bahnuhr
                                        bahnuhr Forum Testing Most Active @Kanumouse last edited by

                                        @kanumouse sagte in maps mit Streckendarstellung:

                                        ist mir nicht klar wie die javascript.0.Geräte.Fahrrad.Touren-Variable als JSON gefüllt wird???

                                        Das ist nicht wichtig, bzw. bei jedem ja anders.
                                        Du musst selber wissen wo deine lat und lon liegen.
                                        Und diese musst du dann per script poly zuweisen.
                                        Um danach eine html zu erzeugen.

                                               // GPS einlesen und der Variablen poly zuweisen
                                                    if (trip < 10) trip = "0" + trip;       // DP bei den Objekten der eingelesen werden soll: bosch-ebike.0.trips.xx.details
                                                    var obj = JSON.parse(getState("bosch-ebike.0.trips." + trip + ".details").val); 
                                                    var end = obj.activityData.length - 1;
                                                    for (var x=0; x<=end; x++) {
                                                        if (obj.activityData[x].lat > 1 && obj.activityData[x].lon > 1) {
                                                            poly = poly + "["+obj.activityData[x].lat+", "+obj.activityData[x].lon+"]"
                                                            if (x < end) poly = poly + ","
                                                        }
                                                    }
                                                    if (logging) log (poly);
                                                // html erzeugen und speichern in /vis.0/xxx.html
                                                    var string = '<!DOCTYPE html>\n<html>\n<head>\n<title>Simple Leaflet Map</title>\n<meta charset="utf-8" />\n'
                                                    string = string + '<link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css"integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="crossorigin=""/></head>\n'
                                                    string = string + '<body>\n<div id="map" style="width: 980px; height: 530px"></div>\n<script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew=="crossorigin=""></script>\n<script>\n'
                                                    string = string + "var map = L.map('map').setView([" + center_gps + "], " + zoom + ");\n"
                                                    string = string + "mapLink = '<a href=" + '"http://openstreetmap.org"' + ">OpenStreetMap</a>';\n"
                                                    string = string + "L.tileLayer( 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {attribution: '&copy; ' + mapLink + ' Contributors', maxZoom: 18,}).addTo(map);\n"
                                                    string = string + 'var polyline = L.polyline([ \n' + poly + '\n], { color: "blue", weight: 3, opacity: .7, lineJoin: "round" } ).addTo(map);\n'
                                                    string = string + '</script>\n</body>\n</html>'
                                                    writeFile("vis.0", "/Routen/" + pfad + trip +".html", string, (error) => {
                                                        if (logging) log('Datei "route.html" gespeichert!');
                                                    });
                                                    setState("javascript.0.Geräte.Fahrrad.Routen.Datei","/vis.0/Routen/" + pfad + trip + ".html");
                                        
                                        K 2 Replies Last reply Reply Quote 0
                                        • K
                                          Kanumouse @bahnuhr last edited by

                                          @bahnuhr
                                          Danke für den Hinweis.
                                          Aber jetzt bin ich richtig verwirrt und ich glaube zu blöd dazu.
                                          Meine lat und lon habe ich in deinem Script an meinem Standort angepasst. Aber mit dem Rest bin ich überfordert, da sich meine AKenntnisse in der Programmierung im Anfangstadium befinden.

                                          1 Reply Last reply Reply Quote 0
                                          • K
                                            Kanumouse @bahnuhr last edited by

                                            @bahnuhr
                                            Zur ERgänzung, so sieht meine importierte View aus.
                                            E-Bike_View.jpg

                                            bahnuhr 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            995
                                            Online

                                            32.1k
                                            Users

                                            80.6k
                                            Topics

                                            1.3m
                                            Posts

                                            javascript
                                            8
                                            76
                                            5446
                                            Loading More Posts
                                            • Oldest to Newest
                                            • Newest to Oldest
                                            • Most Votes
                                            Reply
                                            • Reply as topic
                                            Log in to reply
                                            Community
                                            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                            The ioBroker Community 2014-2023
                                            logo