-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
utm_convert function overwrites original utms - something going on with dimensions/rows? #146
Comments
I can reproduce this @Karine-Pigeon. data <- tibble::tibble(
Row_ID = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
NotSure = c(9608, 9609, 9610, 9611, 9612, 9613, 9614, 9615, 9616, 9617),
Zone = c(10, 10, 10, 10, 10, 10, 9, 9, 9, 9),
UTMe = c(
361775,
361775,
307196,
307196,
328213,
328213,
636424,
636648,
636795,
637401
),
UTMn = c(
6011950,
6011950,
5979777,
5979777,
5984261,
5984261,
6161177,
6161270,
6161127,
6160851
),
UTMe1 = c(
361775,
361775,
307196,
307196,
328213,
328213,
636424,
636648,
636795,
637401
),
UTMn1 = c(
6011950,
6011950,
5979777,
5979777,
5984261,
5984261,
6161177,
6161270,
6161127,
6160851
)
)
data
#> # A tibble: 10 × 7
#> Row_ID NotSure Zone UTMe UTMn UTMe1 UTMn1
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 9608 10 361775 6011950 361775 6011950
#> 2 2 9609 10 361775 6011950 361775 6011950
#> 3 3 9610 10 307196 5979777 307196 5979777
#> 4 4 9611 10 307196 5979777 307196 5979777
#> 5 5 9612 10 328213 5984261 328213 5984261
#> 6 6 9613 10 328213 5984261 328213 5984261
#> 7 7 9614 9 636424 6161177 636424 6161177
#> 8 8 9615 9 636648 6161270 636648 6161270
#> 9 9 9616 9 636795 6161127 636795 6161127
#> 10 10 9617 9 637401 6160851 637401 6160851
data2 <- bcmaps::utm_convert(data,
easting = "UTMe",
northing = "UTMn",
zone = "Zone")
data2
#> Simple feature collection with 10 features and 9 fields
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: 947410.6 ymin: 991848.1 xmax: 1057160 ymax: 1176079
#> Projected CRS: NAD83 / BC Albers
#> Row_ID NotSure Zone UTMe1 UTMn1 X Y UTMe UTMn
#> 9.1 7 9614 9 636424 6161177 947410.6 1175995.7 361775 6011950
#> 9.2 8 9615 9 636648 6161270 947637.9 1176079.3 361775 6011950
#> 9.3 9 9616 9 636795 6161127 947778.3 1175929.7 307196 5979777
#> 9.4 10 9617 9 637401 6160851 948370.4 1175627.1 307196 5979777
#> 10.1 1 9608 10 361775 6011950 1057160.4 1026400.1 328213 5984261
#> 10.2 2 9609 10 361775 6011950 1057160.4 1026400.1 328213 5984261
#> 10.3 3 9610 10 307196 5979777 1004137.0 991848.1 636424 6161177
#> 10.4 4 9611 10 307196 5979777 1004137.0 991848.1 636648 6161270
#> 10.5 5 9612 10 328213 5984261 1024888.8 997232.0 636795 6161127
#> 10.6 6 9613 10 328213 5984261 1024888.8 997232.0 637401 6160851
#> geometry
#> 9.1 POINT (947410.6 1175996)
#> 9.2 POINT (947637.9 1176079)
#> 9.3 POINT (947778.3 1175930)
#> 9.4 POINT (948370.4 1175627)
#> 10.1 POINT (1057160 1026400)
#> 10.2 POINT (1057160 1026400)
#> 10.3 POINT (1004137 991848.1)
#> 10.4 POINT (1004137 991848.1)
#> 10.5 POINT (1024889 997232)
#> 10.6 POINT (1024889 997232) It looks like |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
R version 4.4.1 (also with 4.3.1)
bcmaps version 2.2.0
df1.txt
#original subset of data:
print(df1)
Row_ID Zone UTMe UTMn UTMe1 UTMn1
1 9608 10 361775 6011950 361775 6011950
2 9609 10 361775 6011950 361775 6011950
3 9610 10 307196 5979777 307196 5979777
4 9611 10 307196 5979777 307196 5979777
5 9612 10 328213 5984261 328213 5984261
6 9613 10 328213 5984261 328213 5984261
7 9614 9 636424 6161177 636424 6161177
8 9615 9 636648 6161270 636648 6161270
9 9616 9 636795 6161127 636795 6161127
10 9617 9 637401 6160851 637401 6160851
#UTMe1 = UTMe
#UTMn1 = UTMn
df2 <- utm_convert(df1, easting = "UTMe", northing = "UTMn", zone = "Zone")
print(df2)
Simple feature collection with 10 features and 8 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 947410.6 ymin: 991848.1 xmax: 1057160 ymax: 1176079
Projected CRS: NAD83 / BC Albers
Row_ID Zone UTMe1 UTMn1 X Y UTMe UTMn geometry
9.7 9614 9 636424 6161177 947410.6 1175995.7 361775 6011950 POINT (947410.6 1175996)
9.8 9615 9 636648 6161270 947637.9 1176079.3 361775 6011950 POINT (947637.9 1176079)
9.9 9616 9 636795 6161127 947778.3 1175929.7 307196 5979777 POINT (947778.3 1175930)
9.10 9617 9 637401 6160851 948370.4 1175627.1 307196 5979777 POINT (948370.4 1175627)
10.1 9608 10 361775 6011950 1057160.4 1026400.1 328213 5984261 POINT (1057160 1026400)
10.2 9609 10 361775 6011950 1057160.4 1026400.1 328213 5984261 POINT (1057160 1026400)
10.3 9610 10 307196 5979777 1004137.0 991848.1 636424 6161177 POINT (1004137 991848.1)
10.4 9611 10 307196 5979777 1004137.0 991848.1 636648 6161270 POINT (1004137 991848.1)
10.5 9612 10 328213 5984261 1024888.8 997232.0 636795 6161127 POINT (1024889 997232)
10.6 9613 10 328213 5984261 1024888.8 997232.0 637401 6160851 POINT (1024889 997232)
#in df2, row IDs are now scrambled and original UTMe and UTMn get overwritten.
The text was updated successfully, but these errors were encountered: