Written by:
Ann
Last updated: 04/07/2019 09:54:32

In this guide we will show you how to import two shape (zipped) files and perform some spatial analysis.

Time to complete: 20 mins.

Step 1 - Download Files

Nuclear Reactors 2011 [1]

WorldBorders.zip [2]

Step 2 - Click on Maps section and create NEW map

Name your new map and save

Step 3 - Import Data and add to Map

When you try to load a map without any layers attached you get the below window


Choose the create / Import button (This is accessible on the map using the gears button on the layer tree view

Choose Import



Drag and drop to the DnD area the 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 filename (choose 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 gray polygons

Step 4 - Spatial Analysis
Click on the spatial analysis button
A slide out with the spatial analysis wizard will appear from the right
This is a powerful wizard with multiple functions

  • Select Layer: Choose the layer from which to get results
  • Spatial function: 6 built in spatial function
  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 -

Step 8: Advanced.

  • Update radius: Distance for Buffer (enabled on buffer analysis) options for m, km and miles
  • Geometry source:   Select a feature Select multiple features  Compare layers
  • Select Area Type:  (enabled on multiple feature select)   Freehand select   Circle select  Box select
  • Secondary Layer:  (enabled on Compare Layers select)  - When comparing layers, choose the secondary layer to compare

Step 5: Intersects

Lets use the the wizard to select all the Nuclear Stations in France


  1.   Click on France to select the country polygon (it should highlight)
  2.   Select output layer (NuclearReactors2011) in select layer drop down
  3.   Select Intersects tools in Spatial function choice
  4.   Select the Select a feature tool
  5.   Click Generate script - this will generate the required SQL output all the nuclear power stations that intersect with the France country polygon
  6.   Run 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


Step 6:  Overlaps, Within, Contains, Touches

To perform any of the above spatial analysis just follow the process in Step 5 but choose your applicable option from the Spatial Function section

Step 7: 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 5 only this time set a buffer radius (will be enabled if 'buffer select' is chosen)


In this query I have selected a random power station in France and set a 1000 Km buffer zone.

This results in only the resulting answers being shown on the map


Step 8: 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 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


Lets 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.


Author: David McQuillan

Published Date:  11/05/17 

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

[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.