MagicMirror² v2.12.0 is available! For more information about this release, check out this topic.

Longitude and latitude in default config



  • Hello,

    I am using and testing quite a few modules on my mirror that require longitude and latitude. Each module has written their own solution for this in the config section of the module. That is perfectly done.

    Wouldn’t it be a good idea to add them to the core config? It sounds to me that longitude and latitude are regular setting like time format, language, a.s.o. Then add in documentation that you can find the latitude and longitude via https://www.latlong.net/ or another site.

    I am willing to write text if needed.

    George


  • Project Sponsor Module Developer

    @Travelbacon said in Longitude and latitude in default config:

    Wouldn’t it be a good idea to add them to the core config?

    You can already do this. I created vars for my latitude and longitude. I’ve been doing this for true and false, too, because I am THAT lazy.

    var t = true;
    var f = false;
    
    var myLat = "35.574794";
    var myLong =  "-70.112454";
    
    var config = {
        address: "0.0.0.0",
        port: 8080,
        ipWhitelist: [],
        language: "en",
        timeFormat: 12,
        units: "imperial",
    

    Then when a module calls for latitude and longitude you can just enter myLat and myLong as you suggested/requested. Test shows my weather using this.

    Screenshot from 2020-04-18 17-23-20.png



  • I think I was a bit unclear. The thing is that every module uses its own variable names for longitude and latitude. By moving the variable out the config object as a variable, every module still requires their own variable to be set. While longitude and latitude are ‘global’ settings for the MagicMirror like language, and are not module specific like an API code.

    I think it would be better to make long and lat a default config and document it.



  • @Travelbacon , I support your idea. True, the suggestion of Mykle1 works, but it’s not a standard.

    @MichMich, Would be great to have longitude and latitude as default parameters in the config.js. In this way you would set your location once and all the modules that require it can use it.


Log in to reply