PPOL 6805: GIS for Spatial Data Science
2026-11-13
| place_id | licence | osm_type | osm_id | lat | lon | class | type | place_rank | importance | addresstype | name | display_name | geometry |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 231159944 | Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright | relation | 1293250 | 25.0375198 | 121.5636796 | boundary | administrative | 7 | 0.7098064 | city | 臺北市 | 臺北市, 臺灣 | POLYGON ((121.4571 25.10798… |
| 416923803 | Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright | relation | 1527220 | 25.0119970 | 121.4656619 | boundary | administrative | 8 | 0.6239171 | city | 新北市 | 新北市, 臺灣 | MULTIPOLYGON (((121.2826 25… |
osmdataosmdataky_results <- readRDS('data/ky-result.rds')
ky_sf <- ky_results$osm_multipolygons
ky_vars <- c("osm_id", "name", "ISO3166-2", "admin_level", "border_type",
"boundary", "nickname", "official_name", "ref", "ref:USCG", "ref:USPS", "ref:fips",
"short_name", "source:short_name", "type",
"wikidata", "wikipedia", "geometry")Coordinate Reference System:
User input: NAD83
wkt:
GEOGCRS["NAD83",
DATUM["North American Datum 1983",
ELLIPSOID["GRS 1980",6378137,298.257222101,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
CS[ellipsoidal,2],
AXIS["latitude",north,
ORDER[1],
ANGLEUNIT["degree",0.0174532925199433]],
AXIS["longitude",east,
ORDER[2],
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4269]]
Coordinate Reference System:
User input: EPSG:4326
wkt:
GEOGCRS["WGS 84",
ENSEMBLE["World Geodetic System 1984 ensemble",
MEMBER["World Geodetic System 1984 (Transit)"],
MEMBER["World Geodetic System 1984 (G730)"],
MEMBER["World Geodetic System 1984 (G873)"],
MEMBER["World Geodetic System 1984 (G1150)"],
MEMBER["World Geodetic System 1984 (G1674)"],
MEMBER["World Geodetic System 1984 (G1762)"],
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]],
ENSEMBLEACCURACY[2.0]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
CS[ellipsoidal,2],
AXIS["geodetic latitude (Lat)",north,
ORDER[1],
ANGLEUNIT["degree",0.0174532925199433]],
AXIS["geodetic longitude (Lon)",east,
ORDER[2],
ANGLEUNIT["degree",0.0174532925199433]],
USAGE[
SCOPE["Horizontal component of 3D system."],
AREA["World."],
BBOX[-90,-180,90,180]],
ID["EPSG",4326]]
[1] 68 24
| urban | rural |
|---|---|
| 4 | 81 |
| 2 | 83 |
| 3 | 82 |
| 1 | 84 |
class : RasterLayer
dimensions : 4320, 8640, 37324800 (nrow, ncol, ncell)
resolution : 0.04166667, 0.04166667 (x, y)
extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
crs : +proj=longlat +datum=WGS84 +no_defs
source : gpw_v4_population_count_adjusted_to_2015_unwpp_country_totals_rev11_2020_2pt5_min.tif
names : gpw_v4_population_count_adjusted_to_2015_unwpp_country_totals_rev11_2020_2pt5_min
class : SpatialPolygonsDataFrame
features : 11712
extent : -89.58333, -81.95833, 36.5, 39.16667 (xmin, xmax, ymin, ymax)
crs : +proj=longlat +datum=WGS84 +no_defs
variables : 1
names : gpw_v4_population_count_adjusted_to_2015_unwpp_country_totals_rev11_2020_2pt5_min
min values : 0
max values : 37111.3984375
Rows: 11,712
Columns: 2
$ gpw_v4_population_count_adjusted_to_2015_unwpp_country_totals_rev11_2020_2pt5_min <dbl> …
$ geometry <POLYGON [°]> …
gpw_map <- pop_sf |>
ggplot(aes(fill = pop_count)) +
geom_sf(color = scales::alpha("white",0)) +
scale_fill_viridis_c(trans = 'pseudo_log') +
theme_minimal() +
labs(
title = "Population Counts",
subtitle = 'GPW V.4 2020-07-01',
fill = "Population Count"
) +
theme(
plot.title = element_text(hjust=0.5),
plot.subtitle = element_text(hjust=0.5)
)
ggsave('image/gpw-raster.png', plot = gpw_map)
gpw_map