views:

54

answers:

2

I want to organize lots of geoPDF files so they can easily viewed overlayed onto Google Maps and Google Earth.

My 1st step, I think, is to convert the geoPDF to a jpg type image which then needs matching lat,long information.

Is there python code to parse a geoPDF file to get the projection and image data?

A geoPDF2KML tool?

+1  A: 

One option is to use GDAL...

The latest version (i.e. the current svn trunk, not any released version) of gdal should support geoPDF's.

You'll need to compile it with the option --with-poppler=yes and have the poppler pdf library installed. (Compiling gdal can be a bit of a pain, just to warn you ahead of time...)

Gdal's python bindings are painful, but they generally work.

From there, you should be able to easily use GDAL to convert your geopdf's to georeferenced jpegs.

If you're not already familiar with GDAL, though, this may be more trouble than it's worth. The georeferenceing information in a geoPDF can probably be extracted in other ways...

Hope that helps a bit, anyway...

Joe Kington
thanks...wish me luck ...i will try to comppile gdal...cheers
indiehacker
@indiehacker - Good luck! It can be a pain, but hopefully it goes smoothly! I've never actually tried using a geoPDF with GDAL before, so hopefully that works smoothly, too... I know it's "supposed" to, as of very recently, but I have yet to try it... Good luck, regardless!
Joe Kington
I am not able to get GDAL to read the geoPFD.pdf file. I think I compiled the most recent SVN version of gdal successfully after installing the dependencies needed using ./configure --with-poppler=yes --with-python. After I run gdal$gdalinfo test_geo.pdf I see returned "ERROR 4: 'test_geo.pdf' not recognised as a supported file format." when i configured poppler i made sure to have "--enable-xpdf-headers" as the Geospatial PDF doc says to do ...any suggestions??
indiehacker
@Joe Kington --- please see above comment.....thanks again
indiehacker
@indiehacker - Does `pdf` show up as a format when you run `gdal-config --formats`? If not, then gdal didn't detect your poppler installation... You may have to specify the path to it manually with `--with-poppler=/path/to/poppler/install/` I just tried building the latest svn version, and it seems to work fine with the couple of geoPDF's I had laying around, for whatever that's worth...
Joe Kington
I got it to work with the above help! Doing a "$locate include/poppler" resulted in finding "usr/local/include/poppler" so ---> STEP 1 was to re-install poppler: "poopler$./configure --enable-xpdf-headers --prefix=/usr/local/include/poppler" then the usual "$make" and "$make install". STEP 2 was to re-install gdal with a path to poppler: "gdal$./configure --with-poppler=/usr/local/include/poppler. THANKS
indiehacker
+1  A: 

Steps I used on ubuntu system that has python (python already part of Unbuntu) 1. download and install poppler 2. download and install proj4 3. download and install gdal

poppler$./configure --enable-xpdf-headers --prefix=/usr/local/include/poppler" then the usual "$make" and "$make install"

poppler$make

poppler$sudo make install

sudo apt-get install proj4

gdal$./configure --with-static-proj4=/usr/local/lib --with-threads --with-libtiff=internal --with-geotiff=internal --with-jpeg=internal --with-gif=internal --with-png=internal --with-libz=internal --with-poppler=/usr/local/include/poppler --with-python

gdal$make

gdal$sudo make install 
indiehacker