If you're a content developer and are looking to make your own real-world routes in Train Simulator, then you may find the Google Maps Overlay feature included with Train Simulator of use in your endeavours. We'll walk you through setting up the feature below but, before you begin, you need to be aware of some important information relating to the use of the feature:
- The Google Maps API is a pay-to-use service and you must have a valid credit or debit card account set up to use their services. When you set-up your account, you will usually be given some free credit for a limited period to use on your project. Google services are provided under licence and their rules regarding the use of their services are controlled and managed by Google and we have no connection with them in any way nor can we deal with any concerns or queries relating to transactions or anything connected with their service.
- The Google Maps API feature is an unsupported community-requested feature of Train Simulator. This means we are not able to help you with any issues relating to configuration or using the feature over and above what is provided in this article. If a fault arises that is not the result of a fault with Train Simulator, you will need to undertake your own actions to resolve these as they will likely be related to Google's processes and/or requirements for configuration and you will need to discuss issues relating to API Keys directly with them.
The first step in getting started is to ensure you have a payment account associated with your project as you will need to pay to use Google Maps in Train Simulator after any limited trial period. Once you have a project created and a payment account assigned, you can continue with the steps below.
The Google Maps API needs to be configured in a very specific way and you should follow along with the step-by-step instructions below to set up everything properly in the Google Cloud Platform:
- Navigate to the Google Cloud Platform page for your Project (you can select the Project, if you have more than one set up at the top next to the words 'Google Cloud Platform')
- Click Library from the left-hand menu to view the range of APIs available.
- Type "Maps" (without the quotes) and click on Maps Static API to view its details.
- Click Enable to enable Maps for your project.
- Return to the Project Dashboard by clicking back then click Credentials to create your API Key.
- Click Create Credentials at the top of the page and select API Key from the drop-down menu then click Close.
- Your new API Key is created and displayed under the section marked API Keys. You should see a yellow warning triangle next to your key to advise that your key is not restricted. This is normal and just means you haven't restricted your key yet.
- Note: We recommend you leave your key unrestricted but it's important you keep your key private and do not share it with anyone. Protect it like you would with the password to your bank account.
- Check the Key Restrictions by clicking on the API Key you just created. Under Application restrictions it should be set to None and API Restrictions should be set as Don't restrict key.
- Click OAuth Consent Screen to view the Open Authentication Consents for your project. Click Edit and under Application name, it should state Train Simulator. Your email address should display under Support Email and all other boxes should be empty. The Token grant rate should be set as 1d.
- Return to the Credentials page and click your API key again to edit it's credentials. Select the contents of the API Key box in the upper right and press Ctrl + C to copy it into your clipboard.
- Load Train Simulator 32-bit and select the Settings option in the upper right.
- Click Tools and then Google Maps.
- Paste (Ctrl + V) your key into the Google Maps API section and set the Map Resolution to 1280 x 1280, Map Type to Hybrid and Tiles to 3 x 3 leaving the Zoom level at default.
- Click Save and then click Build from the main menu.
- Click on an official Dovetail Route and, once loaded, use Ctrl + G to activate the Google Maps overlay to confirm it is working. Google Maps uses the real world Latitude and Longitude values set for your route so ensure you have these configured properly when creating your route.
Note: At some point during the above, you may be asked to generate a URL Signing Secret which are not used by Train Simulator. These are typically used on web pages but you will have to create one anyways. Just follow the on-screen instructions to complete the process.
Documentation pertaining to the Static Maps API can be found on the Google Maps Platform at https://developers.google.com/maps/documentation/maps-static/intro