Skip to content

Map Settings Guide ​

TrailSnap uses map services to display the geographical distribution of photos (Footprint Map). In order to use the map function normally, you need to apply for and configure the API Key of the map service yourself.

Why configure an API Key? ​

Map service providers (such as Tianditu, Amap, Baidu) usually require developers to apply for an independent API Key (or Token) to call their services. Configuring your own Key has the following benefits:

  1. Stability Guarantee: Have an independent daily call quota to avoid map loading failure due to shared Key reaching the limit.
  2. Compliance and Security: Comply with the terms of use of the map service provider, and the Key is managed by yourself, which is more secure.

Tianditu is a national geographic information public service platform with authoritative data and full coverage. It provides a relatively generous free quota for individual developers and is the default and recommended map service provider for TrailSnap.

Steps to Get API Key (Tk) ​

  1. Register Account
    Visit the Tianditu Official Website, click "Register" in the upper right corner, and complete personal account registration. If you already have an account, log in directly.

  2. Enter Console
    After logging in, click "Development Resources" at the top of the page, select "Console", or visit the Tianditu Console directly.

  3. Apply to be a Developer
    If it is your first time using it, you may need to click "Apply to become an individual developer" and complete simple real-name authentication.

  4. Create Application

    • Click "Application Management" in the left menu bar.
    • Click the "Create New Application" button.
    • Fill in application information:
      • Application Name: Fill in TrailSnap or any name you like.
      • Industry Category: Select according to the actual situation (e.g., "Life Service").
      • Application Type: select Server Side. TrailSnap Server calls Tianditu on behalf of browsers, desktop and mobile apps.
      • IP whitelist (optional): use the public outbound IP of TrailSnap Server, not the device accessing the app.
  5. Get Key
    After successful creation, you will see the application just created in the application list. Copy the string of characters corresponding to the Key column (usually called tk).

  6. Fill in Settings
    Return to the TrailSnap system:

    • Go to Settings → Maps and locations (地图与地点).
    • Ensure the map provider is selected as Tianditu.
    • Paste the copied Key into the API Key input box.
    • Click Verify and save.
  7. Get Multiple Keys and Configure

    • Tianditu allows you to create multiple Keys for different applications or scenarios, and each Key has an independent call quota.
    • To prevent excessive calls, you can configure multiple Keys in TrailSnap, and the system will randomly select one to load the map.
    • This is very useful when you need to use different Keys in different environments (such as local development, test environment, production environment).

2. Amap (Gaode Map) ​

Amap is not currently supported in the settings interface. Use a Tianditu server-side Key.

3. Baidu Map ​

Baidu Map is not currently supported in the settings interface.

4. Offline Map Data ​

TrailSnap supports offline reverse geocoding. Even without an internet connection, it can resolve the city and region based on the GPS coordinates of photos. This feature relies on offline city data files.

Feature Description ​

You can find the Offline Map Data management area under Settings → Maps and locations (地图与地点).

Download Country Data ​

  1. In the Download Country Data area, select the country you need (e.g., "China") from the dropdown menu.
  2. Click the Download button.
  3. The system will automatically download and process the city data for that country in the background. Once completed, the country's data will appear in the Downloaded Data list below. To apply it to existing photos, rerun metadata extraction under Settings → Background tasks (后台任务).

Upload Custom Data ​

If you cannot download directly through the system, or have custom city data files, you can manually upload them using this feature.

  1. Prepare a city data file in CSV format. The file must include the following header fields:
    • longitude: Longitude
    • latitude: Latitude
    • country: Country Code (e.g., CN, US)
    • admin_1: Admin Level 1 (e.g., Province/State)
    • admin_2: Admin Level 2 (e.g., City)
    • admin_3: Admin Level 3 (e.g., District/County)
    • admin_4: Admin Level 4 (header required; values may be empty)
  2. Click the Click to Upload CSV File button and select your file.
  3. After upload, the data appears in the list. To apply it to existing photos, rerun metadata extraction under Settings → Background tasks (后台任务).

Manage Downloaded Data ​

In the Downloaded Data list, you can:

  • View all currently installed country/region data.
  • Click the Download Icon next to the filename to download the CSV data file from the server to your local computer for backup or inspection.

FAQ ​

Q: Map loads blank or grid?
A:

  1. Please check if the API Key is copied correctly, be careful not to include spaces.
  2. Confirm the Tianditu application type is Server Side.
  3. If an IP whitelist is enabled, enter TrailSnap Server's public outbound IP.
  4. Use the Test control in the map settings; the request is made by TrailSnap Server.

Q: What if the Tianditu quota is not enough?
A: The free quota for individual developers is usually sufficient for daily browsing needs of personal albums. If it really exceeds the limit, you can consider registering multiple accounts or upgrading to enterprise certification.

Q: Offline map data download failed?
A: It may be due to network connection issues preventing connection to the data source (GeoNames). You can try again later, or manually download the data and import it using the "Upload Custom Data" feature.