Take-home_Ex03
1.0 Overview
1.1 Background
Housing is an essential component of household wealth worldwide. Buying a housing has always been a major investment for most people. The price of housing is affected by many factors. Some of them are global in nature such as the general economy of a country or inflation rate. Others can be more specific to the properties themselves. These factors can be further divided to structural and locational factors. Structural factors are variables related to the property themselves such as the size, fitting, and tenure of the property. Locational factors are variables related to the neighbourhood of the properties such as proximity to childcare centre, public transport service and shopping centre.
Conventional, housing resale prices predictive models were built by using Ordinary Least Square (OLS) method. However, this method failed to take into consideration that spatial autocorrelation and spatial heterogeneity exist in geographic data sets such as housing transactions. With the existence of spatial autocorrelation, the OLS estimation of predictive housing resale pricing models could lead to biased, inconsistent, or inefficient results (Anselin 1998). In view of this limitation, Geographical Weighted Models were introduced for calibrating predictive model for housing resale prices.
1.2 Objectives
In this take-home exercise, you are tasked to predict HDB resale prices at the sub-market level (i.e. HDB 3-room, HDB 4-room and HDB 5-room) for the month of January and February 2023 in Singapore. The predictive models must be built by using by using conventional OLS method and GWR methods. You are also required to compare the performance of the conventional OLS method versus the geographical weighted methods.
1.3 The Data
For the purpose of this take-home exercise, HDB Resale Flat Prices provided by Data.gov.sg should be used as the core data set. The study should focus on either three-room, four-room or five-room flat and transaction period should be from 1st January 2021 to 31st December 2022. The test data should be January and February 2023 resale prices.
Below is a list of recommended predictors to consider. However, students are free to include other appropriate independent variables.
Structural Factors: - Area of the unit - Floor level - Remaining lease - Age of the unit - Main Upgrading Program (MUP) completed (optional)
Locational Factors: - Proxomity to CBD - Proximity to eldercare - Proximity to foodcourt/hawker centres - Proximity to MRT - Proximity to park - Proximity to good primary school - Proximity to shopping mall - Proximity to supermarket - Numbers of kindergartens within 350m - Numbers of childcare centres within 350m - Numbers of bus stop within 350m - Numbers of primary school within 1km
2.0 Installing R Packages & Importing Data
2.1 Packages Used
- sf
- spdep
- GWmodel
- SpatialML –> use grf.bw to find the optimal bandwidth for Geographically Weighted Random Forest: https://search.r-project.org/CRAN/refmans/SpatialML/html/grf.bw.html
- tmap
- rsample
- Metrics
- tidyverse
- olsrr
- ggpubr
- gtsummary
- lwgeom
2.2 Installing Packages
::p_load(sf, spdep, GWmodel, SpatialML,
pacman tmap, rsample, Metrics, tidyverse, olsrr, ggpubr, gtsummary, lwgeom, httr, jsonlite, dplyr, geojsonsf, rvest, corrplot, stats)
3.0 Importing Data
3.1 Importing Geospatial Data
= st_read(
sg_area dsn = "data/geospatial",
layer = "MPSZ-2019")
Reading layer `MPSZ-2019' from data source
`/Users/yashica/Desktop/xtc0/IS415-GAA/Take-home_Ex/Take_home_Ex03/data/geospatial'
using driver `ESRI Shapefile'
Simple feature collection with 332 features and 6 fields
Geometry type: MULTIPOLYGON
Dimension: XY
Bounding box: xmin: 103.6057 ymin: 1.158699 xmax: 104.0885 ymax: 1.470775
Geodetic CRS: WGS 84
glimpse(sg_area)
Rows: 332
Columns: 7
$ SUBZONE_N <chr> "MARINA EAST", "INSTITUTION HILL", "ROBERTSON QUAY", "JURON…
$ SUBZONE_C <chr> "MESZ01", "RVSZ05", "SRSZ01", "WISZ01", "MUSZ02", "MPSZ05",…
$ PLN_AREA_N <chr> "MARINA EAST", "RIVER VALLEY", "SINGAPORE RIVER", "WESTERN …
$ PLN_AREA_C <chr> "ME", "RV", "SR", "WI", "MU", "MP", "WI", "WI", "SI", "SI",…
$ REGION_N <chr> "CENTRAL REGION", "CENTRAL REGION", "CENTRAL REGION", "WEST…
$ REGION_C <chr> "CR", "CR", "CR", "WR", "CR", "CR", "WR", "WR", "CR", "CR",…
$ geometry <MULTIPOLYGON [°]> MULTIPOLYGON (((103.8802 1...., MULTIPOLYGON (…
From the output message, we can tell that: - Geometry type is multipolygon - 332 records and 6 fields - We have to convert this from to Project Coordinated System.
<- st_read(dsn = "data/geospatial/data_extracted/BusStop", layer="BusStop") busstop_sf
Reading layer `BusStop' from data source
`/Users/yashica/Desktop/xtc0/IS415-GAA/Take-home_Ex/Take_home_Ex03/data/geospatial/data_extracted/BusStop'
using driver `ESRI Shapefile'
Simple feature collection with 5159 features and 3 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 3970.122 ymin: 26482.1 xmax: 48284.56 ymax: 52983.82
Projected CRS: SVY21
glimpse(busstop_sf)
Rows: 5,159
Columns: 4
$ BUS_STOP_N <chr> "22069", "32071", "44331", "96081", "11561", "66191", "2338…
$ BUS_ROOF_N <chr> "B06", "B23", "B01", "B05", "B05", "B03", "B02A", "B02", "B…
$ LOC_DESC <chr> "OPP CEVA LOGISTICS", "AFT TRACK 13", "BLK 239", "GRACE IND…
$ geometry <POINT [m]> POINT (13576.31 32883.65), POINT (13228.59 44206.38),…
<- st_read(dsn = "data/geospatial/data_extracted/childcare", layer="ChildcareServices") childcare_sf
Reading layer `ChildcareServices' from data source
`/Users/yashica/Desktop/xtc0/IS415-GAA/Take-home_Ex/Take_home_Ex03/data/geospatial/data_extracted/childcare'
using driver `ESRI Shapefile'
Simple feature collection with 1545 features and 2 fields
Geometry type: POINT
Dimension: XYZ
Bounding box: xmin: 11203.01 ymin: 25667.6 xmax: 45404.24 ymax: 49300.88
z_range: zmin: 0 zmax: 0
Projected CRS: SVY21 / Singapore TM
glimpse(childcare_sf)
Rows: 1,545
Columns: 3
$ Name <chr> "kml_1", "kml_2", "kml_3", "kml_4", "kml_5", "kml_6", "kml_…
$ Descriptio <chr> "<center><table><tr><th colspan='2' align='center'><em>Attr…
$ geometry <POINT [m]> POINT Z (27976.73 45716.7 0), POINT Z (25824 29900.09…
<- st_read(dsn = "data/geospatial/data_extracted/ELDERCARE", layer="ELDERCARE") eldercare_sf
Reading layer `ELDERCARE' from data source
`/Users/yashica/Desktop/xtc0/IS415-GAA/Take-home_Ex/Take_home_Ex03/data/geospatial/data_extracted/eldercare'
using driver `ESRI Shapefile'
Simple feature collection with 133 features and 18 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 14481.92 ymin: 28218.43 xmax: 41665.14 ymax: 46804.9
Projected CRS: SVY21
glimpse(eldercare_sf)
Rows: 133
Columns: 19
$ OBJECTID <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, …
$ ADDRESSBLO <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ ADDRESSBUI <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ ADDRESSPOS <chr> "601318", "462509", "640190", "190005", "160044", "160117",…
$ ADDRESSSTR <chr> "318A Jurong East Avenue 1 #02-308", "Blk 509B Bedok North …
$ ADDRESSTYP <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ DESCRIPTIO <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ HYPERLINK <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ LANDXADDRE <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
$ LANDYADDRE <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
$ NAME <chr> "Yuhua Senior Activity Centre", "THK SAC @ Kaki Bukit", "TH…
$ PHOTOURL <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ ADDRESSFLO <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ INC_CRC <chr> "2B0DB92FDD914FFC", "82728FA30612F3FD", "DE7A8D4EA0BD1D9B",…
$ FMEL_UPD_D <date> 2016-07-28, 2016-07-28, 2016-07-28, 2016-07-28, 2016-07-28…
$ ADDRESSUNI <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ X_ADDR <dbl> 16614.08, 38803.81, 14481.92, 31505.35, 27218.35, 27278.94,…
$ Y_ADDR <dbl> 36639.12, 35098.78, 36357.61, 31853.52, 30135.49, 29350.17,…
$ geometry <POINT [m]> POINT (16614.08 36639.12), POINT (38803.81 35098.78),…
<- read_csv( "data/geospatial/data_extracted/primaryschools/general-information-of-schools.csv")
primaryschools glimpse(primaryschools)
Rows: 346
Columns: 31
$ school_name <chr> "ADMIRALTY PRIMARY SCHOOL", "ADMIRALTY SECONDARY SC…
$ url_address <chr> "https://admiraltypri.moe.edu.sg/", "http://www.adm…
$ address <chr> "11 WOODLANDS CIRCLE", "31 WOODLANDS CRESCENT",…
$ postal_code <chr> "738907", "737916", "768643", "768928", "579646", "…
$ telephone_no <chr> "63620598", "63651733", "67592906", "67585384", "64…
$ telephone_no_2 <chr> "na", "63654596", "na", "na", "na", "na", "na", "na…
$ fax_no <chr> "63627512", "63652774", "67592927", "67557778", "64…
$ fax_no_2 <chr> "na", "na", "na", "na", "na", "na", "na", "na", "na…
$ email_address <chr> "ADMIRALTY_PS@MOE.EDU.SG", "Admiralty_SS@moe.edu.sg…
$ mrt_desc <chr> "Admiralty Station", "ADMIRALTY MRT", "Yishun", "CA…
$ bus_desc <chr> "TIBS 965, 964, 913", "904", "Yishun Ring Road - 81…
$ principal_name <chr> "MR PEK WEE HAUR", "MR LAM YUI- P'NG", "MISS ONG LE…
$ first_vp_name <chr> "MDM CHUA MUI LING", "MR NG SONG LIM STEVEN", "MADA…
$ second_vp_name <chr> "MDM NUR SABARIAH BTE MOHD IBRAHIM", "MR SHEIK ALAU…
$ third_vp_name <chr> "NULL", "NULL", "NULL", "NULL", "NULL", "NULL", "NU…
$ fourth_vp_name <chr> "NULL", "NULL", "NULL", "NULL", "NULL", "NULL", "NU…
$ fifth_vp_name <chr> "NULL", "NULL", "NULL", "NULL", "NULL", "NULL", "NU…
$ sixth_vp_name <chr> "NULL", "NULL", "NULL", "NULL", "NULL", "NULL", "NU…
$ dgp_code <chr> "WOODLANDS", "WOODLANDS", "YISHUN", "YISHUN", "BISH…
$ zone_code <chr> "NORTH", "NORTH", "NORTH", "NORTH", "SOUTH", "SOUTH…
$ type_code <chr> "GOVERNMENT SCHOOL", "GOVERNMENT SCHOOL", "GOVERNME…
$ nature_code <chr> "CO-ED SCHOOL", "CO-ED SCHOOL", "CO-ED SCHOOL", "CO…
$ session_code <chr> "FULL DAY", "SINGLE SESSION", "SINGLE SESSION", "SI…
$ mainlevel_code <chr> "PRIMARY", "SECONDARY", "PRIMARY", "SECONDARY", "PR…
$ sap_ind <chr> "No", "No", "No", "No", "Yes", "No", "No", "No", "N…
$ autonomous_ind <chr> "No", "No", "No", "No", "No", "No", "No", "No", "Ye…
$ gifted_ind <chr> "No", "No", "No", "No", "No", "No", "No", "No", "No…
$ ip_ind <chr> "No", "No", "No", "No", "No", "No", "No", "No", "No…
$ mothertongue1_code <chr> "Chinese", "Chinese", "Chinese", "Chinese", "Chines…
$ mothertongue2_code <chr> "Malay", "Malay", "Malay", "Malay", "na", "Malay", …
$ mothertongue3_code <chr> "Tamil", "Tamil", "Tamil", "Tamil", "na", "Tamil", …
We see that the list of schools in this dataset contains many different levels (not just primary schools). We will need to select primary schools later on.
<- primaryschools %>%
primaryschools filter(mainlevel_code == "PRIMARY") %>%
select(school_name, address, postal_code, mainlevel_code)
Let’s create a list storing unique postal codes of primary schools.
<- sort(unique(primaryschools$postal_code)) prisch_list
Now, let’s use a function to retrieve the coordinates of primary schools. More information on this function will be explained in section xxx.
<- function(add_list){
get_coords
# Create a data frame to store all retrieved coordinates
<- data.frame()
postal_coords
for (i in add_list){
#print(i)
<- GET('https://developers.onemap.sg/commonapi/search?',
r query=list(searchVal=i,
returnGeom='Y',
getAddrDetails='Y'))
<- fromJSON(rawToChar(r$content))
data <- data$found
found <- data$results
res
# Create a new data frame for each address
<- data.frame()
new_row
# If single result, append
if (found == 1){
<- res$POSTAL
postal <- res$LATITUDE
lat <- res$LONGITUDE
lng <- data.frame(address= i, postal = postal, latitude = lat, longitude = lng)
new_row
}
# If multiple results, drop NIL and append top 1
else if (found > 1){
# Remove those with NIL as postal
<- res[res$POSTAL != "NIL", ]
res_sub
# Set as NA first if no Postal
if (nrow(res_sub) == 0) {
<- data.frame(address= i, postal = NA, latitude = NA, longitude = NA)
new_row
}
else{
<- head(res_sub, n = 1)
top1 <- top1$POSTAL
postal <- top1$LATITUDE
lat <- top1$LONGITUDE
lng <- data.frame(address= i, postal = postal, latitude = lat, longitude = lng)
new_row
}
}
else {
<- data.frame(address= i, postal = NA, latitude = NA, longitude = NA)
new_row
}
# Add the row
<- rbind(postal_coords, new_row)
postal_coords
}return(postal_coords)
}
<- get_coords(prisch_list) prisch_coords
Here, we check whether the relevant columns contains any NA values with is.na() function of base R package.
is.na(prisch_coords$postal) | is.na(prisch_coords$latitude) | is.na(prisch_coords$longitude)), ] prisch_coords[(
[1] address postal latitude longitude
<0 rows> (or 0-length row.names)
= prisch_coords[c("postal","latitude", "longitude")]
prisch_coords <- left_join(primaryschools, prisch_coords, by = c('postal_code' = 'postal')) pri_sch
<- st_as_sf(pri_sch,
primaryschools_sf coords = c("longitude",
"latitude"),
crs=4326) %>%
st_transform(crs = 3414)
primaryschools_sf
Simple feature collection with 183 features and 4 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 11801.94 ymin: 28603.93 xmax: 42410.51 ymax: 48703.49
Projected CRS: SVY21 / Singapore TM
# A tibble: 183 × 5
school_name address posta…¹ mainl…² geometry
* <chr> <chr> <chr> <chr> <POINT [m]>
1 ADMIRALTY PRIMARY SCHOOL 11 W… 738907 PRIMARY (24296.63 47144.77)
2 AHMAD IBRAHIM PRIMARY SCHO… 10 Y… 768643 PRIMARY (27936.78 46125.16)
3 AI TONG SCHOOL 100 B… 579646 PRIMARY (27966.81 38071.92)
4 ALEXANDRA PRIMARY SCHOOL 2A P… 159016 PRIMARY (26964.86 30396.5)
5 ANCHOR GREEN PRIMARY SCHOOL 31 A… 544969 PRIMARY (34022.25 41380.93)
6 ANDERSON PRIMARY SCHOOL 19 A… 569785 PRIMARY (28898.48 40690.43)
7 ANG MO KIO PRIMARY SCHOOL 20 A… 569920 PRIMARY (28710.77 38969.81)
8 ANGLO-CHINESE SCHOOL (JUNI… 16 W… 227988 PRIMARY (28916.32 32403.75)
9 ANGLO-CHINESE SCHOOL (PRIM… 50 B… 309918 PRIMARY (28225.54 33442.72)
10 ANGSANA PRIMARY SCHOOL 3 T… 529366 PRIMARY (41160.86 36732.32)
# … with 173 more rows, and abbreviated variable names ¹postal_code,
# ²mainlevel_code
Make sure to click “Tools” -> “Install Packages” to install the “geojsonsf” package.
<- st_read(dsn = "data/geospatial/data_extracted/TrainStation/lta-mrt-station-exit-geojson.geojson") mrt_sf
Reading layer `lta-mrt-station-exit-geojson' from data source
`/Users/yashica/Desktop/xtc0/IS415-GAA/Take-home_Ex/Take_home_Ex03/data/geospatial/data_extracted/TrainStation/lta-mrt-station-exit-geojson.geojson'
using driver `GeoJSON'
Simple feature collection with 474 features and 2 fields
Geometry type: POINT
Dimension: XYZ
Bounding box: xmin: 103.6368 ymin: 1.264972 xmax: 103.9893 ymax: 1.449157
z_range: zmin: 0 zmax: 0
Geodetic CRS: WGS 84
glimpse(mrt_sf)
Rows: 474
Columns: 3
$ Name <chr> "kml_1", "kml_2", "kml_3", "kml_4", "kml_5", "kml_6", "kml…
$ Description <chr> "<center><table><tr><th colspan='2' align='center'><em>Att…
$ geometry <POINT [°]> POINT Z (103.8709 1.338511 0), POINT Z (103.8705 1.3…
mrt_sf has its dimensions listed as ‘XYZ’: it has a z-dimension, though as we can see from the z_range, both zmin and zmax are at 0. As it is irrelevant to our analysis, we’ll drop this with st_zm() in our pre-processing.
We’ll take care of the Z-Dimension of mrt_sf with st_zm(), a function that drops Z (or M) dimensions from feature geometries and appropriately reset the classes.
# drops the Z-dimension from our dataframes
<- st_zm(mrt_sf) mrt_sf
mrt_sf
Simple feature collection with 474 features and 2 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 103.6368 ymin: 1.264972 xmax: 103.9893 ymax: 1.449157
Geodetic CRS: WGS 84
First 10 features:
Name
1 kml_1
2 kml_2
3 kml_3
4 kml_4
5 kml_5
6 kml_6
7 kml_7
8 kml_8
9 kml_9
10 kml_10
Description
1 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>STATION_NA</th> <td></td> </tr><tr bgcolor=""> <th>EXIT_CODE</th> <td>Exit A</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>ACFD572863DE422D</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190708195912</td> </tr></table></center>
2 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>STATION_NA</th> <td></td> </tr><tr bgcolor=""> <th>EXIT_CODE</th> <td>Exit B</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>328763A3290E3CC8</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190708195912</td> </tr></table></center>
3 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>STATION_NA</th> <td></td> </tr><tr bgcolor=""> <th>EXIT_CODE</th> <td>Exit B</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>DD4FAEF984D96A47</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190708195912</td> </tr></table></center>
4 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>STATION_NA</th> <td></td> </tr><tr bgcolor=""> <th>EXIT_CODE</th> <td>Exit C</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>D92B99AC0FD16F8B</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190708195912</td> </tr></table></center>
5 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>STATION_NA</th> <td></td> </tr><tr bgcolor=""> <th>EXIT_CODE</th> <td>Exit B</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>D2E20481ED62E439</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190708195912</td> </tr></table></center>
6 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>STATION_NA</th> <td></td> </tr><tr bgcolor=""> <th>EXIT_CODE</th> <td>Exit A</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>7E887806CF052F4E</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190708195912</td> </tr></table></center>
7 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>STATION_NA</th> <td></td> </tr><tr bgcolor=""> <th>EXIT_CODE</th> <td>Exit C</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>C54A67D01293867F</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190708195912</td> </tr></table></center>
8 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>STATION_NA</th> <td></td> </tr><tr bgcolor=""> <th>EXIT_CODE</th> <td>Exit B</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>C87156CBBF363974</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190708195912</td> </tr></table></center>
9 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>STATION_NA</th> <td></td> </tr><tr bgcolor=""> <th>EXIT_CODE</th> <td>Exit A</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>C8C0EAA729F06B05</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190708195912</td> </tr></table></center>
10 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>STATION_NA</th> <td></td> </tr><tr bgcolor=""> <th>EXIT_CODE</th> <td>Exit C</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>8A21E3735E9C4992</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190708195912</td> </tr></table></center>
geometry
1 POINT (103.8709 1.338511)
2 POINT (103.8705 1.338583)
3 POINT (103.8619 1.319235)
4 POINT (103.8687 1.331067)
5 POINT (103.8693 1.331148)
6 POINT (103.8384 1.300028)
7 POINT (103.7876 1.299715)
8 POINT (103.8505 1.296046)
9 POINT (103.8513 1.296859)
10 POINT (103.8502 1.297014)
<- st_read(dsn = "data/geospatial/data_extracted/kindergartens", layer="KINDERGARTENS") kindergarten_sf
Reading layer `KINDERGARTENS' from data source
`/Users/yashica/Desktop/xtc0/IS415-GAA/Take-home_Ex/Take_home_Ex03/data/geospatial/data_extracted/kindergartens'
using driver `ESRI Shapefile'
Simple feature collection with 448 features and 15 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 11909.7 ymin: 25596.33 xmax: 43395.47 ymax: 48562.06
Projected CRS: SVY21
glimpse(kindergarten_sf)
Rows: 448
Columns: 16
$ ADDRESSBLO <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ ADDRESSBUI <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ ADDRESSFLO <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ ADDRESSPOS <chr> "560644", "600251", "600317", "671455", "670528", "670620",…
$ ADDRESSSTR <chr> "644 Ang Mo Kio Ave 4 #01-850 S(560644)", "251 Jurong East…
$ ADDRESSTYP <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ DESCRIPTIO <chr> "Kindergartens", "Kindergartens", "Kindergartens", "Kinderg…
$ HYPERLINK <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ LANDXADDRE <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
$ LANDYADDRE <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,…
$ NAME <chr> "PCF Sparkletots Preschool @ Yio Chu Kang Blk 644 (KN)", "P…
$ PHOTOURL <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ INC_CRC <chr> "904D106E26156265", "F735342764BD6BCC", "564523E27D221C4D",…
$ FMEL_UPD_D <date> 2020-08-13, 2020-08-13, 2020-08-13, 2020-08-13, 2020-08-13…
$ ADDRESSUNI <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ geometry <POINT [m]> POINT (28847.97 40124.9), POINT (17578.65 36146.17), …
<- st_read(dsn = "data/geospatial/data_extracted/hawkercentre", layer="HAWKERCENTRE") hawkercentre_sf
Reading layer `HAWKERCENTRE' from data source
`/Users/yashica/Desktop/xtc0/IS415-GAA/Take-home_Ex/Take_home_Ex03/data/geospatial/data_extracted/hawkercentre'
using driver `ESRI Shapefile'
Simple feature collection with 125 features and 21 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 12874.19 ymin: 28355.97 xmax: 45241.4 ymax: 47872.53
Projected CRS: SVY21
glimpse(hawkercentre_sf)
Rows: 125
Columns: 22
$ ADDRESSBLO <chr> "630", "16", "29", "38A", "166", "221A/B", "665", "163", "1…
$ STATUS <chr> "Existing", "Existing", "Existing", "Existing", "Existing",…
$ CLEANINGST <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ ADDRESSUNI <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ ADDRESSFLO <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ HYPERLINK <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ INFO_ON_CO <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ AWARDED_DA <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ LANDYADDRE <dbl> 35039.64, 33645.70, 33497.85, 30136.92, 32184.16, 36373.79,…
$ CLEANINGEN <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ PHOTOURL <chr> "http://www.nea.gov.sg/images/default-source/Hawker-Centres…
$ DESCRIPTIO <chr> "HUP Rebuilding", "HUP Standard Upgrading", "HUP Standard U…
$ NAME <chr> "Bedok Reservoir Road Blk 630", "Bedok South Road Blk 16", …
$ ADDRESSTYP <chr> "I", "I", "I", "I", "I", "I", "I", "I", "I", "I", NA, "I", …
$ ADDRESSBUI <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ LANDXADDRE <dbl> 36985.00, 39376.14, 31305.63, 27336.64, 30619.27, 14587.57,…
$ ADDRESSSTR <chr> "Bedok Reservoir Road", "Bedok South Road", "Bendemeer Road…
$ ADDRESSPOS <chr> "470630", "460016", "330029", "169982", "208877", "641221",…
$ IMPLEMENTA <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ INC_CRC <chr> "BBA7FF2BCA329EE8", "483F3877B4EE039F", "A7DB5A3EB9F35DE3",…
$ FMEL_UPD_D <date> 2021-10-25, 2021-10-25, 2021-10-25, 2021-10-25, 2021-10-25…
$ geometry <POINT [m]> POINT (36985 35039.64), POINT (39376.14 33645.7), POI…
<- st_read(dsn = "data/geospatial/data_extracted/nationalparks", layer="NATIONALPARKS") nationalparks_sf
Reading layer `NATIONALPARKS' from data source
`/Users/yashica/Desktop/xtc0/IS415-GAA/Take-home_Ex/Take_home_Ex03/data/geospatial/data_extracted/nationalparks'
using driver `ESRI Shapefile'
Simple feature collection with 352 features and 15 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 12373.11 ymin: 21869.93 xmax: 46735.95 ymax: 49231.09
Projected CRS: SVY21
glimpse(nationalparks_sf)
Rows: 352
Columns: 16
$ ADDRESSBLO <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ ADDRESSBUI <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ ADDRESSTYP <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ HYPERLINK <chr> NA, NA, NA, NA, NA, NA, "www.nparks.gov.sg/gardens-parks-an…
$ LANDXADDRE <dbl> 29594.30, 28695.60, 30676.61, 39994.09, 40813.11, 37385.95,…
$ LANDYADDRE <dbl> 29323.41, 39413.70, 41137.35, 39355.59, 33764.61, 32814.41,…
$ NAME <chr> "Telok Ayer Green", "Mayflower Crescent Playground", "Sunri…
$ PHOTOURL <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ ADDRESSPOS <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ DESCRIPTIO <chr> "Bounded by Amoy Street, Boon Tat Street and Telok Ayer Str…
$ ADDRESSSTR <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ ADDRESSFLO <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ INC_CRC <chr> "07CFE6567539200A", "B01AE2FF8B58F5CA", "66086C14E8DACE2D",…
$ FMEL_UPD_D <date> 2020-02-18, 2020-02-18, 2020-02-18, 2020-02-18, 2020-02-18…
$ ADDRESSUNI <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
$ geometry <POINT [m]> POINT (29594.3 29323.41), POINT (28695.6 39413.7), PO…
<- st_read(dsn = "data/geospatial/data_extracted/supermarkets", layer="SUPERMARKETS") supermarkets_sf
Reading layer `SUPERMARKETS' from data source
`/Users/yashica/Desktop/xtc0/IS415-GAA/Take-home_Ex/Take_home_Ex03/data/geospatial/data_extracted/supermarkets'
using driver `ESRI Shapefile'
Simple feature collection with 526 features and 8 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 4901.188 ymin: 25529.08 xmax: 46948.22 ymax: 49233.6
Projected CRS: SVY21
glimpse(supermarkets_sf)
Rows: 526
Columns: 9
$ LIC_NAME <chr> "LI LI CHENG SUPERMARKET (PUNGGOL) PTE. LTD.", "SHENG SIONG…
$ BLK_HOUSE <chr> "273C", "11", "683", "631", "201B", "201D", "421", "233", "…
$ STR_NAME <chr> "PUNGGOL PLACE", "UPPER BOON KENG ROAD", "HOUGANG AVENUE 8"…
$ UNIT_NO <chr> "884", "901", "903", "954", "1091", "1161", "1161", "1168",…
$ POSTCODE <chr> "823273", "380011", "530683", "470631", "522201", "524201",…
$ LIC_NO <chr> "NE12I65N000", "E73010V000", "NE11909C000", "S02210X000", "…
$ INC_CRC <chr> "3DE8AF6E76F9D3D4", "F361759A8261CD6E", "1DC69902E02077CE",…
$ FMEL_UPD_D <date> 2017-11-29, 2017-11-29, 2017-11-29, 2017-11-29, 2017-11-29…
$ geometry <POINT [m]> POINT (35561.22 42685.17), POINT (32184.01 32947.46),…
<- "https://www.salary.sg/2021/best-primary-schools-2021-by-popularity/"
url
<- data.frame()
good_pri
<- read_html(url) %>%
schools html_nodes(xpath = paste('//*[@id="post-3068"]/div[3]/div/div/ol/li') ) %>%
html_text()
for (i in (schools)){
<- toupper(gsub(" – .*","",i))
sch_name <- gsub("\\(PRIMARY SECTION)","",sch_name)
sch_name <- trimws(sch_name)
sch_name <- data.frame(pri_sch_name=sch_name)
new_row # Add the row
<- rbind(good_pri, new_row)
good_pri
}
<- head(good_pri, 10) top_good_pri
$pri_sch_name[!top_good_pri$pri_sch_name %in% primaryschools_sf$school_name] top_good_pri
[1] "CHIJ ST. NICHOLAS GIRLS’ SCHOOL" "CATHOLIC HIGH SCHOOL"
[3] "ST. HILDA’S PRIMARY SCHOOL"
<- unique(top_good_pri$pri_sch_name) good_pri_list
<- get_coords(good_pri_list) goodprisch_coords
is.na(goodprisch_coords$postal) | is.na(goodprisch_coords$latitude) | is.na(goodprisch_coords$longitude)), ] goodprisch_coords[(
address postal latitude longitude
10 ST. HILDA’S PRIMARY SCHOOL <NA> <NA> <NA>
There are 2 primary school that we are unable to retrieve the coordinates for: - CHIJ ST. NICHOLAS GIRLS’ SCHOOL - ST. HILDA’S PRIMARY SCHOOL
With further research and testing, it is found that not only do we have to change the ST to SAINT, we also have to change the ” ’ ” used.
$pri_sch_name[top_good_pri$pri_sch_name == "CHIJ ST. NICHOLAS GIRLS’ SCHOOL"] <- "CHIJ SAINT NICHOLAS GIRLS' SCHOOL"
top_good_pri$pri_sch_name[top_good_pri$pri_sch_name == "ST. HILDA’S PRIMARY SCHOOL"] <- "SAINT HILDA'S PRIMARY SCHOOL" top_good_pri
<- unique(top_good_pri$pri_sch_name) good_pri_list
<- get_coords(good_pri_list) goodprisch_coords
is.na(goodprisch_coords$postal) | is.na(goodprisch_coords$latitude) | is.na(goodprisch_coords$longitude)), ] goodprisch_coords[(
[1] address postal latitude longitude
<0 rows> (or 0-length row.names)
There are no NA values!
<- st_as_sf(goodprisch_coords,
goodpri_sf coords = c("longitude",
"latitude"),
crs=4326) %>%
st_transform(crs = 3414)
<- goodpri_sf topprimary_sf
<- "https://en.wikipedia.org/wiki/List_of_shopping_malls_in_Singapore"
url <- list()
malls_list
for (i in 2:7){
<- read_html(url) %>%
malls html_nodes(xpath = paste('//*[@id="mw-content-text"]/div[1]/div[',as.character(i),']/ul/li',sep="") ) %>%
html_text()
<- append(malls_list, malls)
malls_list }
<- get_coords(malls_list) %>%
malls_list_coords rename("mall_name" = "address")
<- subset(malls_list_coords, mall_name!= "Yew Tee Shopping Centre") malls_list_coords
<- subset(malls_list_coords, is.na(malls_list_coords$postal))
invalid_malls<- unique(invalid_malls$mall_name)
invalid_malls_list <- c("Clarke Quay", "City Gate", "Raffles Holland V", "Knightsbridge", "Mustafa Centre", "GR.ID", "Shaw House",
corrected_malls "The Poiz Centre", "Velocity @ Novena Square", "Singapore Post Centre", "PLQ Mall", "KINEX", "The Grandstand")
for (i in 1:length(invalid_malls_list)) {
<- malls_list_coords %>%
malls_list_coords mutate(mall_name = ifelse(as.character(mall_name) == invalid_malls_list[i], corrected_malls[i], as.character(mall_name)))
}
<- sort(unique(malls_list_coords$mall_name)) malls_list
<- get_coords(malls_list) malls_coords
is.na(malls_coords$postal) | is.na(malls_coords$latitude) | is.na(malls_coords$longitude)), ] malls_coords[(
[1] address postal latitude longitude
<0 rows> (or 0-length row.names)
<- st_as_sf(malls_coords,
malls_sf coords = c("longitude",
"latitude"),
crs=4326) %>%
st_transform(crs = 3414)
<- malls_sf mall_coordinates_sf
With a quick Google search, the latitude and longitude of Downtown Core also known as CBD, are 1.287953 and 103.851784 respectively.
We can first create a dataframe consisting of the latitude and longitude coordinates of the CBD area then transform it to EPSG 3414 (SVY21) format.
<- c('CBD Area')
name = c(1.287953)
latitude= c(103.851784)
longitude<- data.frame(name, latitude, longitude) cbd_coords
<- st_as_sf(cbd_coords,
cbd_coords_sf coords = c("longitude",
"latitude"),
crs=4326) %>%
st_transform(crs = 3414)
<- st_read(dsn="data/geospatial/data_extracted/clinics/moh-chas-clinics.geojson") chas_sf
Reading layer `moh-chas-clinics' from data source
`/Users/yashica/Desktop/xtc0/IS415-GAA/Take-home_Ex/Take_home_Ex03/data/geospatial/data_extracted/clinics/moh-chas-clinics.geojson'
using driver `GeoJSON'
Simple feature collection with 1064 features and 2 fields
Geometry type: POINT
Dimension: XYZ
Bounding box: xmin: 103.5818 ymin: 1.016264 xmax: 103.9903 ymax: 1.456037
z_range: zmin: 0 zmax: 0
Geodetic CRS: WGS 84
chas_sf has its dimensions listed as ‘XYZ’: it has a z-dimension, though as we can see from the z_range, both zmin and zmax are at 0. As it is irrelevant to our analysis, we’ll drop this with st_zm() in our pre-processing.
We’ll take care of the Z-Dimension of chas_sf with st_zm(), a function that drops Z (or M) dimensions from feature geometries and appropriately reset the classes.
# drops the Z-dimension from our dataframes
<- st_zm(chas_sf)
chas_sf chas_sf
Simple feature collection with 1064 features and 2 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 103.5818 ymin: 1.016264 xmax: 103.9903 ymax: 1.456037
Geodetic CRS: WGS 84
First 10 features:
Name
1 kml_1
2 kml_2
3 kml_3
4 kml_4
5 kml_5
6 kml_6
7 kml_7
8 kml_8
9 kml_9
10 kml_10
Description
1 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>HCI_CODE</th> <td>13C0197</td> </tr><tr bgcolor=""> <th>HCI_NAME</th> <td>BVH Community and Continuing Care Clinic</td> </tr><tr bgcolor="#E3E3F3"> <th>LICENCE_TYPE</th> <td>MD</td> </tr><tr bgcolor=""> <th>HCI_TEL</th> <td>62485749</td> </tr><tr bgcolor="#E3E3F3"> <th>POSTAL_CD</th> <td>547530</td> </tr><tr bgcolor=""> <th>ADDR_TYPE</th> <td>B</td> </tr><tr bgcolor="#E3E3F3"> <th>BLK_HSE_NO</th> <td>5</td> </tr><tr bgcolor=""> <th>FLOOR_NO</th> <td></td> </tr><tr bgcolor="#E3E3F3"> <th>UNIT_NO</th> <td></td> </tr><tr bgcolor=""> <th>STREET_NAME</th> <td>LORONG NAPIRI</td> </tr><tr bgcolor="#E3E3F3"> <th>BUILDING_NAME</th> <td>BRIGHT VISION HOSPITAL (LEVEL 2)</td> </tr><tr bgcolor=""> <th>CLINIC_PROGRAMME_CODE</th> <td>CDMP,CHAS,ISP</td> </tr><tr bgcolor="#E3E3F3"> <th>X_COORDINATE</th> <td>32975.96333266</td> </tr><tr bgcolor=""> <th>Y_COORDINATE</th> <td>39338.44369977</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>78FBD9F763FA1748</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190213130534</td> </tr></table></center>
2 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>HCI_CODE</th> <td>9404225</td> </tr><tr bgcolor=""> <th>HCI_NAME</th> <td>Balestier Clinic and Health Screening Centre</td> </tr><tr bgcolor="#E3E3F3"> <th>LICENCE_TYPE</th> <td>MD</td> </tr><tr bgcolor=""> <th>HCI_TEL</th> <td>62588798</td> </tr><tr bgcolor="#E3E3F3"> <th>POSTAL_CD</th> <td>329928</td> </tr><tr bgcolor=""> <th>ADDR_TYPE</th> <td>B</td> </tr><tr bgcolor="#E3E3F3"> <th>BLK_HSE_NO</th> <td>221</td> </tr><tr bgcolor=""> <th>FLOOR_NO</th> <td>03</td> </tr><tr bgcolor="#E3E3F3"> <th>UNIT_NO</th> <td>04</td> </tr><tr bgcolor=""> <th>STREET_NAME</th> <td>Balestier Road</td> </tr><tr bgcolor="#E3E3F3"> <th>BUILDING_NAME</th> <td>Rocca Balestier</td> </tr><tr bgcolor=""> <th>CLINIC_PROGRAMME_CODE</th> <td>CDMP,CHAS,ISP</td> </tr><tr bgcolor="#E3E3F3"> <th>X_COORDINATE</th> <td>30137.60782798</td> </tr><tr bgcolor=""> <th>Y_COORDINATE</th> <td>33727.68326718</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>FE3FEA6E72F6A9CD</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190213130534</td> </tr></table></center>
3 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>HCI_CODE</th> <td>9402787</td> </tr><tr bgcolor=""> <th>HCI_NAME</th> <td>Banyan Clinic Pte Ltd.</td> </tr><tr bgcolor="#E3E3F3"> <th>LICENCE_TYPE</th> <td>MD</td> </tr><tr bgcolor=""> <th>HCI_TEL</th> <td>63652001</td> </tr><tr bgcolor="#E3E3F3"> <th>POSTAL_CD</th> <td>730768</td> </tr><tr bgcolor=""> <th>ADDR_TYPE</th> <td>A</td> </tr><tr bgcolor="#E3E3F3"> <th>BLK_HSE_NO</th> <td>768</td> </tr><tr bgcolor=""> <th>FLOOR_NO</th> <td>02</td> </tr><tr bgcolor="#E3E3F3"> <th>UNIT_NO</th> <td>04</td> </tr><tr bgcolor=""> <th>STREET_NAME</th> <td>Woodlands Avenue 6</td> </tr><tr bgcolor="#E3E3F3"> <th>BUILDING_NAME</th> <td>Woodlands Mart</td> </tr><tr bgcolor=""> <th>CLINIC_PROGRAMME_CODE</th> <td>CDMP,CHAS,ISP</td> </tr><tr bgcolor="#E3E3F3"> <th>X_COORDINATE</th> <td>24085.28700111</td> </tr><tr bgcolor=""> <th>Y_COORDINATE</th> <td>47475.18426852</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>BDFADA141BC3C5C0</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190213130534</td> </tr></table></center>
4 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>HCI_CODE</th> <td>12C0244</td> </tr><tr bgcolor=""> <th>HCI_NAME</th> <td>Beo Crescent Clinic & Surgery</td> </tr><tr bgcolor="#E3E3F3"> <th>LICENCE_TYPE</th> <td>MD</td> </tr><tr bgcolor=""> <th>HCI_TEL</th> <td>62750269</td> </tr><tr bgcolor="#E3E3F3"> <th>POSTAL_CD</th> <td>160040</td> </tr><tr bgcolor=""> <th>ADDR_TYPE</th> <td>A</td> </tr><tr bgcolor="#E3E3F3"> <th>BLK_HSE_NO</th> <td>40</td> </tr><tr bgcolor=""> <th>FLOOR_NO</th> <td>01</td> </tr><tr bgcolor="#E3E3F3"> <th>UNIT_NO</th> <td>02</td> </tr><tr bgcolor=""> <th>STREET_NAME</th> <td>Beo Crescent</td> </tr><tr bgcolor="#E3E3F3"> <th>BUILDING_NAME</th> <td></td> </tr><tr bgcolor=""> <th>CLINIC_PROGRAMME_CODE</th> <td>CDMP,CHAS,ISP</td> </tr><tr bgcolor="#E3E3F3"> <th>X_COORDINATE</th> <td>27353.89036223</td> </tr><tr bgcolor=""> <th>Y_COORDINATE</th> <td>30162.99234494</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>ACDDB5D5BB3AF37F</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190213130534</td> </tr></table></center>
5 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>HCI_CODE</th> <td>9405101</td> </tr><tr bgcolor=""> <th>HCI_NAME</th> <td>Bethesda Medical Centre</td> </tr><tr bgcolor="#E3E3F3"> <th>LICENCE_TYPE</th> <td>MD</td> </tr><tr bgcolor=""> <th>HCI_TEL</th> <td>63378933</td> </tr><tr bgcolor="#E3E3F3"> <th>POSTAL_CD</th> <td>038983</td> </tr><tr bgcolor=""> <th>ADDR_TYPE</th> <td>B</td> </tr><tr bgcolor="#E3E3F3"> <th>BLK_HSE_NO</th> <td>3</td> </tr><tr bgcolor=""> <th>FLOOR_NO</th> <td>B1</td> </tr><tr bgcolor="#E3E3F3"> <th>UNIT_NO</th> <td>124</td> </tr><tr bgcolor=""> <th>STREET_NAME</th> <td>TEMASEK BOULEVARD</td> </tr><tr bgcolor="#E3E3F3"> <th>BUILDING_NAME</th> <td>SUNTEC CITY MALL</td> </tr><tr bgcolor=""> <th>CLINIC_PROGRAMME_CODE</th> <td>CDMP,CHAS,ISP</td> </tr><tr bgcolor="#E3E3F3"> <th>X_COORDINATE</th> <td>30859.71977217</td> </tr><tr bgcolor=""> <th>Y_COORDINATE</th> <td>30923.09790327</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>0F18873C06CB85A2</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190213130534</td> </tr></table></center>
6 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>HCI_CODE</th> <td>14M0324</td> </tr><tr bgcolor=""> <th>HCI_NAME</th> <td>Bewell Clinic @ Dorm Pte Ltd</td> </tr><tr bgcolor="#E3E3F3"> <th>LICENCE_TYPE</th> <td>MC</td> </tr><tr bgcolor=""> <th>HCI_TEL</th> <td>65656338</td> </tr><tr bgcolor="#E3E3F3"> <th>POSTAL_CD</th> <td>608596</td> </tr><tr bgcolor=""> <th>ADDR_TYPE</th> <td>B</td> </tr><tr bgcolor="#E3E3F3"> <th>BLK_HSE_NO</th> <td>28</td> </tr><tr bgcolor=""> <th>FLOOR_NO</th> <td>01</td> </tr><tr bgcolor="#E3E3F3"> <th>UNIT_NO</th> <td>01</td> </tr><tr bgcolor=""> <th>STREET_NAME</th> <td>TOH GUAN ROAD EAST</td> </tr><tr bgcolor="#E3E3F3"> <th>BUILDING_NAME</th> <td>WESTLITE TOH GUAN DORMITORY</td> </tr><tr bgcolor=""> <th>CLINIC_PROGRAMME_CODE</th> <td>CDMP,CHAS,ISP</td> </tr><tr bgcolor="#E3E3F3"> <th>X_COORDINATE</th> <td>18935.85979557</td> </tr><tr bgcolor=""> <th>Y_COORDINATE</th> <td>35408.97072583</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>38F5B4509423BD1C</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190213130534</td> </tr></table></center>
7 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>HCI_CODE</th> <td>12C0252</td> </tr><tr bgcolor=""> <th>HCI_NAME</th> <td>Bless Medical Centre Pte Ltd</td> </tr><tr bgcolor="#E3E3F3"> <th>LICENCE_TYPE</th> <td>MD</td> </tr><tr bgcolor=""> <th>HCI_TEL</th> <td>62664119</td> </tr><tr bgcolor="#E3E3F3"> <th>POSTAL_CD</th> <td>640221</td> </tr><tr bgcolor=""> <th>ADDR_TYPE</th> <td>A</td> </tr><tr bgcolor="#E3E3F3"> <th>BLK_HSE_NO</th> <td>221</td> </tr><tr bgcolor=""> <th>FLOOR_NO</th> <td>01</td> </tr><tr bgcolor="#E3E3F3"> <th>UNIT_NO</th> <td>108</td> </tr><tr bgcolor=""> <th>STREET_NAME</th> <td>BOON LAY PLACE</td> </tr><tr bgcolor="#E3E3F3"> <th>BUILDING_NAME</th> <td>BOON LAY SHOPPING CENTRE</td> </tr><tr bgcolor=""> <th>CLINIC_PROGRAMME_CODE</th> <td>CDMP,CHAS,ISP</td> </tr><tr bgcolor="#E3E3F3"> <th>X_COORDINATE</th> <td>14546.34900375</td> </tr><tr bgcolor=""> <th>Y_COORDINATE</th> <td>36498.19284422</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>0A525408785D9806</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190213130534</td> </tr></table></center>
8 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>HCI_CODE</th> <td>9402741</td> </tr><tr bgcolor=""> <th>HCI_NAME</th> <td>C & K FAMILY CLINIC PTE LTD</td> </tr><tr bgcolor="#E3E3F3"> <th>LICENCE_TYPE</th> <td>MD</td> </tr><tr bgcolor=""> <th>HCI_TEL</th> <td>62429588</td> </tr><tr bgcolor="#E3E3F3"> <th>POSTAL_CD</th> <td>455297</td> </tr><tr bgcolor=""> <th>ADDR_TYPE</th> <td>B</td> </tr><tr bgcolor="#E3E3F3"> <th>BLK_HSE_NO</th> <td>108</td> </tr><tr bgcolor=""> <th>FLOOR_NO</th> <td></td> </tr><tr bgcolor="#E3E3F3"> <th>UNIT_NO</th> <td></td> </tr><tr bgcolor=""> <th>STREET_NAME</th> <td>UPPER EAST COAST ROAD</td> </tr><tr bgcolor="#E3E3F3"> <th>BUILDING_NAME</th> <td></td> </tr><tr bgcolor=""> <th>CLINIC_PROGRAMME_CODE</th> <td>CDMP,CHAS,ISP</td> </tr><tr bgcolor="#E3E3F3"> <th>X_COORDINATE</th> <td>38682.39910624</td> </tr><tr bgcolor=""> <th>Y_COORDINATE</th> <td>32829.31658602</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>CAA157915ADB2310</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190213130534</td> </tr></table></center>
9 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>HCI_CODE</th> <td>9400151</td> </tr><tr bgcolor=""> <th>HCI_NAME</th> <td>C H TAN MEDICAL CLINIC & DENTAL SURGERY</td> </tr><tr bgcolor="#E3E3F3"> <th>LICENCE_TYPE</th> <td>MD</td> </tr><tr bgcolor=""> <th>HCI_TEL</th> <td>65618712</td> </tr><tr bgcolor="#E3E3F3"> <th>POSTAL_CD</th> <td>650177</td> </tr><tr bgcolor=""> <th>ADDR_TYPE</th> <td>A</td> </tr><tr bgcolor="#E3E3F3"> <th>BLK_HSE_NO</th> <td>177</td> </tr><tr bgcolor=""> <th>FLOOR_NO</th> <td>01</td> </tr><tr bgcolor="#E3E3F3"> <th>UNIT_NO</th> <td>259</td> </tr><tr bgcolor=""> <th>STREET_NAME</th> <td>BT BATOK WEST AVE 8</td> </tr><tr bgcolor="#E3E3F3"> <th>BUILDING_NAME</th> <td></td> </tr><tr bgcolor=""> <th>CLINIC_PROGRAMME_CODE</th> <td>CDMP,CHAS,ISP</td> </tr><tr bgcolor="#E3E3F3"> <th>X_COORDINATE</th> <td>17808.54269556</td> </tr><tr bgcolor=""> <th>Y_COORDINATE</th> <td>36497.59486993</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>1678EB41FB069F2B</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190213130534</td> </tr></table></center>
10 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>HCI_CODE</th> <td>9400154</td> </tr><tr bgcolor=""> <th>HCI_NAME</th> <td>C K TAN FAMILY CLINIC & SURGERY PTE LTD</td> </tr><tr bgcolor="#E3E3F3"> <th>LICENCE_TYPE</th> <td>MD</td> </tr><tr bgcolor=""> <th>HCI_TEL</th> <td>62514438</td> </tr><tr bgcolor="#E3E3F3"> <th>POSTAL_CD</th> <td>310125</td> </tr><tr bgcolor=""> <th>ADDR_TYPE</th> <td>A</td> </tr><tr bgcolor="#E3E3F3"> <th>BLK_HSE_NO</th> <td>125</td> </tr><tr bgcolor=""> <th>FLOOR_NO</th> <td>01</td> </tr><tr bgcolor="#E3E3F3"> <th>UNIT_NO</th> <td>537</td> </tr><tr bgcolor=""> <th>STREET_NAME</th> <td>TOA PAYOH LOR 1</td> </tr><tr bgcolor="#E3E3F3"> <th>BUILDING_NAME</th> <td></td> </tr><tr bgcolor=""> <th>CLINIC_PROGRAMME_CODE</th> <td>CDMP,CHAS,ISP</td> </tr><tr bgcolor="#E3E3F3"> <th>X_COORDINATE</th> <td>29382.05076063</td> </tr><tr bgcolor=""> <th>Y_COORDINATE</th> <td>35611.3990661</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>C04D108D1F0B247A</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190213130534</td> </tr></table></center>
geometry
1 POINT (103.878 1.372037)
2 POINT (103.8525 1.321296)
3 POINT (103.7981 1.445623)
4 POINT (103.8275 1.289058)
5 POINT (103.859 1.295932)
6 POINT (103.7519 1.336499)
7 POINT (103.7124 1.346348)
8 POINT (103.9293 1.313169)
9 POINT (103.7417 1.346344)
10 POINT (103.8457 1.338331)
3.1.1 Verifying Coordinate System
Though projected coordinate system is used, let’s assign a specific a CRS (Singapore) for our use case.
<- sg_area %>% st_transform(crs = 3414)
sg_area sg_area
From the output, we can see that Projected CRS: SVY21 / Singapore TM is used which is correct. We have successfully converted Geographic Coordinate System to Projected Coordinate System.
CRS value of 3414 has been properly assigned!
Checking how the geospatial data we’ve just imported looks like geometrically. It does resemble Singapore’s map quite closely!
st_crs(childcare_sf)
Coordinate Reference System:
User input: SVY21 / Singapore TM
wkt:
PROJCRS["SVY21 / Singapore TM",
BASEGEOGCRS["SVY21",
DATUM["SVY21",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4757]],
CONVERSION["Singapore Transverse Mercator",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",1.36666666666667,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",103.833333333333,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["Scale factor at natural origin",1,
SCALEUNIT["unity",1],
ID["EPSG",8805]],
PARAMETER["False easting",28001.642,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",38744.572,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["northing (N)",north,
ORDER[1],
LENGTHUNIT["metre",1]],
AXIS["easting (E)",east,
ORDER[2],
LENGTHUNIT["metre",1]],
USAGE[
SCOPE["Cadastre, engineering survey, topographic mapping."],
AREA["Singapore - onshore and offshore."],
BBOX[1.13,103.59,1.47,104.07]],
ID["EPSG",3414]]
In correct Project Coordinated System format (Singapore)! No transformation needed!
st_crs(eldercare_sf)
Coordinate Reference System:
User input: SVY21
wkt:
PROJCRS["SVY21",
BASEGEOGCRS["SVY21[WGS84]",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]],
ID["EPSG",6326]],
PRIMEM["Greenwich",0,
ANGLEUNIT["Degree",0.0174532925199433]]],
CONVERSION["unnamed",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",1.36666666666667,
ANGLEUNIT["Degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",103.833333333333,
ANGLEUNIT["Degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["Scale factor at natural origin",1,
SCALEUNIT["unity",1],
ID["EPSG",8805]],
PARAMETER["False easting",28001.642,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",38744.572,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["(E)",east,
ORDER[1],
LENGTHUNIT["metre",1,
ID["EPSG",9001]]],
AXIS["(N)",north,
ORDER[2],
LENGTHUNIT["metre",1,
ID["EPSG",9001]]]]
eldercare_sf is not in the right coordinate system and the code is incorrect.
<- eldercare_sf %>% st_transform(crs = 3414)
eldercare_sf eldercare_sf
Simple feature collection with 133 features and 18 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 14481.92 ymin: 28218.43 xmax: 41665.14 ymax: 46804.9
Projected CRS: SVY21 / Singapore TM
First 10 features:
OBJECTID ADDRESSBLO ADDRESSBUI ADDRESSPOS
1 1 <NA> <NA> 601318
2 2 <NA> <NA> 462509
3 3 <NA> <NA> 640190
4 4 <NA> <NA> 190005
5 5 <NA> <NA> 160044
6 6 <NA> <NA> 160117
7 7 <NA> <NA> 523499
8 8 <NA> <NA> 731569
9 9 <NA> <NA> 651210
10 10 <NA> <NA> 540182
ADDRESSSTR ADDRESSTYP DESCRIPTIO HYPERLINK
1 318A Jurong East Avenue 1 #02-308 <NA> <NA> <NA>
2 Blk 509B Bedok North Street 3 #02-157 <NA> <NA> <NA>
3 Blk 190 Boon Lay Drive #01-242 <NA> <NA> <NA>
4 5 Beach Rd #02-4943 <NA> <NA> <NA>
5 Blk 44 Beo Crescent #01-67 <NA> <NA> <NA>
6 Blk 117 Jalan Bukit Merah #01-1683 <NA> <NA> <NA>
7 499C Tampines Ave 9 #01-256 <NA> <NA> <NA>
8 569A Champion Way #01-346 <NA> <NA> <NA>
9 210A Bukit Batok St 21 #01-294 <NA> <NA> <NA>
10 Blk 182 Rivervale Crescent\n#01-311 <NA> <NA> <NA>
LANDXADDRE LANDYADDRE
1 0 0
2 0 0
3 0 0
4 0 0
5 0 0
6 0 0
7 0 0
8 0 0
9 0 0
10 0 0
NAME PHOTOURL
1 Yuhua Senior Activity Centre <NA>
2 THK SAC @ Kaki Bukit <NA>
3 THK SAC @ Boon Lay <NA>
4 PEACE-Connect Senior Activity Centre@5 <NA>
5 THK SAC @ Beo Crescent <NA>
6 Silver ACE @ Bukit Merah <NA>
7 Lions Befrienders Senior Activity Centre @ Tampines Blk 499C <NA>
8 Care Corner Senior Activity Centre (WL569) <NA>
9 Fei Yue Senior Activity Centre (Bukit Batok Branch) <NA>
10 COMNET Senior Activity Centre @ 182 Rivervale Crescent <NA>
ADDRESSFLO INC_CRC FMEL_UPD_D ADDRESSUNI X_ADDR Y_ADDR
1 <NA> 2B0DB92FDD914FFC 2016-07-28 <NA> 16614.08 36639.12
2 <NA> 82728FA30612F3FD 2016-07-28 <NA> 38803.81 35098.78
3 <NA> DE7A8D4EA0BD1D9B 2016-07-28 <NA> 14481.92 36357.61
4 <NA> A2C058FC5785F7FE 2016-07-28 <NA> 31505.35 31853.52
5 <NA> 9DBFD51E056AEE70 2016-07-28 <NA> 27218.35 30135.49
6 <NA> 169DABA5B6ECEA87 2016-07-28 <NA> 27278.94 29350.17
7 <NA> 5DB6B9F0BF276F6D 2016-07-28 <NA> 41665.14 37956.92
8 <NA> 4DC6800E9BB385BE 2016-07-28 <NA> 23147.94 45761.17
9 <NA> EFBD712DA5DD6FEC 2016-07-28 <NA> 18820.58 36396.32
10 <NA> 6BB0D7698D7B4C7D 2016-07-28 <NA> 36446.37 41376.90
geometry
1 POINT (16614.08 36639.12)
2 POINT (38803.81 35098.78)
3 POINT (14481.92 36357.61)
4 POINT (31505.35 31853.52)
5 POINT (27218.35 30135.49)
6 POINT (27278.94 29350.17)
7 POINT (41665.14 37956.92)
8 POINT (23147.94 45761.17)
9 POINT (18820.58 36396.32)
10 POINT (36446.37 41376.9)
st_crs(eldercare_sf)
Coordinate Reference System:
User input: EPSG:3414
wkt:
PROJCRS["SVY21 / Singapore TM",
BASEGEOGCRS["SVY21",
DATUM["SVY21",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4757]],
CONVERSION["Singapore Transverse Mercator",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",1.36666666666667,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",103.833333333333,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["Scale factor at natural origin",1,
SCALEUNIT["unity",1],
ID["EPSG",8805]],
PARAMETER["False easting",28001.642,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",38744.572,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["northing (N)",north,
ORDER[1],
LENGTHUNIT["metre",1]],
AXIS["easting (E)",east,
ORDER[2],
LENGTHUNIT["metre",1]],
USAGE[
SCOPE["Cadastre, engineering survey, topographic mapping."],
AREA["Singapore - onshore and offshore."],
BBOX[1.13,103.59,1.47,104.07]],
ID["EPSG",3414]]
st_crs(busstop_sf)
Coordinate Reference System:
User input: SVY21
wkt:
PROJCRS["SVY21",
BASEGEOGCRS["WGS 84",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]],
ID["EPSG",6326]],
PRIMEM["Greenwich",0,
ANGLEUNIT["Degree",0.0174532925199433]]],
CONVERSION["unnamed",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",1.36666666666667,
ANGLEUNIT["Degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",103.833333333333,
ANGLEUNIT["Degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["Scale factor at natural origin",1,
SCALEUNIT["unity",1],
ID["EPSG",8805]],
PARAMETER["False easting",28001.642,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",38744.572,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["(E)",east,
ORDER[1],
LENGTHUNIT["metre",1,
ID["EPSG",9001]]],
AXIS["(N)",north,
ORDER[2],
LENGTHUNIT["metre",1,
ID["EPSG",9001]]]]
<- busstop_sf %>% st_transform(crs = 3414)
busstop_sf busstop_sf
Simple feature collection with 5159 features and 3 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 3970.122 ymin: 26482.1 xmax: 48284.56 ymax: 52983.82
Projected CRS: SVY21 / Singapore TM
First 10 features:
BUS_STOP_N BUS_ROOF_N LOC_DESC geometry
1 22069 B06 OPP CEVA LOGISTICS POINT (13576.31 32883.65)
2 32071 B23 AFT TRACK 13 POINT (13228.59 44206.38)
3 44331 B01 BLK 239 POINT (21045.1 40242.08)
4 96081 B05 GRACE INDEPENDENT CH POINT (41603.76 35413.11)
5 11561 B05 BLK 166 POINT (24568.74 30391.85)
6 66191 B03 AFT CORFE PL POINT (30951.58 38079.61)
7 23389 B02A PEC LTD POINT (12476.9 32211.6)
8 54411 B02 BLK 527 POINT (30329.45 39373.92)
9 28531 B09 BLK 536 POINT (14993.31 36905.61)
10 96139 B01 BLK 148 POINT (41642.81 36513.9)
st_crs(primaryschools_sf)
Coordinate Reference System:
User input: EPSG:3414
wkt:
PROJCRS["SVY21 / Singapore TM",
BASEGEOGCRS["SVY21",
DATUM["SVY21",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4757]],
CONVERSION["Singapore Transverse Mercator",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",1.36666666666667,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",103.833333333333,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["Scale factor at natural origin",1,
SCALEUNIT["unity",1],
ID["EPSG",8805]],
PARAMETER["False easting",28001.642,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",38744.572,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["northing (N)",north,
ORDER[1],
LENGTHUNIT["metre",1]],
AXIS["easting (E)",east,
ORDER[2],
LENGTHUNIT["metre",1]],
USAGE[
SCOPE["Cadastre, engineering survey, topographic mapping."],
AREA["Singapore - onshore and offshore."],
BBOX[1.13,103.59,1.47,104.07]],
ID["EPSG",3414]]
<- primaryschools_sf %>% st_transform(crs = 3414)
primaryschools_sf primaryschools_sf
Simple feature collection with 183 features and 4 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 11801.94 ymin: 28603.93 xmax: 42410.51 ymax: 48703.49
Projected CRS: SVY21 / Singapore TM
# A tibble: 183 × 5
school_name address posta…¹ mainl…² geometry
* <chr> <chr> <chr> <chr> <POINT [m]>
1 ADMIRALTY PRIMARY SCHOOL 11 W… 738907 PRIMARY (24296.63 47144.77)
2 AHMAD IBRAHIM PRIMARY SCHO… 10 Y… 768643 PRIMARY (27936.78 46125.16)
3 AI TONG SCHOOL 100 B… 579646 PRIMARY (27966.81 38071.92)
4 ALEXANDRA PRIMARY SCHOOL 2A P… 159016 PRIMARY (26964.86 30396.5)
5 ANCHOR GREEN PRIMARY SCHOOL 31 A… 544969 PRIMARY (34022.25 41380.93)
6 ANDERSON PRIMARY SCHOOL 19 A… 569785 PRIMARY (28898.48 40690.43)
7 ANG MO KIO PRIMARY SCHOOL 20 A… 569920 PRIMARY (28710.77 38969.81)
8 ANGLO-CHINESE SCHOOL (JUNI… 16 W… 227988 PRIMARY (28916.32 32403.75)
9 ANGLO-CHINESE SCHOOL (PRIM… 50 B… 309918 PRIMARY (28225.54 33442.72)
10 ANGSANA PRIMARY SCHOOL 3 T… 529366 PRIMARY (41160.86 36732.32)
# … with 173 more rows, and abbreviated variable names ¹postal_code,
# ²mainlevel_code
st_crs(primaryschools_sf)
Coordinate Reference System:
User input: EPSG:3414
wkt:
PROJCRS["SVY21 / Singapore TM",
BASEGEOGCRS["SVY21",
DATUM["SVY21",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4757]],
CONVERSION["Singapore Transverse Mercator",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",1.36666666666667,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",103.833333333333,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["Scale factor at natural origin",1,
SCALEUNIT["unity",1],
ID["EPSG",8805]],
PARAMETER["False easting",28001.642,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",38744.572,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["northing (N)",north,
ORDER[1],
LENGTHUNIT["metre",1]],
AXIS["easting (E)",east,
ORDER[2],
LENGTHUNIT["metre",1]],
USAGE[
SCOPE["Cadastre, engineering survey, topographic mapping."],
AREA["Singapore - onshore and offshore."],
BBOX[1.13,103.59,1.47,104.07]],
ID["EPSG",3414]]
st_crs(mrt_sf)
Coordinate Reference System:
User input: WGS 84
wkt:
GEOGCRS["WGS 84",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
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]],
ID["EPSG",4326]]
mrt_sf is not in the right coordinate system - should be projected! Let’s convert now.
<- mrt_sf %>% st_transform(crs = 3414)
mrt_sf mrt_sf
Simple feature collection with 474 features and 2 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 6134.085 ymin: 27499.7 xmax: 45356.36 ymax: 47865.92
Projected CRS: SVY21 / Singapore TM
First 10 features:
Name
1 kml_1
2 kml_2
3 kml_3
4 kml_4
5 kml_5
6 kml_6
7 kml_7
8 kml_8
9 kml_9
10 kml_10
Description
1 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>STATION_NA</th> <td></td> </tr><tr bgcolor=""> <th>EXIT_CODE</th> <td>Exit A</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>ACFD572863DE422D</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190708195912</td> </tr></table></center>
2 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>STATION_NA</th> <td></td> </tr><tr bgcolor=""> <th>EXIT_CODE</th> <td>Exit B</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>328763A3290E3CC8</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190708195912</td> </tr></table></center>
3 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>STATION_NA</th> <td></td> </tr><tr bgcolor=""> <th>EXIT_CODE</th> <td>Exit B</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>DD4FAEF984D96A47</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190708195912</td> </tr></table></center>
4 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>STATION_NA</th> <td></td> </tr><tr bgcolor=""> <th>EXIT_CODE</th> <td>Exit C</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>D92B99AC0FD16F8B</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190708195912</td> </tr></table></center>
5 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>STATION_NA</th> <td></td> </tr><tr bgcolor=""> <th>EXIT_CODE</th> <td>Exit B</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>D2E20481ED62E439</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190708195912</td> </tr></table></center>
6 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>STATION_NA</th> <td></td> </tr><tr bgcolor=""> <th>EXIT_CODE</th> <td>Exit A</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>7E887806CF052F4E</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190708195912</td> </tr></table></center>
7 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>STATION_NA</th> <td></td> </tr><tr bgcolor=""> <th>EXIT_CODE</th> <td>Exit C</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>C54A67D01293867F</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190708195912</td> </tr></table></center>
8 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>STATION_NA</th> <td></td> </tr><tr bgcolor=""> <th>EXIT_CODE</th> <td>Exit B</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>C87156CBBF363974</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190708195912</td> </tr></table></center>
9 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>STATION_NA</th> <td></td> </tr><tr bgcolor=""> <th>EXIT_CODE</th> <td>Exit A</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>C8C0EAA729F06B05</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190708195912</td> </tr></table></center>
10 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>STATION_NA</th> <td></td> </tr><tr bgcolor=""> <th>EXIT_CODE</th> <td>Exit C</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>8A21E3735E9C4992</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190708195912</td> </tr></table></center>
geometry
1 POINT (32186.93 35631.26)
2 POINT (32138.84 35639.27)
3 POINT (31181.24 33499.86)
4 POINT (31938.02 34808.14)
5 POINT (32008.06 34817.14)
6 POINT (28565.44 31376.06)
7 POINT (22908.09 31341.41)
8 POINT (29909.28 30935.73)
9 POINT (30004.21 31025.6)
10 POINT (29884.3 31042.79)
st_crs(mrt_sf)
Coordinate Reference System:
User input: EPSG:3414
wkt:
PROJCRS["SVY21 / Singapore TM",
BASEGEOGCRS["SVY21",
DATUM["SVY21",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4757]],
CONVERSION["Singapore Transverse Mercator",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",1.36666666666667,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",103.833333333333,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["Scale factor at natural origin",1,
SCALEUNIT["unity",1],
ID["EPSG",8805]],
PARAMETER["False easting",28001.642,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",38744.572,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["northing (N)",north,
ORDER[1],
LENGTHUNIT["metre",1]],
AXIS["easting (E)",east,
ORDER[2],
LENGTHUNIT["metre",1]],
USAGE[
SCOPE["Cadastre, engineering survey, topographic mapping."],
AREA["Singapore - onshore and offshore."],
BBOX[1.13,103.59,1.47,104.07]],
ID["EPSG",3414]]
st_crs(kindergarten_sf)
Coordinate Reference System:
User input: SVY21
wkt:
PROJCRS["SVY21",
BASEGEOGCRS["SVY21",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]],
ID["EPSG",6326]],
PRIMEM["Greenwich",0,
ANGLEUNIT["Degree",0.0174532925199433]]],
CONVERSION["unnamed",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",1.36666666666667,
ANGLEUNIT["Degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",103.833333333333,
ANGLEUNIT["Degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["Scale factor at natural origin",1,
SCALEUNIT["unity",1],
ID["EPSG",8805]],
PARAMETER["False easting",28001.642,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",38744.572,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["(E)",east,
ORDER[1],
LENGTHUNIT["metre",1,
ID["EPSG",9001]]],
AXIS["(N)",north,
ORDER[2],
LENGTHUNIT["metre",1,
ID["EPSG",9001]]]]
The wrong ESPG code is assigned and this is not in Projected Coordinate System.
<- kindergarten_sf %>% st_transform(crs = 3414)
kindergarten_sf kindergarten_sf
Simple feature collection with 448 features and 15 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 11909.7 ymin: 25596.33 xmax: 43395.47 ymax: 48562.06
Projected CRS: SVY21 / Singapore TM
First 10 features:
ADDRESSBLO ADDRESSBUI ADDRESSFLO ADDRESSPOS
1 <NA> <NA> <NA> 560644
2 <NA> <NA> <NA> 600251
3 <NA> <NA> <NA> 600317
4 <NA> <NA> <NA> 671455
5 <NA> <NA> <NA> 670528
6 <NA> <NA> <NA> 670620
7 <NA> <NA> <NA> 380008
8 <NA> <NA> <NA> 118643
9 <NA> <NA> <NA> 519420
10 <NA> <NA> <NA> 299574
ADDRESSSTR
1 644 Ang Mo Kio Ave 4 #01-850 S(560644)
2 251 Jurong East Street 24 Blk 247 #01-110 S(600251)
3 317 Jurong East Street 31 #01-14 S(600317)
4 455A Segar Road #01-01 S(671455)
5 528 Jelapang Road Blk 526, 532 #01-79 S(670528)
6 620 Bukit Panjang Ring Road Blk 615, 619 #01-828 S(670620)
7 8, UPPER BOON KENG ROAD, #01 - 03, MULTI STOREY CAR PARK, SINGAPORE 380008
8 302 Pasir Panjang Road S(118643)
9 4 Pasir Ris Drive 6 S(519420)
10 1 Dunearn Close S(299574)
ADDRESSTYP DESCRIPTIO HYPERLINK LANDXADDRE LANDYADDRE
1 <NA> Kindergartens <NA> 0 0
2 <NA> Kindergartens <NA> 0 0
3 <NA> Kindergartens <NA> 0 0
4 <NA> Kindergartens <NA> 0 0
5 <NA> Kindergartens <NA> 0 0
6 <NA> Kindergartens <NA> 0 0
7 <NA> Kindergartens <NA> 0 0
8 <NA> Kindergartens <NA> 0 0
9 <NA> Kindergartens <NA> 0 0
10 <NA> Kindergartens <NA> 0 0
NAME PHOTOURL
1 PCF Sparkletots Preschool @ Yio Chu Kang Blk 644 (KN) <NA>
2 PCF Sparkletots Preschool @ Yuhua Blk 251 (KN) <NA>
3 PCF Sparkletots Preschool @ Yuhua Blk 317 (KN) <NA>
4 PCF Sparkletots Preschool @ Zhenghua Blk 455A (KN) <NA>
5 PCF Sparkletots Preschool @ Zhenghua Blk 528 (KN) <NA>
6 PCF Sparkletots Preschool @ Zhenghua Blk 620 (KN) <NA>
7 PCF SPARKLETOTS PRESCHOOL@KOLAM AYER BLK 8 (DS) <NA>
8 Pearlbank Montessori Kindergarten <NA>
9 Pentecost Methodist Church Kindergarten <NA>
10 Pibos Garden Preschool <NA>
INC_CRC FMEL_UPD_D ADDRESSUNI geometry
1 904D106E26156265 2020-08-13 <NA> POINT (28847.97 40124.9)
2 F735342764BD6BCC 2020-08-13 <NA> POINT (17578.65 36146.17)
3 564523E27D221C4D 2020-08-13 <NA> POINT (16609.18 36520.38)
4 7EED470791C85B92 2020-08-13 <NA> POINT (21088.36 41055.75)
5 DEB389E855725B16 2020-08-13 <NA> POINT (20457.5 40777.31)
6 AB8E78A4C780367B 2020-08-13 <NA> POINT (20033.94 40866.5)
7 FCAA7F53E78614D6 2020-08-13 <NA> POINT (32159.15 32778.05)
8 52E6CED97C628B57 2020-08-13 <NA> POINT (22042.91 29991.61)
9 8C80D6087330C37A 2020-08-13 <NA> POINT (41780.92 39252.46)
10 179B665553AAD262 2020-08-13 <NA> POINT (25916.23 33989.13)
st_crs(kindergarten_sf)
Coordinate Reference System:
User input: EPSG:3414
wkt:
PROJCRS["SVY21 / Singapore TM",
BASEGEOGCRS["SVY21",
DATUM["SVY21",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4757]],
CONVERSION["Singapore Transverse Mercator",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",1.36666666666667,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",103.833333333333,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["Scale factor at natural origin",1,
SCALEUNIT["unity",1],
ID["EPSG",8805]],
PARAMETER["False easting",28001.642,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",38744.572,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["northing (N)",north,
ORDER[1],
LENGTHUNIT["metre",1]],
AXIS["easting (E)",east,
ORDER[2],
LENGTHUNIT["metre",1]],
USAGE[
SCOPE["Cadastre, engineering survey, topographic mapping."],
AREA["Singapore - onshore and offshore."],
BBOX[1.13,103.59,1.47,104.07]],
ID["EPSG",3414]]
st_crs(hawkercentre_sf)
Coordinate Reference System:
User input: SVY21
wkt:
PROJCRS["SVY21",
BASEGEOGCRS["SVY21[WGS84]",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]],
ID["EPSG",6326]],
PRIMEM["Greenwich",0,
ANGLEUNIT["Degree",0.0174532925199433]]],
CONVERSION["unnamed",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",1.36666666666667,
ANGLEUNIT["Degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",103.833333333333,
ANGLEUNIT["Degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["Scale factor at natural origin",1,
SCALEUNIT["unity",1],
ID["EPSG",8805]],
PARAMETER["False easting",28001.642,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",38744.572,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["(E)",east,
ORDER[1],
LENGTHUNIT["metre",1,
ID["EPSG",9001]]],
AXIS["(N)",north,
ORDER[2],
LENGTHUNIT["metre",1,
ID["EPSG",9001]]]]
<- hawkercentre_sf %>% st_transform(crs = 3414)
hawkercentre_sf hawkercentre_sf
Simple feature collection with 125 features and 21 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 12874.19 ymin: 28355.97 xmax: 45241.4 ymax: 47872.53
Projected CRS: SVY21 / Singapore TM
First 10 features:
ADDRESSBLO STATUS CLEANINGST ADDRESSUNI ADDRESSFLO HYPERLINK INFO_ON_CO
1 630 Existing <NA> <NA> <NA> <NA> <NA>
2 16 Existing <NA> <NA> <NA> <NA> <NA>
3 29 Existing <NA> <NA> <NA> <NA> <NA>
4 38A Existing <NA> <NA> <NA> <NA> <NA>
5 166 Existing <NA> <NA> <NA> <NA> <NA>
6 221A/B Existing <NA> <NA> <NA> <NA> <NA>
7 665 Existing <NA> <NA> <NA> <NA> <NA>
8 163 Existing <NA> <NA> <NA> <NA> <NA>
9 120 Existing <NA> <NA> <NA> <NA> <NA>
10 115 Existing <NA> <NA> <NA> <NA> <NA>
AWARDED_DA LANDYADDRE CLEANINGEN
1 <NA> 35039.64 <NA>
2 <NA> 33645.70 <NA>
3 <NA> 33497.85 <NA>
4 <NA> 30136.92 <NA>
5 <NA> 32184.16 <NA>
6 <NA> 36373.79 <NA>
7 <NA> 32059.13 <NA>
8 <NA> 29569.73 <NA>
9 <NA> 29857.81 <NA>
10 <NA> 29770.11 <NA>
PHOTOURL
1 http://www.nea.gov.sg/images/default-source/Hawker-Centres-Division/resize_1262155176127.jpg
2 http://www.nea.gov.sg/images/default-source/Hawker-Centres-Division/resize_1267853021378.jpg
3 http://www.nea.gov.sg/images/default-source/Hawker-Centres-Division/resize_1262226446535.jpg
4 http://www.nea.gov.sg/images/default-source/Hawker-Centres-Division/resize_1267807628554.jpg
5 http://www.nea.gov.sg/images/default-source/Hawker-Centres-Division/resize_1265176120532.jpg
6 http://www.nea.gov.sg/images/default-source/Hawker-Centres-Division/resize_1262154766447.jpg
7 http://www.nea.gov.sg/images/default-source/Hawker-Centres-Division/resize_1262156313186.jpg
8 http://www.nea.gov.sg/images/default-source/Hawker-Centres-Division/resize_1267851995788.jpg
9 http://www.nea.gov.sg/images/default-source/Hawker-Centres-Division/resize_1267852344747.jpg
10 http://www.nea.gov.sg/images/default-source/Hawker-Centres-Division/resize_1267851251303.jpg
DESCRIPTIO
1 HUP Rebuilding
2 HUP Standard Upgrading
3 HUP Standard Upgrading
4 HUP Standard Upgrading
5 HUP Standard Upgrading
6 HUP Reconfiguration
7 HUP Standard Upgrading
8 Opted out of HUP
9 HUP Standard Upgrading
10 HUP Standard Upgrading
NAME
1 Bedok Reservoir Road Blk 630
2 Bedok South Road Blk 16
3 Bendemeer Road Blk 29 (Bendemeer Market and Food Centre)
4 Beo Crescent Market
5 Berseh Food Centre
6 Boon Lay Place Blk 221A/B (Boon Lay Place Market and Food Village)
7 Buffalo Road Blk 665 (Tekka Centre/Zhu Jiao Market)
8 Bukit Merah Central Blk 163 (Bukit Merah Central Food Centre)
9 Bukit Merah Lane 1 Blk 120 (Alexandra Village Food Centre)
10 Bukit Merah View Blk 115 (Blk 115 Bukit Merah View Market and Food Centre)
ADDRESSTYP ADDRESSBUI LANDXADDRE ADDRESSSTR ADDRESSPOS IMPLEMENTA
1 I <NA> 36985.00 Bedok Reservoir Road 470630 <NA>
2 I <NA> 39376.14 Bedok South Road 460016 <NA>
3 I <NA> 31305.63 Bendemeer Road 330029 <NA>
4 I <NA> 27336.64 Beo Crescent 169982 <NA>
5 I <NA> 30619.27 Jalan Besar 208877 <NA>
6 I <NA> 14587.57 Boon Lay Place 641221 <NA>
7 I <NA> 29915.58 Buffalo Road 210665 <NA>
8 I <NA> 26183.03 Bukit Merah Central 150163 <NA>
9 I <NA> 24791.54 Bukit Merah Lane 1 150120 <NA>
10 I <NA> 26745.83 Bukit Merah View 151115 <NA>
INC_CRC FMEL_UPD_D geometry
1 BBA7FF2BCA329EE8 2021-10-25 POINT (36985 35039.64)
2 483F3877B4EE039F 2021-10-25 POINT (39376.14 33645.7)
3 A7DB5A3EB9F35DE3 2021-10-25 POINT (31305.63 33497.85)
4 D232402B3632CAB2 2021-10-25 POINT (27336.64 30136.92)
5 A7CCEB2CC0B77C6D 2021-10-25 POINT (30619.27 32184.16)
6 84F8C2B4D627C21E 2021-10-25 POINT (14587.57 36373.79)
7 D09ADF340C3B739E 2021-10-25 POINT (29915.58 32059.13)
8 16F0047A1B5AC0D0 2021-10-25 POINT (26183.03 29569.73)
9 98A3C26D3632E680 2021-10-25 POINT (24791.54 29857.81)
10 7A2BDBF509B4F7FF 2021-10-25 POINT (26745.83 29770.11)
st_crs(hawkercentre_sf)
Coordinate Reference System:
User input: EPSG:3414
wkt:
PROJCRS["SVY21 / Singapore TM",
BASEGEOGCRS["SVY21",
DATUM["SVY21",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4757]],
CONVERSION["Singapore Transverse Mercator",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",1.36666666666667,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",103.833333333333,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["Scale factor at natural origin",1,
SCALEUNIT["unity",1],
ID["EPSG",8805]],
PARAMETER["False easting",28001.642,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",38744.572,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["northing (N)",north,
ORDER[1],
LENGTHUNIT["metre",1]],
AXIS["easting (E)",east,
ORDER[2],
LENGTHUNIT["metre",1]],
USAGE[
SCOPE["Cadastre, engineering survey, topographic mapping."],
AREA["Singapore - onshore and offshore."],
BBOX[1.13,103.59,1.47,104.07]],
ID["EPSG",3414]]
st_crs(nationalparks_sf)
Coordinate Reference System:
User input: SVY21
wkt:
PROJCRS["SVY21",
BASEGEOGCRS["SVY21[WGS84]",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]],
ID["EPSG",6326]],
PRIMEM["Greenwich",0,
ANGLEUNIT["Degree",0.0174532925199433]]],
CONVERSION["unnamed",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",1.36666666666667,
ANGLEUNIT["Degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",103.833333333333,
ANGLEUNIT["Degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["Scale factor at natural origin",1,
SCALEUNIT["unity",1],
ID["EPSG",8805]],
PARAMETER["False easting",28001.642,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",38744.572,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["(E)",east,
ORDER[1],
LENGTHUNIT["metre",1,
ID["EPSG",9001]]],
AXIS["(N)",north,
ORDER[2],
LENGTHUNIT["metre",1,
ID["EPSG",9001]]]]
<- nationalparks_sf %>% st_transform(crs = 3414)
nationalparks_sf nationalparks_sf
Simple feature collection with 352 features and 15 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 12373.11 ymin: 21869.93 xmax: 46735.95 ymax: 49231.09
Projected CRS: SVY21 / Singapore TM
First 10 features:
ADDRESSBLO ADDRESSBUI ADDRESSTYP
1 <NA> <NA> <NA>
2 <NA> <NA> <NA>
3 <NA> <NA> <NA>
4 <NA> <NA> <NA>
5 <NA> <NA> <NA>
6 <NA> <NA> <NA>
7 <NA> <NA> <NA>
8 <NA> <NA> <NA>
9 <NA> <NA> <NA>
10 <NA> <NA> <NA>
HYPERLINK
1 <NA>
2 <NA>
3 <NA>
4 <NA>
5 <NA>
6 <NA>
7 www.nparks.gov.sg/gardens-parks-and-nature/parks-and-nature-reserves/sun-plaza-park
8 <NA>
9 <NA>
10 <NA>
LANDXADDRE LANDYADDRE NAME PHOTOURL ADDRESSPOS
1 29594.30 29323.41 Telok Ayer Green <NA> <NA>
2 28695.60 39413.70 Mayflower Crescent Playground <NA> <NA>
3 30676.61 41137.35 Sunrise Drive Playground 1 <NA> <NA>
4 39994.09 39355.59 Elias Terrace Playground <NA> <NA>
5 40813.11 33764.61 Kew Avenue Playground <NA> <NA>
6 37385.95 32814.41 Greenfield Drive Playground <NA> <NA>
7 40371.20 37926.31 Sun Plaza Park <NA> <NA>
8 45135.69 41460.78 Changi Point Ferry Terminal <NA> <NA>
9 27896.88 39226.05 Shangri-La Playground <NA> <NA>
10 38142.70 33595.77 Opera Estate Football Field <NA> <NA>
DESCRIPTIO ADDRESSSTR
1 Bounded by Amoy Street, Boon Tat Street and Telok Ayer Street <NA>
2 At the junction of Mayflower Crescent and Mayflower Avenue <NA>
3 Located along Sunrise Drive <NA>
4 Junction of Elias Terrace and Elias Green <NA>
5 Junction of Kew Avenue and Kew Drive <NA>
6 Greenfield Drive <NA>
7 Along Tampines Avenue 7, Tampines Avenue 9 <NA>
8 Near Lor Bekukong <NA>
9 Junction of Ang Mo Kio Ave 2 and Jalan Lanjut <NA>
10 Swan Lake Avenue <NA>
ADDRESSFLO INC_CRC FMEL_UPD_D ADDRESSUNI geometry
1 <NA> 07CFE6567539200A 2020-02-18 <NA> POINT (29594.3 29323.41)
2 <NA> B01AE2FF8B58F5CA 2020-02-18 <NA> POINT (28695.6 39413.7)
3 <NA> 66086C14E8DACE2D 2020-02-18 <NA> POINT (30676.61 41137.35)
4 <NA> 8B06ED4574E90FC9 2020-02-18 <NA> POINT (39994.09 39355.59)
5 <NA> E3FD62E109D01A9C 2020-02-18 <NA> POINT (40813.11 33764.61)
6 <NA> 8B896BD1155428FB 2020-02-18 <NA> POINT (37385.95 32814.41)
7 <NA> 5BBA8A8EB630BA01 2020-02-18 <NA> POINT (40371.2 37926.31)
8 <NA> AA9DDE6381971B22 2020-02-18 <NA> POINT (45135.69 41460.78)
9 <NA> FF16ED3C3767BD2C 2020-02-18 <NA> POINT (27896.88 39226.05)
10 <NA> AD2BA4AF1306E38A 2020-02-18 <NA> POINT (38142.7 33595.77)
st_crs(nationalparks_sf)
Coordinate Reference System:
User input: EPSG:3414
wkt:
PROJCRS["SVY21 / Singapore TM",
BASEGEOGCRS["SVY21",
DATUM["SVY21",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4757]],
CONVERSION["Singapore Transverse Mercator",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",1.36666666666667,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",103.833333333333,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["Scale factor at natural origin",1,
SCALEUNIT["unity",1],
ID["EPSG",8805]],
PARAMETER["False easting",28001.642,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",38744.572,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["northing (N)",north,
ORDER[1],
LENGTHUNIT["metre",1]],
AXIS["easting (E)",east,
ORDER[2],
LENGTHUNIT["metre",1]],
USAGE[
SCOPE["Cadastre, engineering survey, topographic mapping."],
AREA["Singapore - onshore and offshore."],
BBOX[1.13,103.59,1.47,104.07]],
ID["EPSG",3414]]
st_crs(supermarkets_sf)
Coordinate Reference System:
User input: SVY21
wkt:
PROJCRS["SVY21",
BASEGEOGCRS["WGS 84",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]],
ID["EPSG",6326]],
PRIMEM["Greenwich",0,
ANGLEUNIT["Degree",0.0174532925199433]]],
CONVERSION["unnamed",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",1.36666666666667,
ANGLEUNIT["Degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",103.833333333333,
ANGLEUNIT["Degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["Scale factor at natural origin",1,
SCALEUNIT["unity",1],
ID["EPSG",8805]],
PARAMETER["False easting",28001.642,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",38744.572,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["(E)",east,
ORDER[1],
LENGTHUNIT["metre",1,
ID["EPSG",9001]]],
AXIS["(N)",north,
ORDER[2],
LENGTHUNIT["metre",1,
ID["EPSG",9001]]]]
<- supermarkets_sf %>% st_transform(crs = 3414)
supermarkets_sf supermarkets_sf
Simple feature collection with 526 features and 8 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 4901.188 ymin: 25529.08 xmax: 46948.22 ymax: 49233.6
Projected CRS: SVY21 / Singapore TM
First 10 features:
LIC_NAME BLK_HOUSE STR_NAME
1 LI LI CHENG SUPERMARKET (PUNGGOL) PTE. LTD. 273C PUNGGOL PLACE
2 SHENG SIONG SUPERMARKET PTE LTD 11 UPPER BOON KENG ROAD
3 COLD STORAGE SINGAPORE (1983) PTE LTD 683 HOUGANG AVENUE 8
4 COLD STORAGE SINGAPORE (1983) PTE LTD 631 BEDOK RESERVOIR ROAD
5 YES SUPERMARKET PTE LTD 201B TAMPINES STREET 21
6 SUZYAMEER FROZEN PTE. LTD. 201D TAMPINES STREET 21
7 G8 MART PTE. LTD. 421 ANG MO KIO AVENUE 10
8 SHENG SIONG SUPERMARKET PTE LTD 233 ANG MO KIO AVENUE 3
9 PRIME SUPERMARKET (1996) PTE LTD 106 HOUGANG AVENUE 1
10 TAN KWEE ENG 327 YISHUN RING ROAD
UNIT_NO POSTCODE LIC_NO INC_CRC FMEL_UPD_D
1 884 823273 NE12I65N000 3DE8AF6E76F9D3D4 2017-11-29
2 901 380011 E73010V000 F361759A8261CD6E 2017-11-29
3 903 530683 NE11909C000 1DC69902E02077CE 2017-11-29
4 954 470631 S02210X000 4E2560154B58BA38 2017-11-29
5 1091 522201 S02037J000 559A9A00D9FF8A55 2017-11-29
6 1161 524201 NE08357A000 1D32060098628881 2017-11-29
7 1161 560421 CE13401C000 E83AE5A9842F67BC 2017-11-29
8 1168 560233 CE04334P000 08D1E417EB224327 2017-11-29
9 1213 530106 S02059X000 3DA5C840D472C779 2017-11-29
10 1320 760327 B02041C000 FBB8A845FD8ADDC4 2017-11-29
geometry
1 POINT (35561.22 42685.17)
2 POINT (32184.01 32947.46)
3 POINT (33903.48 39480.46)
4 POINT (37083.82 35017.47)
5 POINT (41320.3 37283.82)
6 POINT (41384.47 37152.14)
7 POINT (30186.63 38602.77)
8 POINT (28380.83 38842.16)
9 POINT (34383.76 37311.19)
10 POINT (29010.23 45755.51)
st_crs(supermarkets_sf)
Coordinate Reference System:
User input: EPSG:3414
wkt:
PROJCRS["SVY21 / Singapore TM",
BASEGEOGCRS["SVY21",
DATUM["SVY21",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4757]],
CONVERSION["Singapore Transverse Mercator",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",1.36666666666667,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",103.833333333333,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["Scale factor at natural origin",1,
SCALEUNIT["unity",1],
ID["EPSG",8805]],
PARAMETER["False easting",28001.642,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",38744.572,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["northing (N)",north,
ORDER[1],
LENGTHUNIT["metre",1]],
AXIS["easting (E)",east,
ORDER[2],
LENGTHUNIT["metre",1]],
USAGE[
SCOPE["Cadastre, engineering survey, topographic mapping."],
AREA["Singapore - onshore and offshore."],
BBOX[1.13,103.59,1.47,104.07]],
ID["EPSG",3414]]
st_crs(topprimary_sf)
Coordinate Reference System:
User input: EPSG:3414
wkt:
PROJCRS["SVY21 / Singapore TM",
BASEGEOGCRS["SVY21",
DATUM["SVY21",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4757]],
CONVERSION["Singapore Transverse Mercator",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",1.36666666666667,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",103.833333333333,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["Scale factor at natural origin",1,
SCALEUNIT["unity",1],
ID["EPSG",8805]],
PARAMETER["False easting",28001.642,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",38744.572,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["northing (N)",north,
ORDER[1],
LENGTHUNIT["metre",1]],
AXIS["easting (E)",east,
ORDER[2],
LENGTHUNIT["metre",1]],
USAGE[
SCOPE["Cadastre, engineering survey, topographic mapping."],
AREA["Singapore - onshore and offshore."],
BBOX[1.13,103.59,1.47,104.07]],
ID["EPSG",3414]]
st_crs(mall_coordinates_sf)
Coordinate Reference System:
User input: EPSG:3414
wkt:
PROJCRS["SVY21 / Singapore TM",
BASEGEOGCRS["SVY21",
DATUM["SVY21",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4757]],
CONVERSION["Singapore Transverse Mercator",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",1.36666666666667,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",103.833333333333,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["Scale factor at natural origin",1,
SCALEUNIT["unity",1],
ID["EPSG",8805]],
PARAMETER["False easting",28001.642,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",38744.572,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["northing (N)",north,
ORDER[1],
LENGTHUNIT["metre",1]],
AXIS["easting (E)",east,
ORDER[2],
LENGTHUNIT["metre",1]],
USAGE[
SCOPE["Cadastre, engineering survey, topographic mapping."],
AREA["Singapore - onshore and offshore."],
BBOX[1.13,103.59,1.47,104.07]],
ID["EPSG",3414]]
plot(st_geometry(sg_area))
st_crs(cbd_coords_sf)
Coordinate Reference System:
User input: EPSG:3414
wkt:
PROJCRS["SVY21 / Singapore TM",
BASEGEOGCRS["SVY21",
DATUM["SVY21",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4757]],
CONVERSION["Singapore Transverse Mercator",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",1.36666666666667,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",103.833333333333,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["Scale factor at natural origin",1,
SCALEUNIT["unity",1],
ID["EPSG",8805]],
PARAMETER["False easting",28001.642,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",38744.572,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["northing (N)",north,
ORDER[1],
LENGTHUNIT["metre",1]],
AXIS["easting (E)",east,
ORDER[2],
LENGTHUNIT["metre",1]],
USAGE[
SCOPE["Cadastre, engineering survey, topographic mapping."],
AREA["Singapore - onshore and offshore."],
BBOX[1.13,103.59,1.47,104.07]],
ID["EPSG",3414]]
cbd_coords_sf
Simple feature collection with 1 feature and 1 field
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 30055.05 ymin: 30040.83 xmax: 30055.05 ymax: 30040.83
Projected CRS: SVY21 / Singapore TM
name geometry
1 CBD Area POINT (30055.05 30040.83)
st_crs(chas_sf)
Coordinate Reference System:
User input: WGS 84
wkt:
GEOGCRS["WGS 84",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
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]],
ID["EPSG",4326]]
<- chas_sf %>% st_transform(crs = 3414)
chas_sf chas_sf
Simple feature collection with 1064 features and 2 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 2.127126e-08 ymin: -5.585825e-07 xmax: 45475.65 ymax: 48626.7
Projected CRS: SVY21 / Singapore TM
First 10 features:
Name
1 kml_1
2 kml_2
3 kml_3
4 kml_4
5 kml_5
6 kml_6
7 kml_7
8 kml_8
9 kml_9
10 kml_10
Description
1 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>HCI_CODE</th> <td>13C0197</td> </tr><tr bgcolor=""> <th>HCI_NAME</th> <td>BVH Community and Continuing Care Clinic</td> </tr><tr bgcolor="#E3E3F3"> <th>LICENCE_TYPE</th> <td>MD</td> </tr><tr bgcolor=""> <th>HCI_TEL</th> <td>62485749</td> </tr><tr bgcolor="#E3E3F3"> <th>POSTAL_CD</th> <td>547530</td> </tr><tr bgcolor=""> <th>ADDR_TYPE</th> <td>B</td> </tr><tr bgcolor="#E3E3F3"> <th>BLK_HSE_NO</th> <td>5</td> </tr><tr bgcolor=""> <th>FLOOR_NO</th> <td></td> </tr><tr bgcolor="#E3E3F3"> <th>UNIT_NO</th> <td></td> </tr><tr bgcolor=""> <th>STREET_NAME</th> <td>LORONG NAPIRI</td> </tr><tr bgcolor="#E3E3F3"> <th>BUILDING_NAME</th> <td>BRIGHT VISION HOSPITAL (LEVEL 2)</td> </tr><tr bgcolor=""> <th>CLINIC_PROGRAMME_CODE</th> <td>CDMP,CHAS,ISP</td> </tr><tr bgcolor="#E3E3F3"> <th>X_COORDINATE</th> <td>32975.96333266</td> </tr><tr bgcolor=""> <th>Y_COORDINATE</th> <td>39338.44369977</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>78FBD9F763FA1748</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190213130534</td> </tr></table></center>
2 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>HCI_CODE</th> <td>9404225</td> </tr><tr bgcolor=""> <th>HCI_NAME</th> <td>Balestier Clinic and Health Screening Centre</td> </tr><tr bgcolor="#E3E3F3"> <th>LICENCE_TYPE</th> <td>MD</td> </tr><tr bgcolor=""> <th>HCI_TEL</th> <td>62588798</td> </tr><tr bgcolor="#E3E3F3"> <th>POSTAL_CD</th> <td>329928</td> </tr><tr bgcolor=""> <th>ADDR_TYPE</th> <td>B</td> </tr><tr bgcolor="#E3E3F3"> <th>BLK_HSE_NO</th> <td>221</td> </tr><tr bgcolor=""> <th>FLOOR_NO</th> <td>03</td> </tr><tr bgcolor="#E3E3F3"> <th>UNIT_NO</th> <td>04</td> </tr><tr bgcolor=""> <th>STREET_NAME</th> <td>Balestier Road</td> </tr><tr bgcolor="#E3E3F3"> <th>BUILDING_NAME</th> <td>Rocca Balestier</td> </tr><tr bgcolor=""> <th>CLINIC_PROGRAMME_CODE</th> <td>CDMP,CHAS,ISP</td> </tr><tr bgcolor="#E3E3F3"> <th>X_COORDINATE</th> <td>30137.60782798</td> </tr><tr bgcolor=""> <th>Y_COORDINATE</th> <td>33727.68326718</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>FE3FEA6E72F6A9CD</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190213130534</td> </tr></table></center>
3 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>HCI_CODE</th> <td>9402787</td> </tr><tr bgcolor=""> <th>HCI_NAME</th> <td>Banyan Clinic Pte Ltd.</td> </tr><tr bgcolor="#E3E3F3"> <th>LICENCE_TYPE</th> <td>MD</td> </tr><tr bgcolor=""> <th>HCI_TEL</th> <td>63652001</td> </tr><tr bgcolor="#E3E3F3"> <th>POSTAL_CD</th> <td>730768</td> </tr><tr bgcolor=""> <th>ADDR_TYPE</th> <td>A</td> </tr><tr bgcolor="#E3E3F3"> <th>BLK_HSE_NO</th> <td>768</td> </tr><tr bgcolor=""> <th>FLOOR_NO</th> <td>02</td> </tr><tr bgcolor="#E3E3F3"> <th>UNIT_NO</th> <td>04</td> </tr><tr bgcolor=""> <th>STREET_NAME</th> <td>Woodlands Avenue 6</td> </tr><tr bgcolor="#E3E3F3"> <th>BUILDING_NAME</th> <td>Woodlands Mart</td> </tr><tr bgcolor=""> <th>CLINIC_PROGRAMME_CODE</th> <td>CDMP,CHAS,ISP</td> </tr><tr bgcolor="#E3E3F3"> <th>X_COORDINATE</th> <td>24085.28700111</td> </tr><tr bgcolor=""> <th>Y_COORDINATE</th> <td>47475.18426852</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>BDFADA141BC3C5C0</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190213130534</td> </tr></table></center>
4 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>HCI_CODE</th> <td>12C0244</td> </tr><tr bgcolor=""> <th>HCI_NAME</th> <td>Beo Crescent Clinic & Surgery</td> </tr><tr bgcolor="#E3E3F3"> <th>LICENCE_TYPE</th> <td>MD</td> </tr><tr bgcolor=""> <th>HCI_TEL</th> <td>62750269</td> </tr><tr bgcolor="#E3E3F3"> <th>POSTAL_CD</th> <td>160040</td> </tr><tr bgcolor=""> <th>ADDR_TYPE</th> <td>A</td> </tr><tr bgcolor="#E3E3F3"> <th>BLK_HSE_NO</th> <td>40</td> </tr><tr bgcolor=""> <th>FLOOR_NO</th> <td>01</td> </tr><tr bgcolor="#E3E3F3"> <th>UNIT_NO</th> <td>02</td> </tr><tr bgcolor=""> <th>STREET_NAME</th> <td>Beo Crescent</td> </tr><tr bgcolor="#E3E3F3"> <th>BUILDING_NAME</th> <td></td> </tr><tr bgcolor=""> <th>CLINIC_PROGRAMME_CODE</th> <td>CDMP,CHAS,ISP</td> </tr><tr bgcolor="#E3E3F3"> <th>X_COORDINATE</th> <td>27353.89036223</td> </tr><tr bgcolor=""> <th>Y_COORDINATE</th> <td>30162.99234494</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>ACDDB5D5BB3AF37F</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190213130534</td> </tr></table></center>
5 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>HCI_CODE</th> <td>9405101</td> </tr><tr bgcolor=""> <th>HCI_NAME</th> <td>Bethesda Medical Centre</td> </tr><tr bgcolor="#E3E3F3"> <th>LICENCE_TYPE</th> <td>MD</td> </tr><tr bgcolor=""> <th>HCI_TEL</th> <td>63378933</td> </tr><tr bgcolor="#E3E3F3"> <th>POSTAL_CD</th> <td>038983</td> </tr><tr bgcolor=""> <th>ADDR_TYPE</th> <td>B</td> </tr><tr bgcolor="#E3E3F3"> <th>BLK_HSE_NO</th> <td>3</td> </tr><tr bgcolor=""> <th>FLOOR_NO</th> <td>B1</td> </tr><tr bgcolor="#E3E3F3"> <th>UNIT_NO</th> <td>124</td> </tr><tr bgcolor=""> <th>STREET_NAME</th> <td>TEMASEK BOULEVARD</td> </tr><tr bgcolor="#E3E3F3"> <th>BUILDING_NAME</th> <td>SUNTEC CITY MALL</td> </tr><tr bgcolor=""> <th>CLINIC_PROGRAMME_CODE</th> <td>CDMP,CHAS,ISP</td> </tr><tr bgcolor="#E3E3F3"> <th>X_COORDINATE</th> <td>30859.71977217</td> </tr><tr bgcolor=""> <th>Y_COORDINATE</th> <td>30923.09790327</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>0F18873C06CB85A2</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190213130534</td> </tr></table></center>
6 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>HCI_CODE</th> <td>14M0324</td> </tr><tr bgcolor=""> <th>HCI_NAME</th> <td>Bewell Clinic @ Dorm Pte Ltd</td> </tr><tr bgcolor="#E3E3F3"> <th>LICENCE_TYPE</th> <td>MC</td> </tr><tr bgcolor=""> <th>HCI_TEL</th> <td>65656338</td> </tr><tr bgcolor="#E3E3F3"> <th>POSTAL_CD</th> <td>608596</td> </tr><tr bgcolor=""> <th>ADDR_TYPE</th> <td>B</td> </tr><tr bgcolor="#E3E3F3"> <th>BLK_HSE_NO</th> <td>28</td> </tr><tr bgcolor=""> <th>FLOOR_NO</th> <td>01</td> </tr><tr bgcolor="#E3E3F3"> <th>UNIT_NO</th> <td>01</td> </tr><tr bgcolor=""> <th>STREET_NAME</th> <td>TOH GUAN ROAD EAST</td> </tr><tr bgcolor="#E3E3F3"> <th>BUILDING_NAME</th> <td>WESTLITE TOH GUAN DORMITORY</td> </tr><tr bgcolor=""> <th>CLINIC_PROGRAMME_CODE</th> <td>CDMP,CHAS,ISP</td> </tr><tr bgcolor="#E3E3F3"> <th>X_COORDINATE</th> <td>18935.85979557</td> </tr><tr bgcolor=""> <th>Y_COORDINATE</th> <td>35408.97072583</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>38F5B4509423BD1C</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190213130534</td> </tr></table></center>
7 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>HCI_CODE</th> <td>12C0252</td> </tr><tr bgcolor=""> <th>HCI_NAME</th> <td>Bless Medical Centre Pte Ltd</td> </tr><tr bgcolor="#E3E3F3"> <th>LICENCE_TYPE</th> <td>MD</td> </tr><tr bgcolor=""> <th>HCI_TEL</th> <td>62664119</td> </tr><tr bgcolor="#E3E3F3"> <th>POSTAL_CD</th> <td>640221</td> </tr><tr bgcolor=""> <th>ADDR_TYPE</th> <td>A</td> </tr><tr bgcolor="#E3E3F3"> <th>BLK_HSE_NO</th> <td>221</td> </tr><tr bgcolor=""> <th>FLOOR_NO</th> <td>01</td> </tr><tr bgcolor="#E3E3F3"> <th>UNIT_NO</th> <td>108</td> </tr><tr bgcolor=""> <th>STREET_NAME</th> <td>BOON LAY PLACE</td> </tr><tr bgcolor="#E3E3F3"> <th>BUILDING_NAME</th> <td>BOON LAY SHOPPING CENTRE</td> </tr><tr bgcolor=""> <th>CLINIC_PROGRAMME_CODE</th> <td>CDMP,CHAS,ISP</td> </tr><tr bgcolor="#E3E3F3"> <th>X_COORDINATE</th> <td>14546.34900375</td> </tr><tr bgcolor=""> <th>Y_COORDINATE</th> <td>36498.19284422</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>0A525408785D9806</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190213130534</td> </tr></table></center>
8 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>HCI_CODE</th> <td>9402741</td> </tr><tr bgcolor=""> <th>HCI_NAME</th> <td>C & K FAMILY CLINIC PTE LTD</td> </tr><tr bgcolor="#E3E3F3"> <th>LICENCE_TYPE</th> <td>MD</td> </tr><tr bgcolor=""> <th>HCI_TEL</th> <td>62429588</td> </tr><tr bgcolor="#E3E3F3"> <th>POSTAL_CD</th> <td>455297</td> </tr><tr bgcolor=""> <th>ADDR_TYPE</th> <td>B</td> </tr><tr bgcolor="#E3E3F3"> <th>BLK_HSE_NO</th> <td>108</td> </tr><tr bgcolor=""> <th>FLOOR_NO</th> <td></td> </tr><tr bgcolor="#E3E3F3"> <th>UNIT_NO</th> <td></td> </tr><tr bgcolor=""> <th>STREET_NAME</th> <td>UPPER EAST COAST ROAD</td> </tr><tr bgcolor="#E3E3F3"> <th>BUILDING_NAME</th> <td></td> </tr><tr bgcolor=""> <th>CLINIC_PROGRAMME_CODE</th> <td>CDMP,CHAS,ISP</td> </tr><tr bgcolor="#E3E3F3"> <th>X_COORDINATE</th> <td>38682.39910624</td> </tr><tr bgcolor=""> <th>Y_COORDINATE</th> <td>32829.31658602</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>CAA157915ADB2310</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190213130534</td> </tr></table></center>
9 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>HCI_CODE</th> <td>9400151</td> </tr><tr bgcolor=""> <th>HCI_NAME</th> <td>C H TAN MEDICAL CLINIC & DENTAL SURGERY</td> </tr><tr bgcolor="#E3E3F3"> <th>LICENCE_TYPE</th> <td>MD</td> </tr><tr bgcolor=""> <th>HCI_TEL</th> <td>65618712</td> </tr><tr bgcolor="#E3E3F3"> <th>POSTAL_CD</th> <td>650177</td> </tr><tr bgcolor=""> <th>ADDR_TYPE</th> <td>A</td> </tr><tr bgcolor="#E3E3F3"> <th>BLK_HSE_NO</th> <td>177</td> </tr><tr bgcolor=""> <th>FLOOR_NO</th> <td>01</td> </tr><tr bgcolor="#E3E3F3"> <th>UNIT_NO</th> <td>259</td> </tr><tr bgcolor=""> <th>STREET_NAME</th> <td>BT BATOK WEST AVE 8</td> </tr><tr bgcolor="#E3E3F3"> <th>BUILDING_NAME</th> <td></td> </tr><tr bgcolor=""> <th>CLINIC_PROGRAMME_CODE</th> <td>CDMP,CHAS,ISP</td> </tr><tr bgcolor="#E3E3F3"> <th>X_COORDINATE</th> <td>17808.54269556</td> </tr><tr bgcolor=""> <th>Y_COORDINATE</th> <td>36497.59486993</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>1678EB41FB069F2B</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190213130534</td> </tr></table></center>
10 <center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3"> <th>HCI_CODE</th> <td>9400154</td> </tr><tr bgcolor=""> <th>HCI_NAME</th> <td>C K TAN FAMILY CLINIC & SURGERY PTE LTD</td> </tr><tr bgcolor="#E3E3F3"> <th>LICENCE_TYPE</th> <td>MD</td> </tr><tr bgcolor=""> <th>HCI_TEL</th> <td>62514438</td> </tr><tr bgcolor="#E3E3F3"> <th>POSTAL_CD</th> <td>310125</td> </tr><tr bgcolor=""> <th>ADDR_TYPE</th> <td>A</td> </tr><tr bgcolor="#E3E3F3"> <th>BLK_HSE_NO</th> <td>125</td> </tr><tr bgcolor=""> <th>FLOOR_NO</th> <td>01</td> </tr><tr bgcolor="#E3E3F3"> <th>UNIT_NO</th> <td>537</td> </tr><tr bgcolor=""> <th>STREET_NAME</th> <td>TOA PAYOH LOR 1</td> </tr><tr bgcolor="#E3E3F3"> <th>BUILDING_NAME</th> <td></td> </tr><tr bgcolor=""> <th>CLINIC_PROGRAMME_CODE</th> <td>CDMP,CHAS,ISP</td> </tr><tr bgcolor="#E3E3F3"> <th>X_COORDINATE</th> <td>29382.05076063</td> </tr><tr bgcolor=""> <th>Y_COORDINATE</th> <td>35611.3990661</td> </tr><tr bgcolor="#E3E3F3"> <th>INC_CRC</th> <td>C04D108D1F0B247A</td> </tr><tr bgcolor=""> <th>FMEL_UPD_D</th> <td>20190213130534</td> </tr></table></center>
geometry
1 POINT (32975.96 39338.44)
2 POINT (30137.61 33727.68)
3 POINT (24085.29 47475.18)
4 POINT (27353.89 30162.99)
5 POINT (30859.72 30923.1)
6 POINT (18935.86 35408.97)
7 POINT (14546.35 36498.19)
8 POINT (38682.4 32829.32)
9 POINT (17808.54 36497.59)
10 POINT (29382.05 35611.4)
3.1.2 Checking For Invalid Geometries
length(which(st_is_valid(sg_area) == FALSE))
[1] 6
Oh no! Looks like there are 6 records from sg_area with invalid geometries. Before proceeding, let’s remove these records from sg_area.
<- sg_area %>% filter(st_is_valid(sg_area) == TRUE)
sg_area sg_area
Simple feature collection with 326 features and 6 fields
Geometry type: MULTIPOLYGON
Dimension: XY
Bounding box: xmin: 103.6057 ymin: 1.158699 xmax: 104.0844 ymax: 1.470775
Geodetic CRS: WGS 84
First 10 features:
SUBZONE_N SUBZONE_C PLN_AREA_N PLN_AREA_C REGION_N
1 MARINA EAST MESZ01 MARINA EAST ME CENTRAL REGION
2 INSTITUTION HILL RVSZ05 RIVER VALLEY RV CENTRAL REGION
3 ROBERTSON QUAY SRSZ01 SINGAPORE RIVER SR CENTRAL REGION
4 JURONG ISLAND AND BUKOM WISZ01 WESTERN ISLANDS WI WEST REGION
5 FORT CANNING MUSZ02 MUSEUM MU CENTRAL REGION
6 MARINA EAST (MP) MPSZ05 MARINE PARADE MP CENTRAL REGION
7 SUDONG WISZ03 WESTERN ISLANDS WI WEST REGION
8 SEMAKAU WISZ02 WESTERN ISLANDS WI WEST REGION
9 CITY TERMINALS BMSZ17 BUKIT MERAH BM CENTRAL REGION
10 ANSON DTSZ10 DOWNTOWN CORE DT CENTRAL REGION
REGION_C geometry
1 CR MULTIPOLYGON (((103.8802 1....
2 CR MULTIPOLYGON (((103.8376 1....
3 CR MULTIPOLYGON (((103.8341 1....
4 WR MULTIPOLYGON (((103.7125 1....
5 CR MULTIPOLYGON (((103.8472 1....
6 CR MULTIPOLYGON (((103.8987 1....
7 WR MULTIPOLYGON (((103.7235 1....
8 WR MULTIPOLYGON (((103.76 1.21...
9 CR MULTIPOLYGON (((103.8323 1....
10 CR MULTIPOLYGON (((103.8441 1....
length(which(st_is_valid(sg_area) == FALSE))
[1] 0
Now, all the 9 rows have been successfully dropped.
length(which(st_is_valid(childcare_sf) == FALSE))
[1] 0
length(which(st_is_valid(eldercare_sf) == FALSE))
[1] 0
length(which(st_is_valid(busstop_sf) == FALSE))
[1] 0
length(which(st_is_valid(primaryschools_sf) == FALSE))
[1] 0
length(which(st_is_valid(mrt_sf) == FALSE))
[1] 0
length(which(st_is_valid(kindergarten_sf) == FALSE))
[1] 0
length(which(st_is_valid(hawkercentre_sf) == FALSE))
[1] 0
length(which(st_is_valid(nationalparks_sf ) == FALSE))
[1] 0
length(which(st_is_valid(supermarkets_sf ) == FALSE))
[1] 0
length(which(st_is_valid(topprimary_sf) == FALSE))
[1] 0
length(which(st_is_valid(mall_coordinates_sf) == FALSE))
[1] 0
length(which(st_is_valid(cbd_coords_sf) == FALSE))
[1] 0
length(which(st_is_valid(chas_sf) == FALSE))
[1] 0
3.1.3 Checking For Missing Values
Let’s check for missing rows.
rowSums(is.na(sg_area))!=0,] sg_area[
Simple feature collection with 0 features and 6 fields
Bounding box: xmin: NA ymin: NA xmax: NA ymax: NA
Geodetic CRS: WGS 84
[1] SUBZONE_N SUBZONE_C PLN_AREA_N PLN_AREA_C REGION_N REGION_C geometry
<0 rows> (or 0-length row.names)
Looks like there are no missing rows!
rowSums(is.na(childcare_sf))!=0,] childcare_sf[
Simple feature collection with 0 features and 2 fields
Bounding box: xmin: NA ymin: NA xmax: NA ymax: NA
Projected CRS: SVY21 / Singapore TM
[1] Name Descriptio geometry
<0 rows> (or 0-length row.names)
rowSums(is.na(eldercare_sf))!=0,] eldercare_sf[
Simple feature collection with 133 features and 18 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 14481.92 ymin: 28218.43 xmax: 41665.14 ymax: 46804.9
Projected CRS: SVY21 / Singapore TM
First 10 features:
OBJECTID ADDRESSBLO ADDRESSBUI ADDRESSPOS
1 1 <NA> <NA> 601318
2 2 <NA> <NA> 462509
3 3 <NA> <NA> 640190
4 4 <NA> <NA> 190005
5 5 <NA> <NA> 160044
6 6 <NA> <NA> 160117
7 7 <NA> <NA> 523499
8 8 <NA> <NA> 731569
9 9 <NA> <NA> 651210
10 10 <NA> <NA> 540182
ADDRESSSTR ADDRESSTYP DESCRIPTIO HYPERLINK
1 318A Jurong East Avenue 1 #02-308 <NA> <NA> <NA>
2 Blk 509B Bedok North Street 3 #02-157 <NA> <NA> <NA>
3 Blk 190 Boon Lay Drive #01-242 <NA> <NA> <NA>
4 5 Beach Rd #02-4943 <NA> <NA> <NA>
5 Blk 44 Beo Crescent #01-67 <NA> <NA> <NA>
6 Blk 117 Jalan Bukit Merah #01-1683 <NA> <NA> <NA>
7 499C Tampines Ave 9 #01-256 <NA> <NA> <NA>
8 569A Champion Way #01-346 <NA> <NA> <NA>
9 210A Bukit Batok St 21 #01-294 <NA> <NA> <NA>
10 Blk 182 Rivervale Crescent\n#01-311 <NA> <NA> <NA>
LANDXADDRE LANDYADDRE
1 0 0
2 0 0
3 0 0
4 0 0
5 0 0
6 0 0
7 0 0
8 0 0
9 0 0
10 0 0
NAME PHOTOURL
1 Yuhua Senior Activity Centre <NA>
2 THK SAC @ Kaki Bukit <NA>
3 THK SAC @ Boon Lay <NA>
4 PEACE-Connect Senior Activity Centre@5 <NA>
5 THK SAC @ Beo Crescent <NA>
6 Silver ACE @ Bukit Merah <NA>
7 Lions Befrienders Senior Activity Centre @ Tampines Blk 499C <NA>
8 Care Corner Senior Activity Centre (WL569) <NA>
9 Fei Yue Senior Activity Centre (Bukit Batok Branch) <NA>
10 COMNET Senior Activity Centre @ 182 Rivervale Crescent <NA>
ADDRESSFLO INC_CRC FMEL_UPD_D ADDRESSUNI X_ADDR Y_ADDR
1 <NA> 2B0DB92FDD914FFC 2016-07-28 <NA> 16614.08 36639.12
2 <NA> 82728FA30612F3FD 2016-07-28 <NA> 38803.81 35098.78
3 <NA> DE7A8D4EA0BD1D9B 2016-07-28 <NA> 14481.92 36357.61
4 <NA> A2C058FC5785F7FE 2016-07-28 <NA> 31505.35 31853.52
5 <NA> 9DBFD51E056AEE70 2016-07-28 <NA> 27218.35 30135.49
6 <NA> 169DABA5B6ECEA87 2016-07-28 <NA> 27278.94 29350.17
7 <NA> 5DB6B9F0BF276F6D 2016-07-28 <NA> 41665.14 37956.92
8 <NA> 4DC6800E9BB385BE 2016-07-28 <NA> 23147.94 45761.17
9 <NA> EFBD712DA5DD6FEC 2016-07-28 <NA> 18820.58 36396.32
10 <NA> 6BB0D7698D7B4C7D 2016-07-28 <NA> 36446.37 41376.90
geometry
1 POINT (16614.08 36639.12)
2 POINT (38803.81 35098.78)
3 POINT (14481.92 36357.61)
4 POINT (31505.35 31853.52)
5 POINT (27218.35 30135.49)
6 POINT (27278.94 29350.17)
7 POINT (41665.14 37956.92)
8 POINT (23147.94 45761.17)
9 POINT (18820.58 36396.32)
10 POINT (36446.37 41376.9)
Looks like there are NA values but upon closer analysis, we notice that the NA values exist in the columns that we do not need. Let’s drop these irrelevant NA containing columns in eldercare_sf.
<- eldercare_sf %>% select(4,5,11,17,18,19) eldercare_sf
rowSums(is.na(eldercare_sf))!=0,] eldercare_sf[
Simple feature collection with 0 features and 5 fields
Bounding box: xmin: NA ymin: NA xmax: NA ymax: NA
Projected CRS: SVY21 / Singapore TM
[1] ADDRESSPOS ADDRESSSTR NAME X_ADDR Y_ADDR geometry
<0 rows> (or 0-length row.names)
rowSums(is.na(primaryschools_sf))!=0,] primaryschools_sf[
Simple feature collection with 0 features and 4 fields
Bounding box: xmin: NA ymin: NA xmax: NA ymax: NA
Projected CRS: SVY21 / Singapore TM
# A tibble: 0 × 5
# … with 5 variables: school_name <chr>, address <chr>, postal_code <chr>,
# mainlevel_code <chr>, geometry <GEOMETRY [m]>
rowSums(is.na(mrt_sf))!=0,] mrt_sf[
Simple feature collection with 0 features and 2 fields
Bounding box: xmin: NA ymin: NA xmax: NA ymax: NA
Projected CRS: SVY21 / Singapore TM
[1] Name Description geometry
<0 rows> (or 0-length row.names)
rowSums(is.na(kindergarten_sf))!=0,] kindergarten_sf[
Simple feature collection with 448 features and 15 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 11909.7 ymin: 25596.33 xmax: 43395.47 ymax: 48562.06
Projected CRS: SVY21 / Singapore TM
First 10 features:
ADDRESSBLO ADDRESSBUI ADDRESSFLO ADDRESSPOS
1 <NA> <NA> <NA> 560644
2 <NA> <NA> <NA> 600251
3 <NA> <NA> <NA> 600317
4 <NA> <NA> <NA> 671455
5 <NA> <NA> <NA> 670528
6 <NA> <NA> <NA> 670620
7 <NA> <NA> <NA> 380008
8 <NA> <NA> <NA> 118643
9 <NA> <NA> <NA> 519420
10 <NA> <NA> <NA> 299574
ADDRESSSTR
1 644 Ang Mo Kio Ave 4 #01-850 S(560644)
2 251 Jurong East Street 24 Blk 247 #01-110 S(600251)
3 317 Jurong East Street 31 #01-14 S(600317)
4 455A Segar Road #01-01 S(671455)
5 528 Jelapang Road Blk 526, 532 #01-79 S(670528)
6 620 Bukit Panjang Ring Road Blk 615, 619 #01-828 S(670620)
7 8, UPPER BOON KENG ROAD, #01 - 03, MULTI STOREY CAR PARK, SINGAPORE 380008
8 302 Pasir Panjang Road S(118643)
9 4 Pasir Ris Drive 6 S(519420)
10 1 Dunearn Close S(299574)
ADDRESSTYP DESCRIPTIO HYPERLINK LANDXADDRE LANDYADDRE
1 <NA> Kindergartens <NA> 0 0
2 <NA> Kindergartens <NA> 0 0
3 <NA> Kindergartens <NA> 0 0
4 <NA> Kindergartens <NA> 0 0
5 <NA> Kindergartens <NA> 0 0
6 <NA> Kindergartens <NA> 0 0
7 <NA> Kindergartens <NA> 0 0
8 <NA> Kindergartens <NA> 0 0
9 <NA> Kindergartens <NA> 0 0
10 <NA> Kindergartens <NA> 0 0
NAME PHOTOURL
1 PCF Sparkletots Preschool @ Yio Chu Kang Blk 644 (KN) <NA>
2 PCF Sparkletots Preschool @ Yuhua Blk 251 (KN) <NA>
3 PCF Sparkletots Preschool @ Yuhua Blk 317 (KN) <NA>
4 PCF Sparkletots Preschool @ Zhenghua Blk 455A (KN) <NA>
5 PCF Sparkletots Preschool @ Zhenghua Blk 528 (KN) <NA>
6 PCF Sparkletots Preschool @ Zhenghua Blk 620 (KN) <NA>
7 PCF SPARKLETOTS PRESCHOOL@KOLAM AYER BLK 8 (DS) <NA>
8 Pearlbank Montessori Kindergarten <NA>
9 Pentecost Methodist Church Kindergarten <NA>
10 Pibos Garden Preschool <NA>
INC_CRC FMEL_UPD_D ADDRESSUNI geometry
1 904D106E26156265 2020-08-13 <NA> POINT (28847.97 40124.9)
2 F735342764BD6BCC 2020-08-13 <NA> POINT (17578.65 36146.17)
3 564523E27D221C4D 2020-08-13 <NA> POINT (16609.18 36520.38)
4 7EED470791C85B92 2020-08-13 <NA> POINT (21088.36 41055.75)
5 DEB389E855725B16 2020-08-13 <NA> POINT (20457.5 40777.31)
6 AB8E78A4C780367B 2020-08-13 <NA> POINT (20033.94 40866.5)
7 FCAA7F53E78614D6 2020-08-13 <NA> POINT (32159.15 32778.05)
8 52E6CED97C628B57 2020-08-13 <NA> POINT (22042.91 29991.61)
9 8C80D6087330C37A 2020-08-13 <NA> POINT (41780.92 39252.46)
10 179B665553AAD262 2020-08-13 <NA> POINT (25916.23 33989.13)
<- kindergarten_sf %>% select(4,5,7,11,13,16)
kindergarten_sf kindergarten_sf
Simple feature collection with 448 features and 5 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 11909.7 ymin: 25596.33 xmax: 43395.47 ymax: 48562.06
Projected CRS: SVY21 / Singapore TM
First 10 features:
ADDRESSPOS
1 560644
2 600251
3 600317
4 671455
5 670528
6 670620
7 380008
8 118643
9 519420
10 299574
ADDRESSSTR
1 644 Ang Mo Kio Ave 4 #01-850 S(560644)
2 251 Jurong East Street 24 Blk 247 #01-110 S(600251)
3 317 Jurong East Street 31 #01-14 S(600317)
4 455A Segar Road #01-01 S(671455)
5 528 Jelapang Road Blk 526, 532 #01-79 S(670528)
6 620 Bukit Panjang Ring Road Blk 615, 619 #01-828 S(670620)
7 8, UPPER BOON KENG ROAD, #01 - 03, MULTI STOREY CAR PARK, SINGAPORE 380008
8 302 Pasir Panjang Road S(118643)
9 4 Pasir Ris Drive 6 S(519420)
10 1 Dunearn Close S(299574)
DESCRIPTIO NAME
1 Kindergartens PCF Sparkletots Preschool @ Yio Chu Kang Blk 644 (KN)
2 Kindergartens PCF Sparkletots Preschool @ Yuhua Blk 251 (KN)
3 Kindergartens PCF Sparkletots Preschool @ Yuhua Blk 317 (KN)
4 Kindergartens PCF Sparkletots Preschool @ Zhenghua Blk 455A (KN)
5 Kindergartens PCF Sparkletots Preschool @ Zhenghua Blk 528 (KN)
6 Kindergartens PCF Sparkletots Preschool @ Zhenghua Blk 620 (KN)
7 Kindergartens PCF SPARKLETOTS PRESCHOOL@KOLAM AYER BLK 8 (DS)
8 Kindergartens Pearlbank Montessori Kindergarten
9 Kindergartens Pentecost Methodist Church Kindergarten
10 Kindergartens Pibos Garden Preschool
INC_CRC geometry
1 904D106E26156265 POINT (28847.97 40124.9)
2 F735342764BD6BCC POINT (17578.65 36146.17)
3 564523E27D221C4D POINT (16609.18 36520.38)
4 7EED470791C85B92 POINT (21088.36 41055.75)
5 DEB389E855725B16 POINT (20457.5 40777.31)
6 AB8E78A4C780367B POINT (20033.94 40866.5)
7 FCAA7F53E78614D6 POINT (32159.15 32778.05)
8 52E6CED97C628B57 POINT (22042.91 29991.61)
9 8C80D6087330C37A POINT (41780.92 39252.46)
10 179B665553AAD262 POINT (25916.23 33989.13)
rowSums(is.na(kindergarten_sf))!=0,] kindergarten_sf[
Simple feature collection with 0 features and 5 fields
Bounding box: xmin: NA ymin: NA xmax: NA ymax: NA
Projected CRS: SVY21 / Singapore TM
[1] ADDRESSPOS ADDRESSSTR DESCRIPTIO NAME INC_CRC geometry
<0 rows> (or 0-length row.names)
rowSums(is.na(hawkercentre_sf))!=0,] hawkercentre_sf[
Simple feature collection with 125 features and 21 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 12874.19 ymin: 28355.97 xmax: 45241.4 ymax: 47872.53
Projected CRS: SVY21 / Singapore TM
First 10 features:
ADDRESSBLO STATUS CLEANINGST ADDRESSUNI ADDRESSFLO HYPERLINK INFO_ON_CO
1 630 Existing <NA> <NA> <NA> <NA> <NA>
2 16 Existing <NA> <NA> <NA> <NA> <NA>
3 29 Existing <NA> <NA> <NA> <NA> <NA>
4 38A Existing <NA> <NA> <NA> <NA> <NA>
5 166 Existing <NA> <NA> <NA> <NA> <NA>
6 221A/B Existing <NA> <NA> <NA> <NA> <NA>
7 665 Existing <NA> <NA> <NA> <NA> <NA>
8 163 Existing <NA> <NA> <NA> <NA> <NA>
9 120 Existing <NA> <NA> <NA> <NA> <NA>
10 115 Existing <NA> <NA> <NA> <NA> <NA>
AWARDED_DA LANDYADDRE CLEANINGEN
1 <NA> 35039.64 <NA>
2 <NA> 33645.70 <NA>
3 <NA> 33497.85 <NA>
4 <NA> 30136.92 <NA>
5 <NA> 32184.16 <NA>
6 <NA> 36373.79 <NA>
7 <NA> 32059.13 <NA>
8 <NA> 29569.73 <NA>
9 <NA> 29857.81 <NA>
10 <NA> 29770.11 <NA>
PHOTOURL
1 http://www.nea.gov.sg/images/default-source/Hawker-Centres-Division/resize_1262155176127.jpg
2 http://www.nea.gov.sg/images/default-source/Hawker-Centres-Division/resize_1267853021378.jpg
3 http://www.nea.gov.sg/images/default-source/Hawker-Centres-Division/resize_1262226446535.jpg
4 http://www.nea.gov.sg/images/default-source/Hawker-Centres-Division/resize_1267807628554.jpg
5 http://www.nea.gov.sg/images/default-source/Hawker-Centres-Division/resize_1265176120532.jpg
6 http://www.nea.gov.sg/images/default-source/Hawker-Centres-Division/resize_1262154766447.jpg
7 http://www.nea.gov.sg/images/default-source/Hawker-Centres-Division/resize_1262156313186.jpg
8 http://www.nea.gov.sg/images/default-source/Hawker-Centres-Division/resize_1267851995788.jpg
9 http://www.nea.gov.sg/images/default-source/Hawker-Centres-Division/resize_1267852344747.jpg
10 http://www.nea.gov.sg/images/default-source/Hawker-Centres-Division/resize_1267851251303.jpg
DESCRIPTIO
1 HUP Rebuilding
2 HUP Standard Upgrading
3 HUP Standard Upgrading
4 HUP Standard Upgrading
5 HUP Standard Upgrading
6 HUP Reconfiguration
7 HUP Standard Upgrading
8 Opted out of HUP
9 HUP Standard Upgrading
10 HUP Standard Upgrading
NAME
1 Bedok Reservoir Road Blk 630
2 Bedok South Road Blk 16
3 Bendemeer Road Blk 29 (Bendemeer Market and Food Centre)
4 Beo Crescent Market
5 Berseh Food Centre
6 Boon Lay Place Blk 221A/B (Boon Lay Place Market and Food Village)
7 Buffalo Road Blk 665 (Tekka Centre/Zhu Jiao Market)
8 Bukit Merah Central Blk 163 (Bukit Merah Central Food Centre)
9 Bukit Merah Lane 1 Blk 120 (Alexandra Village Food Centre)
10 Bukit Merah View Blk 115 (Blk 115 Bukit Merah View Market and Food Centre)
ADDRESSTYP ADDRESSBUI LANDXADDRE ADDRESSSTR ADDRESSPOS IMPLEMENTA
1 I <NA> 36985.00 Bedok Reservoir Road 470630 <NA>
2 I <NA> 39376.14 Bedok South Road 460016 <NA>
3 I <NA> 31305.63 Bendemeer Road 330029 <NA>
4 I <NA> 27336.64 Beo Crescent 169982 <NA>
5 I <NA> 30619.27 Jalan Besar 208877 <NA>
6 I <NA> 14587.57 Boon Lay Place 641221 <NA>
7 I <NA> 29915.58 Buffalo Road 210665 <NA>
8 I <NA> 26183.03 Bukit Merah Central 150163 <NA>
9 I <NA> 24791.54 Bukit Merah Lane 1 150120 <NA>
10 I <NA> 26745.83 Bukit Merah View 151115 <NA>
INC_CRC FMEL_UPD_D geometry
1 BBA7FF2BCA329EE8 2021-10-25 POINT (36985 35039.64)
2 483F3877B4EE039F 2021-10-25 POINT (39376.14 33645.7)
3 A7DB5A3EB9F35DE3 2021-10-25 POINT (31305.63 33497.85)
4 D232402B3632CAB2 2021-10-25 POINT (27336.64 30136.92)
5 A7CCEB2CC0B77C6D 2021-10-25 POINT (30619.27 32184.16)
6 84F8C2B4D627C21E 2021-10-25 POINT (14587.57 36373.79)
7 D09ADF340C3B739E 2021-10-25 POINT (29915.58 32059.13)
8 16F0047A1B5AC0D0 2021-10-25 POINT (26183.03 29569.73)
9 98A3C26D3632E680 2021-10-25 POINT (24791.54 29857.81)
10 7A2BDBF509B4F7FF 2021-10-25 POINT (26745.83 29770.11)
<- hawkercentre_sf %>% select(1,2,9,12,13,16,17,18,20,21,22)
hawkercentre_sf hawkercentre_sf
Simple feature collection with 125 features and 10 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 12874.19 ymin: 28355.97 xmax: 45241.4 ymax: 47872.53
Projected CRS: SVY21 / Singapore TM
First 10 features:
ADDRESSBLO STATUS LANDYADDRE DESCRIPTIO
1 630 Existing 35039.64 HUP Rebuilding
2 16 Existing 33645.70 HUP Standard Upgrading
3 29 Existing 33497.85 HUP Standard Upgrading
4 38A Existing 30136.92 HUP Standard Upgrading
5 166 Existing 32184.16 HUP Standard Upgrading
6 221A/B Existing 36373.79 HUP Reconfiguration
7 665 Existing 32059.13 HUP Standard Upgrading
8 163 Existing 29569.73 Opted out of HUP
9 120 Existing 29857.81 HUP Standard Upgrading
10 115 Existing 29770.11 HUP Standard Upgrading
NAME
1 Bedok Reservoir Road Blk 630
2 Bedok South Road Blk 16
3 Bendemeer Road Blk 29 (Bendemeer Market and Food Centre)
4 Beo Crescent Market
5 Berseh Food Centre
6 Boon Lay Place Blk 221A/B (Boon Lay Place Market and Food Village)
7 Buffalo Road Blk 665 (Tekka Centre/Zhu Jiao Market)
8 Bukit Merah Central Blk 163 (Bukit Merah Central Food Centre)
9 Bukit Merah Lane 1 Blk 120 (Alexandra Village Food Centre)
10 Bukit Merah View Blk 115 (Blk 115 Bukit Merah View Market and Food Centre)
LANDXADDRE ADDRESSSTR ADDRESSPOS INC_CRC FMEL_UPD_D
1 36985.00 Bedok Reservoir Road 470630 BBA7FF2BCA329EE8 2021-10-25
2 39376.14 Bedok South Road 460016 483F3877B4EE039F 2021-10-25
3 31305.63 Bendemeer Road 330029 A7DB5A3EB9F35DE3 2021-10-25
4 27336.64 Beo Crescent 169982 D232402B3632CAB2 2021-10-25
5 30619.27 Jalan Besar 208877 A7CCEB2CC0B77C6D 2021-10-25
6 14587.57 Boon Lay Place 641221 84F8C2B4D627C21E 2021-10-25
7 29915.58 Buffalo Road 210665 D09ADF340C3B739E 2021-10-25
8 26183.03 Bukit Merah Central 150163 16F0047A1B5AC0D0 2021-10-25
9 24791.54 Bukit Merah Lane 1 150120 98A3C26D3632E680 2021-10-25
10 26745.83 Bukit Merah View 151115 7A2BDBF509B4F7FF 2021-10-25
geometry
1 POINT (36985 35039.64)
2 POINT (39376.14 33645.7)
3 POINT (31305.63 33497.85)
4 POINT (27336.64 30136.92)
5 POINT (30619.27 32184.16)
6 POINT (14587.57 36373.79)
7 POINT (29915.58 32059.13)
8 POINT (26183.03 29569.73)
9 POINT (24791.54 29857.81)
10 POINT (26745.83 29770.11)
<- na.omit(hawkercentre_sf)
hawkercentre_sf hawkercentre_sf
Simple feature collection with 116 features and 10 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 12874.19 ymin: 28355.97 xmax: 45241.4 ymax: 47282.71
Projected CRS: SVY21 / Singapore TM
First 10 features:
ADDRESSBLO STATUS LANDYADDRE DESCRIPTIO
1 630 Existing 35039.64 HUP Rebuilding
2 16 Existing 33645.70 HUP Standard Upgrading
3 29 Existing 33497.85 HUP Standard Upgrading
4 38A Existing 30136.92 HUP Standard Upgrading
5 166 Existing 32184.16 HUP Standard Upgrading
6 221A/B Existing 36373.79 HUP Reconfiguration
7 665 Existing 32059.13 HUP Standard Upgrading
8 163 Existing 29569.73 Opted out of HUP
9 120 Existing 29857.81 HUP Standard Upgrading
10 115 Existing 29770.11 HUP Standard Upgrading
NAME
1 Bedok Reservoir Road Blk 630
2 Bedok South Road Blk 16
3 Bendemeer Road Blk 29 (Bendemeer Market and Food Centre)
4 Beo Crescent Market
5 Berseh Food Centre
6 Boon Lay Place Blk 221A/B (Boon Lay Place Market and Food Village)
7 Buffalo Road Blk 665 (Tekka Centre/Zhu Jiao Market)
8 Bukit Merah Central Blk 163 (Bukit Merah Central Food Centre)
9 Bukit Merah Lane 1 Blk 120 (Alexandra Village Food Centre)
10 Bukit Merah View Blk 115 (Blk 115 Bukit Merah View Market and Food Centre)
LANDXADDRE ADDRESSSTR ADDRESSPOS INC_CRC FMEL_UPD_D
1 36985.00 Bedok Reservoir Road 470630 BBA7FF2BCA329EE8 2021-10-25
2 39376.14 Bedok South Road 460016 483F3877B4EE039F 2021-10-25
3 31305.63 Bendemeer Road 330029 A7DB5A3EB9F35DE3 2021-10-25
4 27336.64 Beo Crescent 169982 D232402B3632CAB2 2021-10-25
5 30619.27 Jalan Besar 208877 A7CCEB2CC0B77C6D 2021-10-25
6 14587.57 Boon Lay Place 641221 84F8C2B4D627C21E 2021-10-25
7 29915.58 Buffalo Road 210665 D09ADF340C3B739E 2021-10-25
8 26183.03 Bukit Merah Central 150163 16F0047A1B5AC0D0 2021-10-25
9 24791.54 Bukit Merah Lane 1 150120 98A3C26D3632E680 2021-10-25
10 26745.83 Bukit Merah View 151115 7A2BDBF509B4F7FF 2021-10-25
geometry
1 POINT (36985 35039.64)
2 POINT (39376.14 33645.7)
3 POINT (31305.63 33497.85)
4 POINT (27336.64 30136.92)
5 POINT (30619.27 32184.16)
6 POINT (14587.57 36373.79)
7 POINT (29915.58 32059.13)
8 POINT (26183.03 29569.73)
9 POINT (24791.54 29857.81)
10 POINT (26745.83 29770.11)
rowSums(is.na(hawkercentre_sf))!=0,] hawkercentre_sf[
Simple feature collection with 0 features and 10 fields
Bounding box: xmin: NA ymin: NA xmax: NA ymax: NA
Projected CRS: SVY21 / Singapore TM
[1] ADDRESSBLO STATUS LANDYADDRE DESCRIPTIO NAME LANDXADDRE
[7] ADDRESSSTR ADDRESSPOS INC_CRC FMEL_UPD_D geometry
<0 rows> (or 0-length row.names)
rowSums(is.na(nationalparks_sf ))!=0,] nationalparks_sf [
Simple feature collection with 352 features and 15 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 12373.11 ymin: 21869.93 xmax: 46735.95 ymax: 49231.09
Projected CRS: SVY21 / Singapore TM
First 10 features:
ADDRESSBLO ADDRESSBUI ADDRESSTYP
1 <NA> <NA> <NA>
2 <NA> <NA> <NA>
3 <NA> <NA> <NA>
4 <NA> <NA> <NA>
5 <NA> <NA> <NA>
6 <NA> <NA> <NA>
7 <NA> <NA> <NA>
8 <NA> <NA> <NA>
9 <NA> <NA> <NA>
10 <NA> <NA> <NA>
HYPERLINK
1 <NA>
2 <NA>
3 <NA>
4 <NA>
5 <NA>
6 <NA>
7 www.nparks.gov.sg/gardens-parks-and-nature/parks-and-nature-reserves/sun-plaza-park
8 <NA>
9 <NA>
10 <NA>
LANDXADDRE LANDYADDRE NAME PHOTOURL ADDRESSPOS
1 29594.30 29323.41 Telok Ayer Green <NA> <NA>
2 28695.60 39413.70 Mayflower Crescent Playground <NA> <NA>
3 30676.61 41137.35 Sunrise Drive Playground 1 <NA> <NA>
4 39994.09 39355.59 Elias Terrace Playground <NA> <NA>
5 40813.11 33764.61 Kew Avenue Playground <NA> <NA>
6 37385.95 32814.41 Greenfield Drive Playground <NA> <NA>
7 40371.20 37926.31 Sun Plaza Park <NA> <NA>
8 45135.69 41460.78 Changi Point Ferry Terminal <NA> <NA>
9 27896.88 39226.05 Shangri-La Playground <NA> <NA>
10 38142.70 33595.77 Opera Estate Football Field <NA> <NA>
DESCRIPTIO ADDRESSSTR
1 Bounded by Amoy Street, Boon Tat Street and Telok Ayer Street <NA>
2 At the junction of Mayflower Crescent and Mayflower Avenue <NA>
3 Located along Sunrise Drive <NA>
4 Junction of Elias Terrace and Elias Green <NA>
5 Junction of Kew Avenue and Kew Drive <NA>
6 Greenfield Drive <NA>
7 Along Tampines Avenue 7, Tampines Avenue 9 <NA>
8 Near Lor Bekukong <NA>
9 Junction of Ang Mo Kio Ave 2 and Jalan Lanjut <NA>
10 Swan Lake Avenue <NA>
ADDRESSFLO INC_CRC FMEL_UPD_D ADDRESSUNI geometry
1 <NA> 07CFE6567539200A 2020-02-18 <NA> POINT (29594.3 29323.41)
2 <NA> B01AE2FF8B58F5CA 2020-02-18 <NA> POINT (28695.6 39413.7)
3 <NA> 66086C14E8DACE2D 2020-02-18 <NA> POINT (30676.61 41137.35)
4 <NA> 8B06ED4574E90FC9 2020-02-18 <NA> POINT (39994.09 39355.59)
5 <NA> E3FD62E109D01A9C 2020-02-18 <NA> POINT (40813.11 33764.61)
6 <NA> 8B896BD1155428FB 2020-02-18 <NA> POINT (37385.95 32814.41)
7 <NA> 5BBA8A8EB630BA01 2020-02-18 <NA> POINT (40371.2 37926.31)
8 <NA> AA9DDE6381971B22 2020-02-18 <NA> POINT (45135.69 41460.78)
9 <NA> FF16ED3C3767BD2C 2020-02-18 <NA> POINT (27896.88 39226.05)
10 <NA> AD2BA4AF1306E38A 2020-02-18 <NA> POINT (38142.7 33595.77)
<- nationalparks_sf %>% select(5,6,7,13,14,16)
nationalparks_sf nationalparks_sf
Simple feature collection with 352 features and 5 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 12373.11 ymin: 21869.93 xmax: 46735.95 ymax: 49231.09
Projected CRS: SVY21 / Singapore TM
First 10 features:
LANDXADDRE LANDYADDRE NAME INC_CRC
1 29594.30 29323.41 Telok Ayer Green 07CFE6567539200A
2 28695.60 39413.70 Mayflower Crescent Playground B01AE2FF8B58F5CA
3 30676.61 41137.35 Sunrise Drive Playground 1 66086C14E8DACE2D
4 39994.09 39355.59 Elias Terrace Playground 8B06ED4574E90FC9
5 40813.11 33764.61 Kew Avenue Playground E3FD62E109D01A9C
6 37385.95 32814.41 Greenfield Drive Playground 8B896BD1155428FB
7 40371.20 37926.31 Sun Plaza Park 5BBA8A8EB630BA01
8 45135.69 41460.78 Changi Point Ferry Terminal AA9DDE6381971B22
9 27896.88 39226.05 Shangri-La Playground FF16ED3C3767BD2C
10 38142.70 33595.77 Opera Estate Football Field AD2BA4AF1306E38A
FMEL_UPD_D geometry
1 2020-02-18 POINT (29594.3 29323.41)
2 2020-02-18 POINT (28695.6 39413.7)
3 2020-02-18 POINT (30676.61 41137.35)
4 2020-02-18 POINT (39994.09 39355.59)
5 2020-02-18 POINT (40813.11 33764.61)
6 2020-02-18 POINT (37385.95 32814.41)
7 2020-02-18 POINT (40371.2 37926.31)
8 2020-02-18 POINT (45135.69 41460.78)
9 2020-02-18 POINT (27896.88 39226.05)
10 2020-02-18 POINT (38142.7 33595.77)
rowSums(is.na(nationalparks_sf ))!=0,] nationalparks_sf [
Simple feature collection with 0 features and 5 fields
Bounding box: xmin: NA ymin: NA xmax: NA ymax: NA
Projected CRS: SVY21 / Singapore TM
[1] LANDXADDRE LANDYADDRE NAME INC_CRC FMEL_UPD_D geometry
<0 rows> (or 0-length row.names)
rowSums(is.na(supermarkets_sf ))!=0,] supermarkets_sf[
Simple feature collection with 75 features and 8 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 5096.172 ymin: 25529.08 xmax: 42504.96 ymax: 49218.44
Projected CRS: SVY21 / Singapore TM
First 10 features:
LIC_NAME BLK_HOUSE STR_NAME UNIT_NO
26 B & S MINI MART PTE. LTD. 310 GEYLANG ROAD <NA>
27 CHEE MIN KUAN, SIMON 342 TANJONG KATONG ROAD <NA>
32 MURUGAN TRADERS PTE LTD 9 TRACTOR ROAD <NA>
45 SWISS BUTCHERY (2013) PRIVATE LIMITED 30 GREENWOOD AVENUE <NA>
46 ROSWELL ENTERPRISE PTE LTD 34 GREENWOOD AVENUE <NA>
51 COLD STORAGE SINGAPORE (1983) PTE LTD 154 WEST COAST ROAD <NA>
52 COLD STORAGE SINGAPORE (1983) PTE LTD 1 VISTA EXCHANGE GREEN <NA>
53 FOODIE MARKET PLACE PTE. LTD. 225 OUTRAM ROAD <NA>
54 MUSTAFA HOLDINGS PTE LTD 147 SYED ALWI ROAD <NA>
55 SUPERNATURE PTE LTD 583 ORCHARD ROAD <NA>
POSTCODE LIC_NO INC_CRC FMEL_UPD_D geometry
26 389349 CE14Q85A000 4DFE6BEAE93CDC87 2018-10-03 POINT (33153.17 32749.73)
27 437112 SE14965K000 7827732A1824519B 2018-10-03 POINT (35031.32 31785.86)
32 627970 SW18B79P000 F1EBC8EAFDAA9EF8 2018-10-03 POINT (13730.52 34128.79)
45 289230 CE07705A000 C869661C01CC7122 2017-11-29 POINT (25025.04 34884.91)
46 289236 B03078N000 1AC0DC1360B91602 2017-11-29 POINT (25014.53 34892.79)
51 127371 SW08807K000 50EDCA33BB1577BC 2017-11-29 POINT (20428.43 31769.17)
52 138617 SW12J97L000 A0FE827922FA7CEA 2017-11-29 POINT (22980.34 32130.27)
53 169038 CE10I13B000 F07E9FCD9F10FF17 2017-11-29 POINT (28228.45 29542.99)
54 207706 W03142N000 774A8FF4716A0468 2017-11-29 POINT (30491.02 32451.33)
55 238884 CE13539N000 1CBCEAA88F882DA8 2017-11-29 POINT (27464.74 32058.01)
Looks like the “unit_no” column in supermarkets_sf contains NA values. Since this column is irrelevant, let’s just drop it.
<- supermarkets_sf %>% select(1,2,3,5,6,7,8,9)
supermarkets_sf supermarkets_sf
Simple feature collection with 526 features and 7 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 4901.188 ymin: 25529.08 xmax: 46948.22 ymax: 49233.6
Projected CRS: SVY21 / Singapore TM
First 10 features:
LIC_NAME BLK_HOUSE STR_NAME
1 LI LI CHENG SUPERMARKET (PUNGGOL) PTE. LTD. 273C PUNGGOL PLACE
2 SHENG SIONG SUPERMARKET PTE LTD 11 UPPER BOON KENG ROAD
3 COLD STORAGE SINGAPORE (1983) PTE LTD 683 HOUGANG AVENUE 8
4 COLD STORAGE SINGAPORE (1983) PTE LTD 631 BEDOK RESERVOIR ROAD
5 YES SUPERMARKET PTE LTD 201B TAMPINES STREET 21
6 SUZYAMEER FROZEN PTE. LTD. 201D TAMPINES STREET 21
7 G8 MART PTE. LTD. 421 ANG MO KIO AVENUE 10
8 SHENG SIONG SUPERMARKET PTE LTD 233 ANG MO KIO AVENUE 3
9 PRIME SUPERMARKET (1996) PTE LTD 106 HOUGANG AVENUE 1
10 TAN KWEE ENG 327 YISHUN RING ROAD
POSTCODE LIC_NO INC_CRC FMEL_UPD_D geometry
1 823273 NE12I65N000 3DE8AF6E76F9D3D4 2017-11-29 POINT (35561.22 42685.17)
2 380011 E73010V000 F361759A8261CD6E 2017-11-29 POINT (32184.01 32947.46)
3 530683 NE11909C000 1DC69902E02077CE 2017-11-29 POINT (33903.48 39480.46)
4 470631 S02210X000 4E2560154B58BA38 2017-11-29 POINT (37083.82 35017.47)
5 522201 S02037J000 559A9A00D9FF8A55 2017-11-29 POINT (41320.3 37283.82)
6 524201 NE08357A000 1D32060098628881 2017-11-29 POINT (41384.47 37152.14)
7 560421 CE13401C000 E83AE5A9842F67BC 2017-11-29 POINT (30186.63 38602.77)
8 560233 CE04334P000 08D1E417EB224327 2017-11-29 POINT (28380.83 38842.16)
9 530106 S02059X000 3DA5C840D472C779 2017-11-29 POINT (34383.76 37311.19)
10 760327 B02041C000 FBB8A845FD8ADDC4 2017-11-29 POINT (29010.23 45755.51)
rowSums(is.na(supermarkets_sf ))!=0,] supermarkets_sf[
Simple feature collection with 0 features and 7 fields
Bounding box: xmin: NA ymin: NA xmax: NA ymax: NA
Projected CRS: SVY21 / Singapore TM
[1] LIC_NAME BLK_HOUSE STR_NAME POSTCODE LIC_NO INC_CRC FMEL_UPD_D
[8] geometry
<0 rows> (or 0-length row.names)
rowSums(is.na(topprimary_sf ))!=0,] topprimary_sf[
Simple feature collection with 0 features and 2 fields
Bounding box: xmin: NA ymin: NA xmax: NA ymax: NA
Projected CRS: SVY21 / Singapore TM
[1] address postal geometry
<0 rows> (or 0-length row.names)
rowSums(is.na(mall_coordinates_sf))!=0,] mall_coordinates_sf[
Simple feature collection with 0 features and 2 fields
Bounding box: xmin: NA ymin: NA xmax: NA ymax: NA
Projected CRS: SVY21 / Singapore TM
[1] address postal geometry
<0 rows> (or 0-length row.names)
rowSums(is.na(cbd_coords_sf))!=0,] cbd_coords_sf[
Simple feature collection with 0 features and 1 field
Bounding box: xmin: NA ymin: NA xmax: NA ymax: NA
Projected CRS: SVY21 / Singapore TM
[1] name geometry
<0 rows> (or 0-length row.names)
rowSums(is.na(chas_sf))!=0,] chas_sf[
Simple feature collection with 0 features and 2 fields
Bounding box: xmin: NA ymin: NA xmax: NA ymax: NA
Projected CRS: SVY21 / Singapore TM
[1] Name Description geometry
<0 rows> (or 0-length row.names)
4.0 Importing Aspatial Data
= read_csv("data/geospatial/data_extracted/resale/resale-flat-prices-based-on-registration-date-from-jan-2017-onwards.csv") hdb_resale
hdb_resale
# A tibble: 148,000 × 11
month town flat_…¹ block stree…² store…³ floor…⁴ flat_…⁵ lease…⁶ remai…⁷
<chr> <chr> <chr> <chr> <chr> <chr> <dbl> <chr> <dbl> <chr>
1 2017-01 ANG MO… 2 ROOM 406 ANG MO… 10 TO … 44 Improv… 1979 61 yea…
2 2017-01 ANG MO… 3 ROOM 108 ANG MO… 01 TO … 67 New Ge… 1978 60 yea…
3 2017-01 ANG MO… 3 ROOM 602 ANG MO… 01 TO … 67 New Ge… 1980 62 yea…
4 2017-01 ANG MO… 3 ROOM 465 ANG MO… 04 TO … 68 New Ge… 1980 62 yea…
5 2017-01 ANG MO… 3 ROOM 601 ANG MO… 01 TO … 67 New Ge… 1980 62 yea…
6 2017-01 ANG MO… 3 ROOM 150 ANG MO… 01 TO … 68 New Ge… 1981 63 yea…
7 2017-01 ANG MO… 3 ROOM 447 ANG MO… 04 TO … 68 New Ge… 1979 61 yea…
8 2017-01 ANG MO… 3 ROOM 218 ANG MO… 04 TO … 67 New Ge… 1976 58 yea…
9 2017-01 ANG MO… 3 ROOM 447 ANG MO… 04 TO … 68 New Ge… 1979 61 yea…
10 2017-01 ANG MO… 3 ROOM 571 ANG MO… 01 TO … 67 New Ge… 1979 61 yea…
# … with 147,990 more rows, 1 more variable: resale_price <dbl>, and
# abbreviated variable names ¹flat_type, ²street_name, ³storey_range,
# ⁴floor_area_sqm, ⁵flat_model, ⁶lease_commence_date, ⁷remaining_lease
Let’s check for NA values.
rowSums(is.na(hdb_resale ))!=0,] hdb_resale[
# A tibble: 0 × 11
# … with 11 variables: month <chr>, town <chr>, flat_type <chr>, block <chr>,
# street_name <chr>, storey_range <chr>, floor_area_sqm <dbl>,
# flat_model <chr>, lease_commence_date <dbl>, remaining_lease <chr>,
# resale_price <dbl>
Looks like there’s none!
When we look at hdb_resale_train, we realise that there are no longitude and latitude columns. Moreover, we should be focusing on either three-room, four-room or five-room flats.
<- hdb_resale %>%
hdb_resale filter(flat_type == "4 ROOM")
hdb_resale
# A tibble: 61,830 × 11
month town flat_…¹ block stree…² store…³ floor…⁴ flat_…⁵ lease…⁶ remai…⁷
<chr> <chr> <chr> <chr> <chr> <chr> <dbl> <chr> <dbl> <chr>
1 2017-01 ANG MO… 4 ROOM 472 ANG MO… 10 TO … 92 New Ge… 1979 61 yea…
2 2017-01 ANG MO… 4 ROOM 475 ANG MO… 07 TO … 91 New Ge… 1979 61 yea…
3 2017-01 ANG MO… 4 ROOM 629 ANG MO… 01 TO … 94 New Ge… 1981 63 yea…
4 2017-01 ANG MO… 4 ROOM 546 ANG MO… 01 TO … 92 New Ge… 1981 63 yea…
5 2017-01 ANG MO… 4 ROOM 131 ANG MO… 01 TO … 98 New Ge… 1979 61 yea…
6 2017-01 ANG MO… 4 ROOM 254 ANG MO… 04 TO … 97 New Ge… 1977 59 yea…
7 2017-01 ANG MO… 4 ROOM 470 ANG MO… 04 TO … 92 New Ge… 1979 61 yea…
8 2017-01 ANG MO… 4 ROOM 601 ANG MO… 04 TO … 91 New Ge… 1980 62 yea…
9 2017-01 ANG MO… 4 ROOM 463 ANG MO… 04 TO … 92 New Ge… 1980 62 yea…
10 2017-01 ANG MO… 4 ROOM 207 ANG MO… 04 TO … 97 New Ge… 1976 58 yea…
# … with 61,820 more rows, 1 more variable: resale_price <dbl>, and abbreviated
# variable names ¹flat_type, ²street_name, ³storey_range, ⁴floor_area_sqm,
# ⁵flat_model, ⁶lease_commence_date, ⁷remaining_lease
<- hdb_resale %>% filter(month >= "2021-01" & month <= "2023-02") hdb_resale
4.1 Transform Resale Data
4.1.1 Create new columns
Here, we use mutate function of dplyr package to create columns such as:
address: concatenation of the block and street_name columns using paste() function of base R package
remaining_lease_yr & remaining_lease_mth: split the year and months part of the remaining_lease respectively using str_sub() function of stringr package then converting the character to integer using as.integer() function of base R package
<- hdb_resale %>%
hdb_resale_transformed mutate(hdb_resale, address = paste(block,street_name)) %>%
mutate(hdb_resale, remaining_lease_yr = as.integer(str_sub(remaining_lease, 0, 2))) %>%
mutate(hdb_resale, remaining_lease_mth = as.integer(str_sub(remaining_lease, 9, 11)))
hdb_resale_transformed
# A tibble: 25,505 × 14
month town flat_…¹ block stree…² store…³ floor…⁴ flat_…⁵ lease…⁶ remai…⁷
<chr> <chr> <chr> <chr> <chr> <chr> <dbl> <chr> <dbl> <chr>
1 2021-01 ANG MO… 4 ROOM 547 ANG MO… 04 TO … 92 New Ge… 1981 59 yea…
2 2021-01 ANG MO… 4 ROOM 414 ANG MO… 01 TO … 92 New Ge… 1979 57 yea…
3 2021-01 ANG MO… 4 ROOM 509 ANG MO… 01 TO … 91 New Ge… 1980 58 yea…
4 2021-01 ANG MO… 4 ROOM 467 ANG MO… 07 TO … 92 New Ge… 1979 57 yea…
5 2021-01 ANG MO… 4 ROOM 571 ANG MO… 07 TO … 92 New Ge… 1979 57 yea…
6 2021-01 ANG MO… 4 ROOM 134 ANG MO… 07 TO … 98 New Ge… 1978 56 yea…
7 2021-01 ANG MO… 4 ROOM 204 ANG MO… 07 TO … 92 New Ge… 1977 55 yea…
8 2021-01 ANG MO… 4 ROOM 429 ANG MO… 04 TO … 92 New Ge… 1978 56 yea…
9 2021-01 ANG MO… 4 ROOM 413 ANG MO… 10 TO … 92 New Ge… 1979 57 yea…
10 2021-01 ANG MO… 4 ROOM 415 ANG MO… 07 TO … 92 New Ge… 1979 57 yea…
# … with 25,495 more rows, 4 more variables: resale_price <dbl>, address <chr>,
# remaining_lease_yr <int>, remaining_lease_mth <int>, and abbreviated
# variable names ¹flat_type, ²street_name, ³storey_range, ⁴floor_area_sqm,
# ⁵flat_model, ⁶lease_commence_date, ⁷remaining_lease
4.1.2 Sum up remaining lease in months
Replace NA values in remaining_lease_mth with the value 0 with the help of is.na() function of base R package
Multiply remaining_lease_yr by 12 to convert it to months unit
Create remaining_lease_mths column using mutate function of dplyr package which contains the summation of the remaining_lease_yr and remaining_lease_mths using rowSums() function of base R package
Select required columns for analysis using select() function of base R package
$remaining_lease_mth[is.na(hdb_resale_transformed$remaining_lease_mth)] <- 0
hdb_resale_transformed$remaining_lease_yr <- hdb_resale_transformed$remaining_lease_yr * 12
hdb_resale_transformed<- hdb_resale_transformed %>%
hdb_resale_transformed mutate(hdb_resale_transformed, remaining_lease_mths = rowSums(hdb_resale_transformed[, c("remaining_lease_yr", "remaining_lease_mth")])) %>%
select(month, town, address, block, street_name, flat_type, storey_range, floor_area_sqm, flat_model,
lease_commence_date, remaining_lease_mths, resale_price)
head(hdb_resale_transformed)
# A tibble: 6 × 12
month town address block stree…¹ flat_…² store…³ floor…⁴ flat_…⁵ lease…⁶
<chr> <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <chr> <dbl>
1 2021-01 ANG MO … 547 AN… 547 ANG MO… 4 ROOM 04 TO … 92 New Ge… 1981
2 2021-01 ANG MO … 414 AN… 414 ANG MO… 4 ROOM 01 TO … 92 New Ge… 1979
3 2021-01 ANG MO … 509 AN… 509 ANG MO… 4 ROOM 01 TO … 91 New Ge… 1980
4 2021-01 ANG MO … 467 AN… 467 ANG MO… 4 ROOM 07 TO … 92 New Ge… 1979
5 2021-01 ANG MO … 571 AN… 571 ANG MO… 4 ROOM 07 TO … 92 New Ge… 1979
6 2021-01 ANG MO … 134 AN… 134 ANG MO… 4 ROOM 07 TO … 98 New Ge… 1978
# … with 2 more variables: remaining_lease_mths <dbl>, resale_price <dbl>, and
# abbreviated variable names ¹street_name, ²flat_type, ³storey_range,
# ⁴floor_area_sqm, ⁵flat_model, ⁶lease_commence_date
4.2 Retrieve Postal Codes and Coordinates of Addresses
This section will focus on retrieving the relevant data like postal codes and coordinates of the addresses which is required to get the proximity to locational factors later on.
4.2.1 Create a list storing unique addresses
We create a list to store unique addresses to ensure that we do not run the GET request more than what is necessary
We can also sort it to make it easier for us to see at which address the GET request will fail.
Here, we use unique() function of base R package to extract the unique addresses then use sort() function of base R package to sort the unique vector.
<- sort(unique(hdb_resale_transformed$address))
add_list head(add_list)
[1] "1 CHAI CHEE RD" "1 PINE CL" "1 ST. GEORGE'S RD"
[4] "1 TECK WHYE AVE" "1 TOH YI DR" "10 CHAI CHEE RD"
4.2.2 Create function to retrieve coordinates from OneMap.Sg API
<- function(add_list){
get_coords
# Create a data frame to store all retrieved coordinates
<- data.frame()
postal_coords
for (i in add_list){
#print(i)
<- GET('https://developers.onemap.sg/commonapi/search?',
r query=list(searchVal=i,
returnGeom='Y',
getAddrDetails='Y'))
<- fromJSON(rawToChar(r$content))
data <- data$found
found <- data$results
res
# Create a new data frame for each address
<- data.frame()
new_row
# If single result, append
if (found == 1){
<- res$POSTAL
postal <- res$LATITUDE
lat <- res$LONGITUDE
lng <- data.frame(address= i, postal = postal, latitude = lat, longitude = lng)
new_row
}
# If multiple results, drop NIL and append top 1
else if (found > 1){
# Remove those with NIL as postal
<- res[res$POSTAL != "NIL", ]
res_sub
# Set as NA first if no Postal
if (nrow(res_sub) == 0) {
<- data.frame(address= i, postal = NA, latitude = NA, longitude = NA)
new_row
}
else{
<- head(res_sub, n = 1)
top1 <- top1$POSTAL
postal <- top1$LATITUDE
lat <- top1$LONGITUDE
lng <- data.frame(address= i, postal = postal, latitude = lat, longitude = lng)
new_row
}
}
else {
<- data.frame(address= i, postal = NA, latitude = NA, longitude = NA)
new_row
}
# Add the row
<- rbind(postal_coords, new_row)
postal_coords
}return(postal_coords)
}
4.2.3 Call get_coords function to retrieve resale coordinates
<- get_coords(add_list)
coords coords
4.2.4 Inspect results
Here, we check whether the relevant columns contains any NA values with is.na() function of base R package and also “NIL”.
is.na(coords$postal) | is.na(coords$latitude) | is.na(coords$longitude) | coords$postal=="NIL"), ] coords[(
There are 2 addresses that does not contain any postal code but contains the geographical coordinates - 215 CHOA CHU KANG CTRL and 216 CHOA CHU KANG CTRL. However, as OneMapAPISG returned the same set of coordinates for both of these addresses, we shall proceed with keeping them as we are more interested in the coordinates for our analysis later on.
4.2.4 Combine resale and coordinates data
After retrieving the coordinates, we should combine the successful ones with our transformed resale dataset.
We can do this using left_join() function of dplyr package and our data will be stored in rs_coords.
<- left_join(hdb_resale_transformed, coords, by = c('address' = 'address')) rs_coords
rs_coords
4.3 Write file to rds
As our subset resale dataset is now complete with the coordinates, we can now save it as an rds file.
This also helps us to prevent running the GET request more than what is needed.
<- write_rds(rs_coords, "data/model/rds/rs_coords.rds") rs_coords_rds
4.4 Read rds_coords RDS file
<- read_rds("data/model/rds/rs_coords.rds") rs_coords
head(rs_coords)
# A tibble: 6 × 15
month town address block stree…¹ flat_…² store…³ floor…⁴ flat_…⁵ lease…⁶
<chr> <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <chr> <dbl>
1 2021-01 ANG MO … 547 AN… 547 ANG MO… 4 ROOM 04 TO … 92 New Ge… 1981
2 2021-01 ANG MO … 414 AN… 414 ANG MO… 4 ROOM 01 TO … 92 New Ge… 1979
3 2021-01 ANG MO … 509 AN… 509 ANG MO… 4 ROOM 01 TO … 91 New Ge… 1980
4 2021-01 ANG MO … 467 AN… 467 ANG MO… 4 ROOM 07 TO … 92 New Ge… 1979
5 2021-01 ANG MO … 571 AN… 571 ANG MO… 4 ROOM 07 TO … 92 New Ge… 1979
6 2021-01 ANG MO … 134 AN… 134 ANG MO… 4 ROOM 07 TO … 98 New Ge… 1978
# … with 5 more variables: remaining_lease_mths <dbl>, resale_price <dbl>,
# postal <chr>, latitude <chr>, longitude <chr>, and abbreviated variable
# names ¹street_name, ²flat_type, ³storey_range, ⁴floor_area_sqm,
# ⁵flat_model, ⁶lease_commence_date
4.5 Assign and Transform CRS and Check
Since the coordinate columns are Latitude & Longitude which are in decimal degrees, the projected CRS will be WGS84.
We will need to assign them the respective EPSG code 4326 first before transforming it to 3414 which is the EPSG code for SVY21.
Here we use, - st_as_sf() function of sf package to convert the data frame into sf object
- st_transform() function of sf package to transform the coordinates of the sf object
<- st_as_sf(rs_coords,
rs_coords_sf coords = c("longitude",
"latitude"),
crs=4326) %>%
st_transform(crs = 3414)
st_crs(rs_coords_sf)
Coordinate Reference System:
User input: EPSG:3414
wkt:
PROJCRS["SVY21 / Singapore TM",
BASEGEOGCRS["SVY21",
DATUM["SVY21",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4757]],
CONVERSION["Singapore Transverse Mercator",
METHOD["Transverse Mercator",
ID["EPSG",9807]],
PARAMETER["Latitude of natural origin",1.36666666666667,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",103.833333333333,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["Scale factor at natural origin",1,
SCALEUNIT["unity",1],
ID["EPSG",8805]],
PARAMETER["False easting",28001.642,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",38744.572,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["northing (N)",north,
ORDER[1],
LENGTHUNIT["metre",1]],
AXIS["easting (E)",east,
ORDER[2],
LENGTHUNIT["metre",1]],
USAGE[
SCOPE["Cadastre, engineering survey, topographic mapping."],
AREA["Singapore - onshore and offshore."],
BBOX[1.13,103.59,1.47,104.07]],
ID["EPSG",3414]]
4.6 Check for invalid geometries
length(which(st_is_valid(rs_coords_sf) == FALSE))
[1] 0
Looks like there’s no invalid geometry.
4.7 Plot hdb resale points
tmap_mode("view")
tm_shape(rs_coords_sf)+
tm_dots(col="blue", size = 0.02)