Common Errors and Basic Concepts
#PERSONAL NOTES
COMMON ERRORS
During importing geospatial data, the coordinate system of the source data was either missing (such as due to missing .proj for ESRI shapefile) or wrongly assigned during the importing process.
Input feature class contains less than 30 features.
>> produce low reliability results.
The input field in categorical attribute field.
Use WGS84, or even undefined.
>> Should always use projection based coordinates.
CONCEPT NOTES FOR GEOCOMPUTATION WITH R
Following notes are quoted from Geocomputation with R
simple feature geometries (basic) > sfg - objects > sfc - ‘list columns’ of class > sf - (full objects)
sfg
class :2.1 - represents the different simple feature geometry types in R : point, linestring, polygon (and their ‘multi’ equivalents, such as multipoints) or geometry collection.
A point:
st_point()
A linestring:
st_linestring()
A polygon:
st_polygon()
A multipoint:
st_multipoint()
A multilinestring:
st_multilinestring()
A multipolygon:
st_multipolygon()
A geometry collection:
st_geometrycollection()
2.2 -
sfg
objects can be created from three base R data types:A numeric vector: a single point
A matrix: a set of points, where each row represents a point, a multipoint or linestring
A list: a collection of objects such as matrices, multilinestrings or geometry collections
#further read-up is required
sfc
class :3.1 -
sfc
is a list ofsfg
objects, which is additionally able to contain information about the coordinate reference system in use. For instance, to combine two simple features into one object with two features, we can use thest_sfc()
function. This is important sincesfc
represents the geometry column in sf data frames#further read up is required
sf
represent a set of data by combining the attributes (data.frame
) with the simple feature geometry column (sfc
). They are created withst_sf()
.#further read-up is required
In geospatial analytics, it is very common for us to transform the original data from geographic coordinate system ( 0-360 range of decimal degree) to projected coordinate system.
>> geographic coordinate system is not appropriate if the analysis need to use distance or/and area measurements.
Shape objects can be vector or raster data
sf
objects for vector datastars
objects for raster datatm_shape(worldelevation) + tm_raster("worldelevation.tif", palette = terrain.colors(8)) + tm_shape(worldvector) + tm_borders() + tm_shape(worldcities) + tm_dots() + tm_text("name")
three shapes:
worldelevation
which is astars
object containing an attribute called"worldelevation.tif"
,worldvector
which is ansf
object with country borders, andworldcities
, which is ansf
object that contains metropolitan areas of at least 20 million inhabitants.Each
tm_shape()
function call is succeeded by one or more layer functions.The order of the
tm_shape()
functions’ calls is crucial. The firsttm_shape()
, known as the main shape, is not only shown below the following shapes, but also sets the projection and extent of the whole map.
Tobler’s First law of Geography
” Everything is related to everything else, but near things are more related than distant things.”
Foundation of :
spatial dependence
spatial autocorrelation
CODE REFERENCES
EPSG code | geodetic CRS | datum | ellipsoid | area of use |
---|---|---|---|---|
3414 - 4326 | SVY21 | SVY21 | WGS 84 (4326) | Singapore - onshore and offshore |
REFERENCES
- wiki.gis.com. Datum (geodesy) - http://wiki.gis.com/wiki/index.php/Datum_(geodesy)
- Chapter 4 Specifying Spatial Data - https://r-tmap.github.io/tmap-book/tmshape.html
QUARTO QUICK REFERENCES
HTML Theming - https://quarto.org/docs/output-formats/html-themes.html
HTML Code Blocks - https://quarto.org/docs/output-formats/html-code.html
HTML Options - https://quarto.org/docs/reference/formats/html.html
Article Layout - https://quarto.org/docs/authoring/article-layout.html
Tables - https://quarto.org/docs/authoring/tables.html
reStructuredText Options - https://quarto.org/docs/reference/formats/rst.html