I have some georeferenced pdf's that I would like to open in QGIS. I have read that GDAL version 1.8 and higher will support pdf, and I have GDAL 1.10 installed with QGIS 2.0 on Windows 7, but when I add raster layer then choose my pdf file, I get an error that my file is not a supported source.
[GIS] How to add Georeferenced PDF as layer to QGIS 2.0
gdalgeospatial-pdfqgis
Related Solutions
It doesn't look like it is included in the most recent GDAL-Complete framework. Please file a request with kyngchaos.com.
In the meantime, if you don't mind trying it yourself, you can attempt to build a shared plugin for GDAL 1.10, install it, and see if it works with your data source:
Ensure you have XCode and/or its command line tools installed.
Download and install latest MySQL Community Server (installs to
/usr/local/mysql
).Download the GDAL source and un-archive to folder, e.g.
gdal-1.10.1
, and enter it.$ cd /path/to/gdal-1.10.1
Edit a single source file and comment-out unsupported symbols in MySQL 5.6+ client
ogr/ogrsf_frmts/mysql/ogrmysqldatasource.cpp @ line 130
/* -------------------------------------------------------------------- */ /* Use options process to get .my.cnf file contents. */ /* -------------------------------------------------------------------- */ int nPort = 0, i; char **papszTableNames=NULL; std::string oHost, oPassword, oUser, oDB; // char *apszArgv[2] = { (char*) "org", NULL }; // char **papszArgv = apszArgv; // int nArgc = 1; // const char *client_groups[] = {"client", "ogr", NULL }; my_init(); // I hope there is no problem with calling this multiple times! // load_defaults( "my", client_groups, &nArgc, &papszArgv ); // // for( i = 0; i < nArgc; i++ ) // { // if( EQUALN(papszArgv[i],"--user=",7) ) // oUser = papszArgv[i] + 7; // else if( EQUALN(papszArgv[i],"--host=",7) ) // oHost = papszArgv[i] + 7; // else if( EQUALN(papszArgv[i],"--password=",11) ) // oPassword = papszArgv[i] + 11; // else if( EQUALN(papszArgv[i],"--port=",7) ) // nPort = atoi(papszArgv[i] + 7); // } // // // cleanup // free_defaults( papszArgv );
Build shared plugin, in Terminal:
# make directory for build output $ mkdir ogr_plugins # compile shared plugin, statically linking in libmysqlclient (multi-line, single command) $ g++ -Wall -g ogr/ogrsf_frmts/mysql/*.c* \ -shared -o ogr_plugins/ogr_MySQL.dylib /usr/local/mysql/lib/libmysqlclient.a \ -Iport -Igcore -Iogr -Iogr/ogrsf_frmts -Iogr/ogrsf_frmts/mysql \ -I/Library/Frameworks/GDAL.framework/Headers -I/usr/local/mysql/include \ -framework GDAL -lz -install_name ogr_MySQL.dylib */ #just closing comment for SE syntax highlighting # copy plugin to known GDAL_DRIVER_PATH (sudo needed) $ cd ogr_plugins $ sudo cp -f ogr_MySQL.dylib /Library/Application\ Support/GDAL/1.10/PlugIns/
Verify plugin:
$ cd /path/to/gdal-1.10.1 $ otool -L ogr_plugins/ogr_MySQL.dylib ogr_plugins/ogr_MySQL.dylib: ogr_MySQL.dylib (...) /Library/Frameworks/GDAL.framework/Versions/1.10/GDAL (...) /usr/lib/libz.1.dylib (...) /usr/lib/libstdc++.6.dylib (...) /usr/lib/libSystem.B.dylib (...) $ ogrinfo --formats | grep 'MySQL' -> "MySQL" (read/write)
Launch QGIS and verify plugin loading in PyQGIS console:
from osgeo import ogr sorted([ogr.GetDriver(drv).name for drv in range(0,ogr.GetDriverCount())])
You should be able to connect to a MySQL data source via
Add Vector > Database > ...
now.
Please note, I don't have any geospatial MySQL data sources, so was unable to test the plugin I built.
Your bio1_test.asc file is in GeoTiff format (despite the .asc). I had the same problem using the Raster -> translate (Convert Format) form. If you look in the command box at the bottom of the form you will see something like:
gdal_translate -of GTiff
C:/***/bio1_test.tiff bio1_test.asc
change this to:
gdal_translate -of AAIGrid
C:/***/bio1_test.tiff bio1_test.asc
(click on the pencil button at right to edit the command) This worked but gave me the following message:
Warning 1: Producing a Golden Surfer style file with DX and DY instead of CELLSIZE since the input pixels are non-square. Use the FORCE_CELLSIZE=TRUE creation option to force use of DX for even though this will be distorted. Most ASCII Grid readers (ArcGIS included) do not support the DX and DY parameters.
I am not sure why the input pixels were not square, perhaps because the data were not projected (I also specified a long, lat extent for the output). My pixel sizes were minimally different:
dx = 0.008334561355
dy = 0.008335388377
I changed the command to:
gdal_translate -co force_cellsize=true -of AAIGrid
path/input_filename.ext output_filename.asc
which gave me an ESRI ASCII grid file that I could use in MaxEnt. There was no noticeable distortion or difference between these grids in a QGIS project.
Best Answer
I downloaded probably the same pdf from http://pub.data.gov.bc.ca/datasets/177864/pdf/092f/092F088.pdf Then I run gdalinfo with GDAL 1.10 on Windows 7 64-bit. GDAL was installed from gisinternals.com. Gdalinfo finds georeferencing
Then I tried to open the pdf with QGIS 2.0.1 and it fails. Conclusion: We both have a QGIS version that does not support pdf. While awaiting such a build that has the support you can convert geospatial pdf files into GeoTIFFs with gdal_translate by using the binaries from gisinternals. The pdf driver in GDAL is exceptional because write support is compiled by default but for read support GDAL must be especially compiled with libpoppler or libpodofo.