Welcome to Advanced GIS, Lecture 3
This is a web page that can be viewed as slides.
→ to move forward
← to go back
Class 3
#earthquakes {
marker-width: 3;
...
[zoom >= 10] {
marker-width: 8;
}
}
#earthquakes {
marker-width: 3;
...
[place = 'South of Panama'] {
marker-width: 8;
}
}
#earthquakes {
marker-width: 3;
...
[mag > 5.5],
[place = 'South of Panama'] {
marker-width: 15;
}
}
#earthquakes {
marker-width: 3;
...
[mag > 4][place = 'South of Panama'] {
marker-width: 15;
}
}
#earthquakes {
marker-width: 3;
...
[mag > 4][place = 'South of Panama'] {
marker-width: 15;
}
}
make markers where mag is greater than 4 and place = "South of Panama" larger
[place =~ ".*Africa.*"] {
marker-width: 15;
}
[place =~ ".*Africa.*"] {
marker-width: 15;
}
style features with "Africa" anywhere in the place
field
#earthquakes {
marker-width: 5;
marker-fill: #ff307a;
marker-allow-overlap: true;
[zoom >= 4] {
marker-width: 10;
}
[zoom >= 8] {
marker-width: 15;
}
[zoom >= 12] {
marker-width: 20;
}
}
#earthquakes {
marker-width: 6;
marker-fill: #ff307a;
marker-allow-overlap: true;
[zoom >= 4] {
marker-width: 12;
}
[zoom >= 8] {
marker-width: 18;
}
[zoom >= 12] {
marker-width: 24;
}
}
@width: 6;
#earthquakes {
marker-width: @width;
marker-fill: #ff307a;
marker-allow-overlap: true;
[zoom >= 4] {
marker-width: 12;
}
[zoom >= 8] {
marker-width: 18;
}
[zoom >= 12] {
marker-width: 24;
}
}
@width: 6;
#earthquakes {
marker-width: @width;
marker-fill: #ff307a;
marker-allow-overlap: true;
[zoom >= 4] {
marker-width: @width * 2;
}
[zoom >= 8] {
marker-width: @width * 3;
}
[zoom >= 12] {
marker-width: @width * 4;
}
}
@width: 8;
#earthquakes {
marker-width: @width;
marker-fill: #ff307a;
marker-allow-overlap: true;
[zoom >= 4] {
marker-width: @width * 2;
}
[zoom >= 8] {
marker-width: @width * 3;
}
[zoom >= 12] {
marker-width: @width * 4;
}
}
@quakecolor: #ff307a;
#earthquakes {
marker-width: @width;
marker-fill: @quakecolor;
marker-line-color: @quakecolor;
marker-line-opacity: 0.2;
marker-allow-overlap: true;
}
Give me the pages that refer to properties in Brooklyn.
Give me the addresses of the properties in Brooklyn.
Give me the addresses of the properties in Brooklyn that have been built on since 1950.
SELECT *
FROM education
SELECT
: choose columns from a tableSELECT *
: choose all columnsif you only want a few columns, list them. for example:
SELECT students, teachers
FROM education
SELECT *
FROM education
WHERE students > 100
WHERE
: choose rows from a tablethese conditions are the same as the ones in CartoCSS:
>
<
=
!=
>=
<=
AND
/ OR
for example:
SELECT *
FROM education
WHERE students > 100
AND students < 200
students
between 100 and 150?SELECT *
FROM education
WHERE students > 100
AND students < 150
NOT
for example:
SELECT *
FROM education
WHERE NOT (students > 100
OR op_type = 'religious')
students
not between 100 and 150?SELECT
does not change the table, it only changes your view of the tableSELECT
to get a better idea of what data is in your tablecount matching rows:
SELECT COUNT(*)
FROM education
WHERE students > 100
AND op_type = 'religious'
students
between 100 and 150?UPDATE
or DELETE
the data in your tableUPDATE education
SET size = 'large'
WHERE students > 2500
DELETE FROM education
WHERE ...
SELECT *, ST_area(the_geom)
FROM kiberaboundary
SELECT *,
ST_area(ST_transform(the_geom_webmercator, 21036))
FROM kiberaboundary
SELECT cartodb_id,
ST_Transform(the_geom, 3573)
AS the_geom_webmercator
FROM my_table