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

Equivalent of rgdal::make_EPSG() #532

Closed
Robinlovelace opened this issue Oct 26, 2017 · 6 comments
Closed

Equivalent of rgdal::make_EPSG() #532

Robinlovelace opened this issue Oct 26, 2017 · 6 comments

Comments

@Robinlovelace
Copy link
Contributor

Following discussion here we were looking to a way of getting some kind of description of available CRSs and according to @Nowosad this is not possible in sf:

head(rgdal::make_EPSG(), 3)
#>   code     note
#> 1 3819 # HD1909
#> 2 3821  # TWD67
#> 3 3824  # TWD97
#>                                                                                            prj4
#> 1 +proj=longlat +ellps=bessel +towgs84=595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408 +no_defs
#> 2                                                         +proj=longlat +ellps=aust_SA +no_defs
#> 3                                    +proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs

I was tempted to put this in #210 but thought it would be more useful as a separate issue and in case it's already implemented in a way we don't know about.

Thanks.

Robinlovelace referenced this issue in geocompx/geocompr Oct 26, 2017
…need to use rgdal to view all epsg codes from within R?
@edzer
Copy link
Member

edzer commented Oct 26, 2017

What you can do is

> st_crs(3819)
Coordinate Reference System:
  EPSG: 3819 
  proj4string: "+proj=longlat +ellps=bessel +towgs84=595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408 +no_defs"
> st_crs(3821)
Coordinate Reference System:
  EPSG: 3821 
  proj4string: "+proj=longlat +ellps=aust_SA +no_defs"
> st_crs(3824)
Coordinate Reference System:
  EPSG: 3824 
  proj4string: "+proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs"

but you don't have access to the set of valid EPSG codes, indeed.

@edzer edzer closed this as completed Oct 26, 2017
@Robinlovelace
Copy link
Contributor Author

Robinlovelace commented Oct 26, 2017

Is that intended? I can see potential benefits of being able search CRSs by name, e.g. for a user who knows about OSGB but does not know that its EPSG code is 27700.

@Nowosad
Copy link
Contributor

Nowosad commented Oct 26, 2017

I think that users would find a new function useful. I just used google and searched for "make_EPSG()" - there are many examples of functions and tutorials using this function.

@Robinlovelace
Copy link
Contributor Author

Reproducible use case (similar searches have been useful for me in the past):

e <- rgdal::make_EPSG()
e[grepl("OSGB", e$note), ]
#>       code                                             note
#> 206   4277                                      # OSGB 1936
#> 207   4278                                         # OSGB70
#> 4003 27700              # OSGB 1936 / British National Grid
#> 5060  7405 # OSGB 1936 / British National Grid + ODN height
#>                                                                                                                    prj4
#> 206                                                                                +proj=longlat +datum=OSGB36 +no_defs
#> 207                                                                                  +proj=longlat +ellps=airy +no_defs
#> 4003           +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +datum=OSGB36 +units=m +no_defs
#> 5060 +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +datum=OSGB36 +units=m +vunits=m +no_defs

@edzer
Copy link
Member

edzer commented Oct 26, 2017

Could one of you explain to me what exactly is wrong with rgdal::make_EPSG?

@Robinlovelace
Copy link
Contributor Author

Robinlovelace commented Oct 26, 2017

Nothing, just another dependency to do a common query possible in the sp world.

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

No branches or pull requests

3 participants