Slides 2: queries, geoprocessing, proximity analysis and

Transcript

Slides 2: queries, geoprocessing, proximity analysis and
Introduction to spatial data
analysis
2
Scuola di Dottorato in Economia, La Sapienza, 2015/2016
Instructors: Filippo Celata, Federico Martellozzo and Luca
Salvati
http://www.memotef.uniroma1.it/node/6524
Associate external data about firms owned by
foreign born entrepreneurs* to the geocoded list
of firms
Table and spatial join
- Add zoneurbanistiche.shp to a blank map
- Add table lezgis16/lezgis16/tablejoin/immig_dt.dbf
and the point layer lezgis16/tablejoin/rm_immig.shp to
- Open and explore the two tables
-Join the dbf table to the point layer and export to
consolidate
- Symbolize the provenience of entrepreneurs
* Istat, Asia archive of firms, 2008, Rome, Firms owned by foreign born,
Industry: firm services > 2 employed
Join table data:
- Add to the workspace
lezgis16/tablejoin/rm_immig.shp and
/immig_dt.dbf
-Spatial join: to associate the value of a layer’s attribute
table to another layer’s attr. tab. based on a spatial relation
- Find the two analogous columns in
the attribute table of rm_immig.shp
and of immig_dt.dbf
- Join rm_immig.dbf TO the attribute
table of the shp: right click ON THE
SHP / Join / Table join (verify)
- Export to consolidate: right click on
the shp / data / export data
- Symbolize the provenience of
entrepreneurs: open the Symbology
menu of the points Shp / Format:
Categories, Unique values / Value
field: Area
-> Associate to the firms’ layer attribute table the name (“denom”) of the zona
urbanistica where the firm is located / Associate to zone urbanistiche the
attributes of firms located within
Selection and queries
- Manual selection
Table and spatial selection and
queries
On the table
On the map
Multiple selections: on the table keep CTRL pressed / on the
map keep the shift key (Maiuscolo) pressed
- Selection queries:
Select by attributes
(=, <, >…)
Select by
location
Select by location:
Intersect
Are within a distance of
Are within
Are completely within
Contain
Completely contain
Have their centroid in
Share a line segment with
Touch the boundary of
Are identical to
Are crossed by the outline of
-To create a layer or shapefile with only the selected
feature
1. Create new layer from selected features: right click
the selected layer / selection / create layer from selected
features
2. Create a shapefile of
the selected features:
right click on the layer
of selected features (1)
/ data / export data (as
shapefile)
3. To export as an
autonomous layer: right
click / save as layer file
Selections
- Create a lyer of the zona urbanistica “centro storico” = select ‘centro
storico’ on the map or in the table / right click on the selected layer /
Selection / Create layer from selected feature (change layer’s name)
- Select all non-individual firms (type = “individ”) = Selection / Select by
attributes / + invert the selection = right click the layer / Selection / Switch
selection (and create a new layer including only the selected features)
- Select all firms owned by Bangladeshies
Proximity analysis (and clustering)
- Selected all firms located in the zona urbanistica (and “source layer”)
“centro storico” = Selection / Select by location / “Target layers features are
completely within the source layer” + switch selection and create new layer
- Select firms with more than 5 employed (Select by attributes, “add08” > 5)
- Select all firms located within 5 Kms from the biggest firm = create biggest
firm layer / Select by location (“are within a distance”)
Proximity = concentration, agglomeration, interaction,
attraction, influence, contagion, interdependency,
similarity, clustering, spatial autocorrelation,
segregation, etc.
-Buffering
Toolbox
Distance (geographic vs. functional)
Euclidean vs. Manhattan vs. Network based
Buffering
Create a buffer of 500 mt from rm_immig.shp
1) Arctoolbox / Analysis / Proximity / Buffer / input feature: rm_immig.shp,
linear unit: 500 mt, dissolve: none
2) Create a shapefile with the buffer output (right click the buffer / Data /
Export data)
Distance and spatial interaction: interaction opportunities
decrease more than proportionally as the distance between
interacting features increases = distance decay function
(tiranny of distance)
cost-weighted distance: ‘cost’ raster (eg land
use, slope)
Inverse distance decay:
b > 1 = eg. 2
(interaction
opportunities are
inversely
proportional to
the square
distance)
Exponential distance decay:
Proximity, interaction and gravitation
Potential interaction of place A and place B is a function of distance
(decay) and the ‘mass’ of interaction opportunities in A and B
Interaction opportunities = P (population, services, activities, etc.)
Gravitational models
Proximity and spatial autocorrelation
First law of geography (Tobler) = "Everything is related to
everything else, but near things are more related than distant
things."
SPATIAL AUTO-CORRELATION: the degree to which nearby
geographical features are similar (vs. the complete spatial
randomness hypothesis: CSR)
The clustering of
migrant
entrepreneurs:
segregation
/assimilation vs
the “ethnic
enclaves”
hypothesis (Portes
and Wilson.
"Immigrant
Enclaves”,
American Journal
of Sociology,
1980)
Identifies areas with more than 10 firms owned
by foreign born within a buffer of 500 mts:
Proximity, interaction and (spatial) clustering
Atlas of Economic Clusters in London (GaWC): “A clustered
firm is defined as one whose average distance to its 10
nearest neighbours (in its sector) is less than 100 metres”
Identifies cluster of firms owned by foreign born
-> Point layer of firms owned by foreign born
1) Do a Spatial join in order to attribute to any buffer the number of
points located within: right click the buffer layer / Join and relates /
Join / Join data from another layer base on spatial location / “Each
polygon will be given a summary…”
How many points are within each polygon? -> Attribute to any
buffer the number of firms within = Associate to the buffer’s attribute
table the number of points within = Spatial join / “Each polygon will
be given a summary of the numeric attributes” of the point layer
(field: “Count”)
3) Select all points within the polygons selected at point 2): Selection
/ Select by location / Target layer: rm_immig.shp / Source layer:
selected buffers / Spatial selection method: “Target layer features are
within the source layer” / Run
Inputs:
-> Buffer polygonial layer
-> Select all firms located in buffers including at least 10 firms =
Select by attributes
2) In the output shapefile: select all polygons with “Count” > 10 and
create a layer with the selected geatures
4) Create a layer with the selected point (right click the layer / create
layer from selected features) -> Create a shapefile with the selected
points (Export data)
Density maps
“Apparent” contagion (or attraction): clustering is due to
chance or a reaction to exogenous conditions vs. “real”
contagion (or attraction): concentration is due to attraction or
interdependency of the clustering features (Anselin)
Kernel density
Density
maps
Densità di unità locali nell’area di Prato, 2008
Fonte: elaborazione su dati Istat
* Kernel density, raggio: 1.000 mt
Densità di unità condotte da imprenditori cinesi, 2008
Fonte: elaborazione su dati Istat
* Kernel density, raggio: 1.000 mt
Silverman,
Density
estimation
for statistics
and data
analysis,
1986
Measure the density for each point in the map, based
on the number of features (points, or weighted
points) which are located within a certain ray or
threshold, by performing a spatial moving average
Spatial analyst / density / kernel density
Input: point layer (or
lines)
Population field: weight
Output raster: output
raster file
Search radius: max distance of points whose weight will be
considered for calculating densities, in map units (default:
min. extent / 250)
Area units: how densities will be expressed in the legend
Cell size: the dimension of pixels in the output raster
(default: min. extent / 30 -> average distance between all
points, or… it depends)
Create a density maps of ALL firms owned by
foreign born: spatial analyst / density / kernel
density (Input: rm_immigDT.shp (or similar);
Population field: CNT; cell size: default or set;
search radius: 2.000 meters / in the
“environments”: set the extent and raster
analysis/mask to zoneurbanistiche.shp
Mapping: Set the output raster symbology (->
quantiles) and customize and export the map as
an image file in layout view: file/export map (300
dpi)
Set the extent of the output
raster in env. settings /
processing extent equal to
that of the whole area and/or
use the area layer
(zoneurbanistiche.shp) as a
mask (in raster analysis/mask)
Coordinate systems and projections
Coordinate systems and progjections
How to represent
on a twodimensional
surface the threedimensional world
with the least
distortion
Coordinate systems
-Projected coordinate systems vs. geographic coordinate
systems
-Equidistanti / equivalent / isogonic projections
-Dataframe coordinate system vs. each layer’s coordinate
system
The ‘golden’ rule: dataframe coordinate system = each
layers’ coordinate system = output map coordinate system
Proiezioni
isogoniche
Mantengono
inalterati gli angoli
del reticolo
carografico
- Proiezione di
Mercatore:
Proiezione cilindrica e conforme: rappresenta gli angoli e le
forme in maniera corretta. La distanza varia con la latitudine.
Al diminuire della scala (grandi aree) i rapporti tra i valori di
superficie sono molto distorti (Googlemap).
Adatta per la navigazione (bussola): linee rette sulla carta
rappresentano la rotta effettiva da seguire (non la più corta…)
Proiezionie
equivalenti
Mantengono
inalterato il rapporto
tra le aree
Proiezioni equidistanti
Mantengono inalterato il rapporto tra le distanze
Proiezione Plate Carrée: proiezione equidistant
cylindrical. Sia la forma che le aree sono abbastanza ben
rappresentate (tranne che ai poli). E’ equidistante solo lungo
i meridiani, nord-sud (o alternativamente sui paralleli).
Buona per carte tematiche e per analisi che implicano il calcolo di
distanze.
Projection
Universal
Transverse
Mercator
(UTM)
60
Cylindric, equidistant and conform projection: topographic
maps, wide scales (small areas): United Nations
Cartography Committee, 1952.
Set the coordinate system
- To set the dataframe coordinate system: layers /
properties / coordinate system
- To change the
coordinate
system of
layers/shapefil
es: data / export
data / same
coordinate
system as the
data frame
Editing: to modify the
geometry of geodata
Work with shapefiles’ geometry:
geodata editing and geoprocessing
Editing / reshape existing features
-Right click the layer to be
edited / start editing
-Eg. To create new points
(manually)
Add new fields (columns) to the attribute table
Fields formats:
String (text)
Integer (eg. 3)
Double (3,21)
Etc.
Field calculator
Calculate geometry
Area
Perimeter
Centroid
Lenght
Ecc.
- Calculate the area of zone urbanistiche in square miles: add field
(name: “areaMILES”; type: double; precision: 12, scale: 2) / right click the
field / calculate geometry (area in sq miles)
Geprocessing
Merge
Dissolve
Fai: utilizzando il layer delle zone urbanistiche, si crei uno shapefile dei
Municipi di Roma, tramite dissolve field: “Municipi”
Others…
Split
Geodata geometry conversion
(points <-> polygons <-> lines)
2) To convert points into polygons: create THIESSEN
POLYGONS (triangulated irregular network (TIN) that meets
the Delaunay criterion)
1) To convert polygons into points (pesati/marcati):
CENTROIDS (problems in case of irregular areas).
- On zoneurbanistiche.shp, in the attribute table: Table properties/Add field
(field “X”, field “Y”; format: “double”, precision: 12 / scale: 4).
- Right click on field X (and Y) / “calculate geometry” to extract longitude
and latitude of the centroid / export the table in .dbf
- Create a point layer with the centroids by adding the table exported above
through the Tool Add x,y Data.
- Export data to convert the layer into a shapefile
-Arctoolbox/Analysis/Proximity/Create Thiessen Polygons
FISHNET: to create a regular polygonal gridded shapefile
FISHNET (2)
Set the extent of
cells in the grid (in
map units, eg.
meters) / numbero
of rows or
columns= 0 (or
viceversa)
Create a linear layer connecting several points of origin or
destination (point-to-point network)
-Points to Line
(1 to 1)
- (Spider) (1 to All)
All to All: EC calculate
(and draw) / ET Geo
Wizard / etc.