I have a individual land price data, and I am trying to get the flood hazard zone category using the flood hazard zone shape file (link here https://files.hawaii.gov/dbedt/op/gis/data/s_fld_haz_ar_state.zip) in R. The first 5 sample of land price data (from shapefile) is in the link below: https://drive.google.com/file/d/1HSN9e48CncqV0IRDqx41Ubf3fazhB-ey/view (I can't dput here because of limitation on characters of the question) .
library(sf)
flood_zone_sf<-read_sf("s_fld_haz_ar_state.shp")
# the variable I am interested is FLD_ZONE.
flood_zone_sf
flood_zone_sf
Simple feature collection with 14676 features and 21 fields
Geometry type: POLYGON
Dimension: XY
Bounding box: xmin: -160.2471 ymin: 18.90852 xmax: -154.8049 ymax: 22.23527
Geodetic CRS: WGS 84 (with axis order normalized for visualization)
First 10 features:
DFIRM_ID VERSION_ID FLD_AR_ID STUDY_TYP FLD_ZONE ZONE_SUBTY SFHA_TF STATIC_BFE V_DATUM DEPTH LEN_UNIT VELOCITY VEL_UNIT AR_REVERT AR_SUBTRV BFE_REVERT DEP_REVERT DUAL_ZONE SOURCE_CIT Shape_Leng Shape_Area
1 15001C 1.1.1.0 15001C_1 NP AE <NA> T 19 MSL -9999 Feet -9999 <NA> <NA> <NA> -9999 -9999 <NA> 15001C_FIS1 1021.7487 10228.030
2 15001C 1.1.1.0 15001C_2 NP AE <NA> T 10 MSL -9999 Feet -9999 <NA> <NA> <NA> -9999 -9999 <NA> 15001C_STUDY6 396.2263 3168.708
3 15001C 1.1.1.0 15001C_3 NP AE <NA> T -9999 <NA> -9999 <NA> -9999 <NA> <NA> <NA> -9999 -9999 <NA> 15001C_FIS1 1652.8730 56536.222
4 15001C 1.1.1.0 15001C_4 NP VE <NA> T 46 MSL -9999 Feet -9999 <NA> <NA> <NA> -9999 -9999 <NA> 15001C_STUDY6 883.2431 47108.242
5 15001C 1.1.1.0 15001C_5 NP VE <NA> T 22 MSL -9999 Feet -9999 <NA> <NA> <NA> -9999 -9999 <NA> 15001C_STUDY6 1975.2465 157356.794
6 15001C 1.1.1.0 15001C_6 NP VE <NA> T 14 MSL -9999 Feet -9999 <NA> <NA> <NA> -9999 -9999 <NA> 15001C_STUDY6 963.0295 53570.545
7 15001C 1.1.1.0 15001C_7 NP VE <NA> T 26 MSL -9999 Feet -9999 <NA> <NA> <NA> -9999 -9999 <NA> 15001C_STUDY6 1066.6585 63543.361
8 15001C 1.1.1.0 15001C_8 NP VE <NA> T 42 MSL -9999 Feet -9999 <NA> <NA> <NA> -9999 -9999 <NA> 15001C_STUDY6 912.4932 49507.926
9 15001C 1.1.1.0 15001C_9 NP VE <NA> T 26 MSL -9999 Feet -9999 <NA> <NA> <NA> -9999 -9999 <NA> 15001C_STUDY6 1300.7773 93243.093
10 15001C 1.1.1.0 15001C_10 NP VE <NA> T 10 MSL -9999 Feet -9999 <NA> <NA> <NA> -9999 -9999 <NA> 15001C_STUDY6 1715.9454 161528.883
geometry
1 POLYGON ((-155.6412 18.9361...
2 POLYGON ((-155.7276 18.9674...
3 POLYGON ((-155.6204 18.9688...
4 POLYGON ((-155.5913 18.9951...
5 POLYGON ((-155.5861 18.9999...
6 POLYGON ((-155.585 19.00383...
7 POLYGON ((-155.5841 19.0064...
8 POLYGON ((-155.5826 19.0054...
9 POLYGON ((-155.5823 19.0115...
10 POLYGON ((-155.5781 19.0169...
land_data_sf
Simple feature collection with 5 features and 1 field
Geometry type: MULTIPOLYGON
Dimension: XY
Bounding box: xmin: -157.9444 ymin: 21.33355 xmax: -157.9072 ymax: 21.3442
Geodetic CRS: WGS 84
meansaleprice geometry
1 415000 MULTIPOLYGON (((-157.9414 2...
2 415000 MULTIPOLYGON (((-157.9414 2...
3 5228200 MULTIPOLYGON (((-157.9072 2...
4 5228200 MULTIPOLYGON (((-157.9072 2...
5 5228200 MULTIPOLYGON (((-157.9072 2...
How do I extract FLD_ZONE from flood hazard zone shapefile for the land price shapefile using R?
I have used st_join
but I am getting error.
st_join(jj,flood_zone_sf)
Error in wk_handle.wk_wkb(wkb, s2_geography_writer(oriented = oriented, :
Loop 0 is not valid: Edge 4851 has duplicate vertex with edge 5006