I have the following dataset in R - this dataset contains a list of geocoded addresses (Canada) with their Postal Codes, Longitudes and Latitudes: https://www.dropbox.com/scl/fi/9kjoqsppb85ip0tdc5wmr/stackoverflow_example.csv?rlkey=cwjk222jnoz8c9cgbt01p6bep&dl=0
I loaded this data into R:
library(httr)
library(data.table)
url <- "https://www.dropbox.com/scl/fi/9kjoqsppb85ip0tdc5wmr/stackoverflow_example.csv?rlkey=cwjk222jnoz8c9cgbt01p6bep&dl=1"
response <- GET(url)
df <- fread(content(response, "text"), sep = ",", quote = "", fill = TRUE)
> head(df)
"" "latitude" "longitude" "source_id" "id" "group_id" "street_no" "street" "str_name" "str_type" "str_dir" "unit" "city" "postal_code"
1: "999976" 44.25845 -76.46308 "" "6baaa1692aaaa7b496aa" 2494328 "104" "POINT ST. MARK DR" "POINT ST. MARK" "DR" "" "" "KINGSTON" "K7K 6X8"
2: "999977" 44.26391 -76.45090 "" "1f01e7839e59727d95a3" 2508891 "229" "GREENLEES DR" "GREENLEES" "DR" "" "" "KINGSTON" "K7K 6R1"
3: "999978" 44.26262 -76.45164 "" "289d509f161955a7b5ad" 2519600 "443" "MAUREEN ST" "MAUREEN" "ST" "" "" "KINGSTON" "K7K 7M2"
4: "999979" 44.26545 -76.45230 "" "e6516f9c0e173b684627" 2506548 "198" "GREENLEES DR" "GREENLEES" "DR" "" "" "KINGSTON" "K7K 6P7"
5: "999983" 44.23525 -76.49264 "" "2576c9ff82b86638737c" 2508273 "22" "ELLICE ST" "ELLICE" "ST" "" "" "KINGSTON" "K7K 1M5"
6: "999993" 44.26520 -76.45182 "" "03aaecc65f29e1e04fe1" 2507798 "212" "GREENLEES DR" "GREENLEES" "DR" "" "" "KINGSTON" "K7K 6P7"
"full_addr" "city_pcs" "str_name_pcs" "str_type_pcs" "str_dir_pcs" "csduid" "csdname" "pruid" "provider"
1: "104 POINT ST. MARK DR" "KINGSTON" "PT ST MARK" "DR" "" 3510010 "Kingston" 35 "City of Kingston"
2: "229 GREENLEES DR" "KINGSTON" "GREENLEES" "DR" "" 3510010 "Kingston" 35 "City of Kingston"
3: "443 MAUREEN ST" "KINGSTON" "MAUREEN" "ST" "" 3510010 "Kingston" 35 "City of Kingston"
4: "198 GREENLEES DR" "KINGSTON" "GREENLEES" "DR" "" 3510010 "Kingston" 35 "City of Kingston"
5: "22 ELLICE ST" "KINGSTON" "ELLICE" "ST" "" 3510010 "Kingston" 35 "City of Kingston"
6: "212 GREENLEES DR" "KINGSTON" "GREENLEES" "DR" "" 3510010 "Kingston" 35 "City of Kingston"
My Question: Using this data, I am trying to "approximate" the geographical boundary of each Postal Code and visualize the result.
In the past, it was suggested to me that a technique called "Polygon Clipping" might be useful for accomplishing this task.
I am trying to learn how "Polygon Clipping" might be useful in accomplishing this task - but I am not sure how to get started with this. In the end, I would like to have something like a shapefile that contains the "perimeter" (in longitude and latitude coordinates) of each Postal Code.
How can I do this?
Note:
- Original Source of Full Data : https://www.statcan.gc.ca/en/lode/databases/oda
- Related Question: Building a shapefile for Canadian postal codes