Mapbox API key

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dave Luo
    New Member
    • Mar 2024
    • 8

    #16
    I have a question about the API: Can I set offset values on longitude and latitude? For example, now in RE, I'm at 25°E, 43°N, but I want to load an image at 27°E, 43°N, which is offset by 2 degrees in longitude.

    Comment

    • eric
      9500 Post Veteran and Administrator



      • Dec 2002
      • 9583
      • NS MP245.4 CNO&TP South District
      • English, SQL
      • General

      #17
      It might work.... you'd have to calculate the offset in meters.
      If you like what you see here at Trainsim.com, be it the discussions and knowledge in the forums, or items available in our library, I hope you'll consider a paid membership to help support keeping the site operating.... Thanks!

      Comment

      • Dave Luo
        New Member
        • Mar 2024
        • 8

        #18
        So how to set the offset... Should I change the URL or edit the settings?

        Comment

        • eric
          9500 Post Veteran and Administrator



          • Dec 2002
          • 9583
          • NS MP245.4 CNO&TP South District
          • English, SQL
          • General

          #19
          Yeah, it's not going to happen... everything's built around the real world coordinates with what gets sent to MapBox...

          You'd need to load your imagery using real world coordinates, and then use TSUtils (part of Route Riter) to move the route to new lat/long coordinates by calculating the number of squares to move in two dimensions.

          Can I ask why you'd want to move imagery to a different lat/long position?
          Last edited by eric; 03-25-2024, 22:53.
          If you like what you see here at Trainsim.com, be it the discussions and knowledge in the forums, or items available in our library, I hope you'll consider a paid membership to help support keeping the site operating.... Thanks!

          Comment

          • Dave Luo
            New Member
            • Mar 2024
            • 8

            #20
            Well, it is due to Goode projection... In areas far away from the central meridian, such as the Far East, the latitude line is severely tilted, leading to a series of problems such as extra miles and sharper curves.

            I know DEMEX can solve this problem by re-projecting .mkr file, but after the re-projection, these markers no longer match the tilted satellite imagery.

            So I want to build my new route near the central meridian. Now I've edited all the longitudes of the markers, and renamed .hgt -- it works well. Then I want to move the imagery.
            Last edited by Dave Luo; 03-25-2024, 23:54.

            Comment

            • eric
              9500 Post Veteran and Administrator



              • Dec 2002
              • 9583
              • NS MP245.4 CNO&TP South District
              • English, SQL
              • General

              #21
              Try adding this to your Settings.txt file -- it will use an alternate projection that is much better for places that are heavily distorted by the Goode projection:

              TsreGeoProjection ( 48.8485 2.29143 -12340224 30290944 )

              The first two values are the geographic center lat lon.

              The last two values are your start position of your route in meters MSTS 0,0...

              X = W_TILE_X_NUMERIC * 2048 + x_coordinate (0-2048m range)

              Y = W_TILE_Z_NUMERIC * 2048 + z_coordinate (0-2048m range)

              ​
              If you like what you see here at Trainsim.com, be it the discussions and knowledge in the forums, or items available in our library, I hope you'll consider a paid membership to help support keeping the site operating.... Thanks!

              Comment

              • Dave Luo
                New Member
                • Mar 2024
                • 8

                #22
                I tried but there was no change... There is "=" in each line of Settings.txt, but this is "( )"... Should I download a new edition of TSRE5?

                Comment

                • Dave Luo
                  New Member
                  • Mar 2024
                  • 8

                  #23
                  Now it works! This should be added in the .trk file of the route rather than settings.txt.... Anyway, thanks very much!

                  Comment

                  • eric
                    9500 Post Veteran and Administrator



                    • Dec 2002
                    • 9583
                    • NS MP245.4 CNO&TP South District
                    • English, SQL
                    • General

                    #24
                    Glad it worked. I know you did a bunch of other work already but this should be a safer and a lot less 'hack' to get the route to look good.
                    If you like what you see here at Trainsim.com, be it the discussions and knowledge in the forums, or items available in our library, I hope you'll consider a paid membership to help support keeping the site operating.... Thanks!

                    Comment

                    • Dave Luo
                      New Member
                      • Mar 2024
                      • 8

                      #25
                      Yeah. It really helps a lot.

                      Somebody told me that I can get the last two values by mutiplying a number between 128 and 4096, not just 2048. He also mentioned that the lower the latitude, the smaller number should be mutiplied. But I don't think so.

                      The last two values seem to only determine where I put the geographic center in MSTS, so I think I can put it anywhere I like, right?

                      Comment

                      • eric
                        9500 Post Veteran and Administrator



                        • Dec 2002
                        • 9583
                        • NS MP245.4 CNO&TP South District
                        • English, SQL
                        • General

                        #26
                        I believe what that last two values is going to do is help calculate the tile numbers used internally, so if you're not planning on merging this with somebody else's route eventually, it won't matter.

                        If there is a chance that you are going to use this route to merge with another, then you would have to make sure the tile naming is consistent or use the function in tsutils to shift everything for naming purposes.
                        If you like what you see here at Trainsim.com, be it the discussions and knowledge in the forums, or items available in our library, I hope you'll consider a paid membership to help support keeping the site operating.... Thanks!

                        Comment

                        • Dave Luo
                          New Member
                          • Mar 2024
                          • 8

                          #27
                          I see. Thank you.

                          Comment

                          • Karthik90
                            Member

                            • Feb 2015
                            • 83
                            • India
                            • English, Hindi, Marathi, Tamil, Malayalam
                            • MSOR

                            #28
                            Hey all ! Need a Help
                            How to solve this Real world Terrain Texture issue, I am using TSRE5_v0.7.012

                            The same terrain image is working fine in TSRE5v0.8004 but the setting hangs a lot.
                            Attached Files
                            Karthik Iyer
                            IRTS FAN
                            MSTS-Indian Railways Player
                            Check IRTS FAN on YouTube.
                            https://irtsfan.weebly.com/
                            http://srv2.weebly.com/

                            Comment

                            • eric
                              9500 Post Veteran and Administrator



                              • Dec 2002
                              • 9583
                              • NS MP245.4 CNO&TP South District
                              • English, SQL
                              • General

                              #29
                              If this is mapbox, the zoom offset value needs to be uncommented in 8.004, and the zoom in the 7.012 URL needs to be adjusted by -1... mapbox made their zoom zero based.
                              If you like what you see here at Trainsim.com, be it the discussions and knowledge in the forums, or items available in our library, I hope you'll consider a paid membership to help support keeping the site operating.... Thanks!

                              Comment

                              • Karthik90
                                Member

                                • Feb 2015
                                • 83
                                • India
                                • English, Hindi, Marathi, Tamil, Malayalam
                                • MSOR

                                #30
                                eric
                                Yes i am using Mapbox API
                                Is this correct
                                imageMapsUrl = https://api.mapbox.com/styles/v1/mapbox/satellite-v9/static/{lon},{lat},-1/{res}x{res}?access_token=xxxxxx
                                If its wrong please guide.

                                Karthik Iyer
                                IRTS FAN
                                MSTS-Indian Railways Player
                                Check IRTS FAN on YouTube.
                                https://irtsfan.weebly.com/
                                http://srv2.weebly.com/

                                Comment

                                Working...