Skip to content

GeoPDF raster on Windows #1063

@mdsumner

Description

@mdsumner

I cannot get anything from the GeoPDF raster driver on Windows.

Any ideas?

Create a PDF (it won't have georeferencing or CRS, but that shouldn't matter).

##
library(magrittr)
library(sf)
st_drivers() %>% dplyr::filter(grepl("PDF", name))
#   name      long_name  write copy is_raster is_vector   vsi
#   PDF   Geospatial PDF  TRUE TRUE      TRUE      TRUE FALSE
library(sf)
example(st_read)
pdf("myfile.pdf")
plot(nc[1], reset = FALSE)
dev.off()
st <- stars::read_stars("myfile.pdf")
## file not found

Create a GeoPDF directly with gdal_translate to check it's not the PDF variant from R:

## WARNING : this is a broken data set, it's not meant to be georeferenced correctly it's just a test
system("gdal_translate myfile.pdf ext-geo.pdf -of PDF -a_ullr 0 10 10 0 -a_srs '+init=epsg:4326' ")
system("gdalinfo ext-geo.pdf")
#Driver: PDF/Geospatial PDF
#Files: ext-geo.pdf
#Size is 1050, 1050
#Coordinate System is:
#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"]]
#Origin = (0.000000000000000,10.000000000000000)
#Pixel Size = (0.009523809523810,-0.009523809523810)
#Metadata:
#  CREATION_DATE=D:20190530231058
#  CREATOR=R
#  DPI=72
#  NEATLINE=POLYGON ((0 10,0 0,10 0,10 10,0 10))
#  PRODUCER=R 3.5.3
#  TITLE=R Graphics Output
#Corner Coordinates:
#Upper Left  (   0.0000000,  10.0000000) (  0d 0' 0.01"E, 10d 0' 0.00"N)
#Lower Left  (   0.0000000,  -0.0000000) (  0d 0' 0.01"E,  0d 0' 0.00"S)
#Upper Right (  10.0000000,  10.0000000) ( 10d 0' 0.00"E, 10d 0' 0.00"N)
#Lower Right (  10.0000000,  -0.0000000) ( 10d 0' 0.00"E,  0d 0' 0.00"S)
#Center      (   5.0000000,   5.0000000) (  5d 0' 0.00"E,  5d 0' 0.00"N)
#Band 1 Block=1050x1 Type=Byte, ColorInterp=Red
#Band 2 Block=1050x1 Type=Byte, ColorInterp=Green
#Band 3 Block=1050x1 Type=Byte, ColorInterp=Blue

No good

stars::read_stars("ext-geo.pdf")
Error in CPL_read_gdal(as.character(x), as.character(options), as.character(driver),  : 
  file not found

I've tried the full path, with escaped back slash and single forward slash. All works fine on Linux.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions