hypertidy / reproj

Reproject with the PROJ library
http://hypertidy.github.io/reproj/
3 stars 0 forks source link

syntax changes for PROJ 6 #9

Closed mdsumner closed 4 years ago

mdsumner commented 4 years ago

When we actually use PROJ 6 rather than the deprecated API, we need to not use "+init=" and we can use "auth:code" and WKT directly:

wkt <- 'PROJCS["WGS 84 / Pseudo-Mercator",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Mercator_1SP"],
    PARAMETER["central_meridian",0],
    PARAMETER["scale_factor",1],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AXIS["Easting",EAST],
    AXIS["Northing",NORTH],
    EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs"],
    AUTHORITY["EPSG","3857"]]'

reproj::reproj(cbind(147, -42), source = "epsg:4326", "epsg:3857")
reproj::reproj(cbind(147, -42), source = "epsg:4326", wkt)
          [,1]       [,2] [,3]
[1,] 937586139 -295702340    0
Warning messages:
1: In to_proj(target) : not a proj-like string
2: In to_proj(source) : not a proj-like string

These are fine, but to_proj currently errors when finding not leading "+", and so we need to get the library version from proj4 to test.

Would we

mdsumner commented 4 years ago

Now use PROJ, implicit check on version with ok_proj6()

mdsumner commented 4 years ago

this is done also see #13