Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have many geoPDFs. I want to turn them into KMZ or KML+JPEG using a python script.

Any suggestions?

SEE CODE BELOW

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

I don't have a script available, but you could probably write one using the GDAL library. GDAL has input support for geoPDF and output support for JPEG. You would need OGR for the KML output (http://www.gdal.org/ogr/ogr_formats.html).

share|improve this answer
add comment

This code below may help guide some one wanting to convert many geoPDFs to KML-Superoverlay which can then be incorporated as web map overlays using Google Maps API or Google Earth API...

import shlex
import subprocess
from subprocess import Popen, PIPE
import os


def step1_translate( input_file ):
    out = input_file + ".vrt"
    translate_command = "gdal_translate -of VRT %s %s" % (input_file,out)
    translate_args = shlex.split( translate_command )
    p1 = subprocess.Popen( translate_args) # translate
    print p1

def step2_warp( input_file):
    gdalwarp_command = "gdalwarp -of VRT -t_srs EPSG:4326 %s %s" % (output_file,output_file2)
    gdalwarp_args = shlex.split( gdalwarp_command )
    p2 = subprocess.Popen( gdalwarp_args   , stdin=p1.stdout ) #gdalwarp

def step3_tile( input_file, output_file, output_file2 ):
    gdal2tiles_command = "/home/boris/gdal/swig/python/scripts/gdal2tiles.py -p geodetic -k %s" % output_file2
    gdal2tiles_args = shlex.split( gdal2tiles_command )
    p3 = subprocess.Popen( gdal2tiles_args , stdin=p2.stdout) #gdal2tiles
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.