Written by:
Last updated: 04/07/2019 09:57:22

In this guide we will show how you how to join two layers by a shared Attibute

Time to complete: 5 mins.

Files required:

Election data and US Counties Data**

1: Create New Map

2: Download data from Election data and US Counties Data

The zip file contains a US counties Shape file and a csv file containing 206 Us election results, the datasets contain a shared column for fips county code allowing them to be joined into a new dataset by adding the data columns from the CSV to the geometry data in the Shape file. We have also included a CSVT file which defines the format of the corresponding CSV columns, this will ensure the CSV columns are imported with the correct data types. For more information on this see our CSV help page.

3: Open your new map and import the zip file

If your map has no layers you will be greeted with this widow explaining how to add data, choose the Create/ Import button. If you don't see this window use the gears button in the layer tree window and select the Create New layer button

Select Import Layer

Drag and drop the downloaded zip file into the central panel

The zip file will be extracted and you will be able to choose the names for your imported layers.

We detect all applicable settings for imported Shape files but CSV file must be configured as to projection (see here for more information on projection systems) and data type.

When importing CSV files by default Azimap tries to be clever and auto detect column types, mostly this is correct but when a CSV is supplied with a CSVT file we should untick "Let us guess column formats". The CSV file also contains no spatial data, you can choose any geometry type you like in the dropdown list, I have chosen point.

Click Save and your layers should import in under a minute. When you receive your import success email refresh the map to see your new layers.

Map after successful import

4: Join data

Select Join Data to activate the Join Data tool

Our Join data tool will display as this when first selected. This tool has a few sections which we will explain in turn,

Initially you must choose two layers on the the map to join. Select "UScounties" as layer 1 and "US 2016 County Level Presidential Results" as layer 2.

Available Join types are as above. See our Join data options help page for full explanations of each. For this dataset join we recommend Left join.

Select the columns in each dataset that have matching data, Columns must have the same datatype, the type is displayed in icon format for each attribute. The join column for layer 1 = "fips" and for layer 2 = "combined_fips"

Choose which dataset you would like to keep the geometry from. In this case only the US counties dataset has a geometry so we choose it.

Choose columns to keep for each layer, you must choose at least one from each layer.

Add a column suffix  to the second joined layer.

Set the preview size, choices are 10, 100, 500. Default is 100 records.

The fully ready to join tool should look something  like the above, Click Join and wait a few seconds for results preview

5:  Preview Joined data

If the join is successful you will get the above message with the total joined results.

The preview data will display in data panel. At this point the join is purely temporary. To save the joined data click the "Save as a new layer" btn 

Choose a name for your new layer

Click Save. Your new layer will be imported and the map will refresh.

6: Style new layer (Optional)

Style your layer to make the most of the newly joined data. We styled a thematic map using the "per point diff joined" column resulting in the following map.

For advice on how to create a choropleth map please see our guide.

That's it - Your data is joined

If you haven't signed up yet go to the Azimap website and click register.

Enjoy joining your data in the future and thanks for reading the guide.