This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: make sure that your current directory is the one that contains the TileMill-specific node.exe | |
cd "C:\Program Files (x86)\TileMill-v0.10.1\tilemill" | |
:: select the TileMill project name | |
SET TM_PROJECT=chaco | |
:: I want to export to MBTiles so I need to specify where to render the file | |
SET TM_FILE=%~dp0/%TM_PROJECT%.mbtiles | |
:: render the project | |
node index.js export %TM_PROJECT% %TM_FILE% --format=mbtiles | |
:: upload the MBTiles file to your MapBox account. | |
:: you will need to specify your own <syncAccount> and <syncAccessToken> values | |
node index.js export %TM_PROJECT% %TM_FILE% --format=upload --syncAccount=<syncAccount> --syncAccessToken=<synchAccessToken> |
The one important part that was not covered in the post was the authentication method.
As part of the TileMill upload process, you are required to set
--syncAccount
and --syncAccessToken
parameters. This information is discoverable if you dig deep into TileMill caches. To make it more easily accessible I created a TileMill plugin called tilemill-sync-info
. It simply exposes your sync information on the Application Settings page...Now you can copy/paste that information into your batch upload scripts.
Productivity Tip: I use TileMill for both work and personal projects and host these projects on separate work and personal MapBox accounts. To keep from having to constantly reauthorize TileMill between these two accounts prior to upload, I simply create batch upload scripts for each TileMill project with account-specific upload credentials. Then I can author my projects in TileMill and when I am ready to upload to MapBox I simply run the appropriate project upload script and it sends my new map to the correct account.
I was inspired to create a TileMill plugin based on @willwhitedc's MapBox presentation at JS.Geo13 (#jsgeo13)