Skip to content
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

The bounding box value returned by mesh_to_coords() is incorrect #31

Closed
uribo opened this issue May 15, 2019 · 1 comment
Closed

The bounding box value returned by mesh_to_coords() is incorrect #31

uribo opened this issue May 15, 2019 · 1 comment
Labels

Comments

@uribo
Copy link
Owner

uribo commented May 15, 2019

r-wakalang slackでの報告から

library(dplyr, warn.conflicts = FALSE)
library(tidyr)
library(purrr)
library(jpmesh)

df <- 
  tibble(longitude = 139.71475, 
       latitude = 35.70078, 
       mesh_size = c("80km", "10km", "1km", "500m", "250m", "125m")
) %>% 
  mutate(meshcode = pmap(list(longitude, latitude, mesh_size), 
                         coords_to_mesh)) %>% 
  unnest()

df %>% 
  mutate(mesh = pmap(list(meshcode), 
                     mesh_to_coords)) %>% 
  unnest() %>% 
  select(meshcode, mesh_size, lng_error, lat_error)
#> # A tibble: 6 x 4
#>   meshcode    mesh_size lng_error lat_error
#>   <chr>       <chr>         <dbl>     <dbl>
#> 1 5339        80km       0.5       0.333   
#> 2 533945      10km       0.0625    0.0417  
#> 3 53394547    1km        0.00625   0.00417 
#> 4 533945471   500m       0.00312   0.00208 
#> 5 5339454711  250m       0.000781  0.000521
#> 6 53394547112 125m       0.000195  0.000130

Created on 2019-05-15 by the reprex package (v0.2.1)

250m, 125mのlng_errorおよびlat_errorの値は 500mのそれの1/2, 1/4でなければならないが出力がおかしい。

@uribo uribo added the bug 💣 label May 15, 2019
@uribo uribo closed this as completed in 596d705 May 15, 2019
@uribo
Copy link
Owner Author

uribo commented May 16, 2019

fix.

df %>% 
  mutate(mesh = pmap(list(meshcode), 
                     mesh_to_coords)) %>% 
  unnest() %>% 
  select(meshcode, mesh_size, lng_error, lat_error)
#> # A tibble: 6 x 4
#>   meshcode    mesh_size lng_error lat_error
#>   <chr>       <chr>         <dbl>     <dbl>
#> 1 5339        80km       0.5       0.333   
#> 2 533945      10km       0.0625    0.0417  
#> 3 53394547    1km        0.00625   0.00417 
#> 4 533945471   500m       0.00312   0.00208 
#> 5 5339454711  250m       0.00156   0.00104 
#> 6 53394547112 125m       0.000781  0.000521

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant