Thursday, April 17, 2014

Walmart spread in USA - intro 2

Idea: To use Tile Mill to show the location of Walmart in USA.

Limitations: The data for the project was downloaded from Flowing Data . However, i cannot provide you with the data for this project as the data is not freely available. You can download the data from Agg data at a price. The cheaper and better alternative is to subscribe to flowing data tutorials and download the data from the flowing data itself. If possible i will try to download some geocoded data and provide it to the reader but for now you will have to find your way out of this situation.

Step 1: Download

Tile Mill - its an open source project. You can also browse the documentation section, which are very well written. 

Step 2: Data 

The data file is a .csv file with 7 columns.In order to plot the data in tile mill you would need to geocode the data. The data should contain columns lattitude and longitude, else you will get an error.

Step 3 : Power up your Tile Mill

An important note to keep in mind is that by default mapbox will create a folder under your user /documents/mapbox/projects/<name of the project>. Every time you create a new project it will create a new folder under mapbox /project. Hence in case you want to ad images or svg you need to save them under the project folder else you will not be able to use them in Tile Mill.

Open tile mill and click on new project enter a file name and click add, tile mill create a folder on screen double click and open the project. You see that tile mill will use default country data and launch a world map. Users do have the flexibility to change the map but for now lets keep it as it is.

The main screen is divided into 3 parts. The left most part is a menu which can also be used to add data(layers), labels, legends etc. The center contains the world map along with the data once you load it. The right most part contains the css sheet which is mainly used to edit style sheets. 

Step 4 : Upload Data

to upload the data , save the data in a csv format in a drive or desktop. Click on the last icon on the left most part of tile mill(image for reference). Tile mill will now open a new window. Now enter the ID click browse followed by save and style. The save option will only save the data but save and style will plot the data as well.

You would now be able to see the data points plotted on the map. As you zoom you will be able to observe the data at granular level.

Step 5: Customizing 

In order for the map to look like the image on the very top you will have to add different colors. You can easily do this by selecting the colors from palette at the bottom of the right most part of tile mill.As you select different colors, and save, for the background, borders and maps you will observe that the changes will simultaneously take place on the map itself. The CSS code will also change. If you know how to code you can make changes directly in the code window.

Step 6: Export 

In order to export the data click on the export drop down and select the format in which you would like to export. I usually use png or pdf. Now tile mill will allow you to edit the map and select the area of the map that you would like to export.Sometimes you will have issues selecting the area, i dont have a solution for that.

If you go back to the same export drop down you will observe view exports this will then allow you to save it once the saving process is complete.Tile Mill will also tell you where it has stored the image. Lastly, you can open an account on mapbox and upload your maps by exporting the format MBTiles. I have never used xml but you can explore that option as well.


No comments:

Post a Comment