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

Output unification from geocode #11

Open
kadyb opened this issue Aug 9, 2020 · 5 comments
Open

Output unification from geocode #11

kadyb opened this issue Aug 9, 2020 · 5 comments
Labels
enhancement New feature or request

Comments

@kadyb
Copy link
Owner

kadyb commented Aug 9, 2020

Depending on the given object, there are returned lists with different attributes as a result. It would look better if it was unified. Note, a single list or multiple lists (if there are n of the same objects in different locations) can be returned.

library("rgugik")

# place
lapply(geocode(address = "Marki")[1], names)
#> $`1`
#> [1] "city"         "teryt"        "simc"         "voivodeship" 
#> [5] "county"       "commune"      "x"            "y"           
#> [9] "geometry_wkt" "accuracy"     "id"           "jednostka" 

# place and street
names(geocode(address = "Marki, Andersa")) # IT'S LINE, NOT POINT
#> [1] "street"       "teryt"        "simc"         "ulic"        
#> [5] "city"         "x"            "y"            "geometry_wkt"
#> [9] "accuracy"     "id"           "jednostka"   

# place, street and house number
names(geocode(address = "Marki, Andersa 1"))
#> [1] "city"            "citypart"        "street"         
#> [4] "number"          "teryt"           "simc"           
#> [7] "ulic"            "code"            "jednostka"      
#> [10] "x"               "y"               "geometry_wkt"   
#> [13] "accuracy"        "city_accuracy"   "street_accuracy"
#> [16] "id"   

# place and house number
names(geocode(address = "Królewskie Brzeziny 13"))
#> [1] "city"          "citypart"      "street"       
#> [4] "number"        "teryt"         "simc"         
#> [7] "ulic"          "code"          "jednostka"    
#> [10] "x"             "y"             "geometry_wkt" 
#> [13] "accuracy"      "city_accuracy" "id"  

# physiographic object 1
names(geocode(geoname = "Las Mierzei"))
#> [1] "name"         "genitive"     "voivodeship"  "county"      
#> [5] "commune"      "class"        "type"         "status"      
#> [9] "geometry_wkt" "x"            "y"            "accuracy"  

# physiographic object 2
lapply(geocode(geoname = "Jeziorak")[1], names)
#> [1] "name"         "genitive"     "voivodeship"  "county"      
#> [5] "commune"      "class"        "type"         "status"      
#> [9] "notes"        "geometry_wkt" "x"            "y"           
#> [13] "accuracy"

In case "road" or "rail crossing", output is OK.

@kadyb kadyb added the enhancement New feature or request label Aug 9, 2020
@Nowosad
Copy link
Collaborator

Nowosad commented Aug 16, 2020

@kadyb I can think of two solutions:

  1. Find one set of common variables (I would guess ~20 based on your examples above). Create an object template with these ~20 variables (columns) and next fill them with downloaded data. In case when some query does not return a variable - the variable stays NA.
  2. Split possible results into several groups (as above). Treat each group independently.

What do you think about this issue?

@kadyb
Copy link
Owner Author

kadyb commented Sep 10, 2020

To information:
We currently have a lot of duplicate code, so we should create some helper function.

@kadyb
Copy link
Owner Author

kadyb commented Oct 28, 2020

BTW. is it possible that geocodePL_get() may return sf object instead of list? That would be super useful for speeding up the processing and merging with other data?

Fixed in #43.

@BERENZ
Copy link
Contributor

BERENZ commented Oct 31, 2020

Concerning this issue, maybe we could leave this for the user? We do not know which columns they will use or find useful for their analysis.

@kadyb
Copy link
Owner Author

kadyb commented Oct 31, 2020

I think we can safely remove the meaningless columns:
x, y, id, jednostka, accuracy, city_accuracy, street_accuracy

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

No branches or pull requests

3 participants