2

UPDATED To clarify my previous post. I have written a small application to convert maps saved as PDF's to PNG files then tile the maps to be used in a webservice. After experimenting with the PNG Maps and updating my GDAL library to a newer version (1.9.2) Nuget GDAL in my program. I started experimenting with PDF's directly and not going through the time intensive task of converting them to PNG files. A couple of things I have noticed in switching to PDF's is that:

1) the 256 pixel tiles are of better quality.

2) the tiling process runs much faster.

I have a lot of maps to convert on a daily basis, so the speed and quality improvements are a plus. One thing that pops up on quite a few PDF's that I tile is the exception: "Cannot Find GPTS Object". This happens immediately when I go to open the dataset with the following code:

if(System.IO.Path.GetExtension(pathFile) == ".pdf" || System.IO.Path.GetExtension(pathFile) ==".png") { ds = Gdal.Open(pathFile, Access.GA_ReadOnly);// blows out on open } else { ds = Gdal.Open(pathFile, Access.GA_Update); }

I have searched quite a few hours on this exception and cannot find any documentation on it other than the source code that the exception is generated from. I was wondering if anybody had run across this before and if there is a solution to the problem.

The PDF maps are not georeferenced.

1

I hit the same error message and even though my code is python (using GDAL python bindings) the behaviour is exactly the same, "Cannot Find GPTS Object" is thrown on an attempt to open the file and there is no obvious way to silence it or get around it.

It looks like the error is thrown, because gdal makes an assumption about the PDF format that is not true for some files - the implementation can be seen here.

There is one ugly workaround that I am using for now - before trying to open the file I am doing this:

gdal_translate -of pdf invalid.pdf working.pdf

After this I can open working.pdf and work with it.

It is really cumbersome, ugly and I hate doing this, but it does help.

0

I got the same issue and I found that multiple child layers have been defined in the PDF layer and GDAL is crashing while opening the dataset. There is a GDAL configuration option to uncheck the child layers and then open the PDF dataset. All you need to do is just set this option GDAL_PDF_LAYERS_OFF to "ALL". Here is the link to the other options

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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