Written by:
Naimh
Last updated: 02/06/2021 11:35:49

How to Analyse Your Data Using The Spatial Analysis Tool

Spatial analysis is a type of geographical analysis used to explain patterns of human behaviour and its spatial expression in terms of mathematics and geometry, i.e. locational analysis

In this guide we will show you how to analyse your data using the Azimap Spatial Analysis tool.  We’ll use a working example, importing two shape (zipped) files of nuclear reactors, and performing some spatial analysis on them.

Time to complete: 20 mins.

Contents


1.    Getting started

1.1  Download files

1.2  Create a new map

1.3  Import data and add to map

2.    Spatial analysis

2.1  Functions of the spatial analysis wizard

2.1.1      Explanation of basic functions

2.1.2      Explanation of advanced functions

2.2  Basic and advanced functions in use

2.2.1      Intersects

2.2.2      Overlaps, Within, Contains, Touches

2.2.3      Buffer select

2.2.4      Advanced




1.    Getting started

1.1.  Download files

Nuclear Reactors 2011 [1]

WorldBorders.zip [2]


1.2.  Click on MAPS section and CREATE MAP




Press the CREATE MAP button.

When you enter the map creation wizard, name your new map and click NEXT.


1.3.  Import data and add to map

The next step in the map creation wizard is 'Add Datasets to Map'. You have a few options here: You can create a new layer to add to your map, you can choose to add one or many of your existing layers to your map, or you can create an empty map with no layers.


In this case however, we'll choose the CREATE LAYER button (this is also accessible on the map using the gears button on the layer tree view).  You'll be prompted with the below pop-up.  Select YES, GO.




This will automatically bring you to the first step of the CREATE DATASETS wizard.

Choose CREATE OR CONNECT NEW DATASETS WITH AZIMAP.



In the next step of the wizard, you'll choose the AZIMAP option below





·         Drag and drop earlier downloaded zip files (we support zipped files or non-zipped).




·         After upload, the projection is automatically chosen and a suggested name is added for each new layer based on the file name (change this to any name you would like).





·         Click SAVE to import the layer (this may take a few seconds - the larger the datasets the longer it takes).

·         After successful import, the map will load with the default styling (little red squares) and grey polygons.




2.    Spatial analysis


Click on the ANALYSIS button.





An Analysis sub-menu will appear where you can pick SPATIAL ANALYSIS.





·        The spatial analysis wizard will begin.


    

       





2.1.  Functions of the spatial analysis wizard


2.1.1.     Explanation of basic functions


This is a powerful wizard with multiple functions.


  • Select layer - Choose the layer from which to get results
  • Spatial function - 6 built-in spatial functions, as follows:

1.      Intersects  Returns a result if two geometries "spatially intersect in 2D" - (share any portion of space).

2.      Buffer  Returns results within a given distance from the input geometry.

3.      Overlaps  Returns a result if the geometries share space, are of the same dimension, but are not completely contained by each other.

4.      Within  Returns a result if the geometry A is completely inside geometry B.

5.      Contains  Returns a result if and only if no points of B lie in the exterior of A, and at least one point of the interior of B lies in the interior of A.

6.      Touches  Returns a result if the geometries have at least one point in common, but their interiors do not intersect.

Azimap utilises Postgis for its spatial analysis (Postgis Reference). Other functions can be utilised if entered directly into the query window (further details below).

2.1.2.     Explanation of advanced functions

·         Update radius - Distance for buffer (enabled on buffer analysis) options for m, km and miles.

·         Geometry source – 

o     Select a feature

o     Select multiple features

o     Compare layers

·         Select area type (enabled on MULTIPLE FEATURE select)

o     Freehand select   

o     Circle select 

o     Box select

·         Secondary layer (enabled on COMPARE LAYERS select) - When comparing layers, choose the secondary layer to compare.


2.2.  Basic and advanced functions in use

2.2.1.     Intersects

Let’s use the wizard to select all the nuclear stations in France.



 

a.    Click on France to select the country polygon (it should highlight)

b.    Select OUTPUT LAYER (NuclearReactors2011) in SELECT LAYER drop down

c.     Select INTERSECTS TOOLS in SPATIAL FUNCTION choice

d.    Select the SELECT A FEATURE tool

e.    Click GENERATE SCRIPT - this will generate the required SQL output all the nuclear power stations that intersect with the France country polygon

f.      Click EXECUTE FILTER to see your results



You can view the results in tabular format by clicking the VIEW DATA button


  


VIEW DATA shows the filtered 46 power stations in France.

The SAVE RESULT AS A NEW LAYER button does as it says giving you the option to add it to the map or just into your data catalog.




Added to the map it should look like below with the new 'FrancePower' layer added.



1.    

2.    

2.1.    

2.2.    

2.2.1.    

2.2.2.     Overlaps, Within, Contains, Touches

To perform any of the above spatial analysis just follow the process in step 2.2.1 but choose your applicable option from the SPATIAL FUNCTION section.




2.2.3.     Buffer select

Creating selection buffers is slightly different - you must select the radius of your buffer after choosing the BUFFER SELECT function.

Process the query as per step 2.2.1 only this time set a buffer radius (will be enabled if BUFFER SELECT is chosen).




In this query we’ve selected a random power station in France and set a 1000 Km buffer zone.

The outcome is, the only the resulting answers being shown on the map.



2.2.4.     Advanced

The wizard creates query SQL for you, however if you know SQL syntax you can write your own advanced select queries by either editing the output of the wizard or choosing the ADVANCED RADIO button (above the RESET button).




NOTE: Strings should be surrounded by single quotes.  Double quotes are used by us to signify table names and column names.


The SQL query box can now be typed into - to search for reactors of type 'Pressurised Water'.

select

               *

from

               "NuclearReactors2011"

Where type = 'Pressurised Water Reactor'



or for reactors that are gas cooled.


select

               *

from

               "NuclearReactors2011"

Where type like '%Gas%'




We can combine wizard generated queries with our own amendments.

Generate the intersect query from set 5.



This results in the below filtered dataset.




Let’s amend the query by adding year of construction between 1970 and 1979 inclusive (we will utilise the SQL BETWEEN command which is inclusive).


select

               *

from

               "NuclearReactors2011"

where

"built" BETWEEN 1970 AND 1979 AND

               ST_Intersects("NuclearReactors2011".the_geom,


We have added a new line into the wizard generated query creating a new 1st WHERE clause and placing the spatial portion after an AND clause.



 

This results in the more filtered dataset showing rectors built in the 1970's.




Let’s check the 1980's.

select

               *

from

               "NuclearReactors2011"

where

"built" BETWEEN 1980 AND 1989 AND

               ST_Intersects("NuclearReactors2011".the_geom,




Lots of building going on in France in the 1970s and 1980s!

Thanks for reading the guide and we hope you get some great analysis from your data.

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


--------------------------------------------------------

[1] (Original file downloaded from Sharegeo Open - NuclearReactors2011 "This data is made available under the Public Domain Dedication and License v1.0 whose full text can be found at opendatacommons.org"

[2] Dataset sourced from thematicmapping.org

The original shapefile (world_borders.zip, 3.2 MB) was downloaded from the Mapping Hacks website

The dataset is available under a Creative Commons Attribution-Share Alike License.