[gdal-dev] Trouble with georeferenced PDF

Even Rouault even.rouault at mines-paris.org
Thu Mar 1 15:39:49 EST 2012


Le jeudi 01 mars 2012 21:00:41, Rahkonen Jukka a écrit :
> Hi,
> 
> Good to know. Obviously I will need to make more tests with other
> computers. This combination (TerraGo Toolbar and Acrobat X reader on Vista
> (32-bit) for sure does not show metadata correctly for that very same PDF
> file.

For the record, I've tested it with Acrobat Reader X under Wine. If I've time, 
I'll check under a regular Win XP installation

> 
> I can see that some metadata is in plain text in the EPSG:32635 file but
> perhaps as some PDF strings in the EPSG:3067 version. The OGC Best
> Practise paper seems to suggest using the PDF strings.

The paper suggests using PDF strings for numeric values to have higher 
percision, but that's not a requirement (and the driver will anyway use that 
capability when needed).

As far as the difference between your 2 sample files, you can see indeed some 
strings encoded in hexadecimal or in regular form, but reviewing the PDF spec, 
I don't see anything to fix in the driver concerning the strategy that decides 
whether regular string or hexadecimal should be selected.

> Perhaps that can
> make difference with some OS + country setting combination or something.

Hum, you can perhaps try something. In the projection information, I've added 
a WKT attribute that is not in the OGC BP spec and is an extension only used 
for the benefit of GDAL when it is found (it avoids loosing information when 
going from/to OGC BP representation). You can disable its writting by setting 
the GDAL_PDF_OGC_BP_WRITE_WKT configuration option to NO. But I'm a bit 
skeptical it will help. In my testing, the toolbar just happily ignored it, as 
it should.

> 
> -Jukka-
> 
> ________________________________________
> Lähettäjä: Even Rouault [even.rouault at mines-paris.org]
> Lähetetty: 1. maaliskuuta 2012 21:46
> Vastaanottaja: Rahkonen Jukka
> Kopio: 'gdal-dev at lists.osgeo.org'
> Aihe: Re: [gdal-dev] Trouble with georeferenced PDF
> 
> Le jeudi 01 mars 2012 11:43:59, Rahkonen Jukka a écrit :
> > Hi,
> > 
> > EPSG:3067 works for me too.
> 
> I meant EPSG:32635 sorry. But now, I've downloaded your
> http://latuviitta.org/documents/GDAL_OGC_32635.pdf sample and it is
> properly recognized by TerraGo toolbar and the coordinates reported are
> consistant with gdalinfo output.... And I can see the Document - Page 1 -
> Map Frame 1 structure.
> 
> > The toolbar is installed yesterday from
> > TerraGo. I am just an end user and I cannot do any difficult things like
> > compiling. I tried to edit the EPSG:32635 description with hex editor and
> > changed "/" into "N".  No effect, TerraGo tool bar does not find the
> > coordinates.
> > 
> > With EPSG:32635 GeoPDF file properties does not show any document tree
> > structure. It is just "Document". With EPSG:3067 it is Document - Page 1
> > - Map Frame 1. Perhaps there is something that truncates the metadata?
> > 
> > -Jukka Rahkonen-
> > 
> > Een Rouault wrote:
> > > Selon Rahkonen Jukka <Jukka.Rahkonen at mmmtike.fi>:
> > > 
> > > Nice to see early testers of geospatial PDF writing support !
> > > 
> > > I'm currently behind a corporate firewall that prevents
> > > access to your samples,
> > > but I did a quick test similar to yours and EPSG:3067 seems
> > > to work fine with
> > > Terrago Toolbar (v5.7.70). However I suspect that the
> > > presence of the unescaped
> > > slash (/) in the Description string might be the cause of the
> > > issue (if you have
> > > a different version of the toolbar). I've not verified if it
> > > is allowed or not
> > > by the PDF spec, but poppler doesn't seem to have issue with it.
> > > 
> > > So perhaps you could try the following patch that will encode
> > > strings with
> > > slashes into hexadecimal UTF16 sequences :
> > > 
> > > Index: pdfobject.cpp
> > > ===================================================================
> > > --- pdfobject.cpp   (revision 24040)
> > > +++ pdfobject.cpp   (working copy)
> > > @@ -63,7 +63,7 @@
> > > 
> > >      for(i=0;(ch = pabyData[i]) != '?';i++)
> > >      {
> > >      
> > >          if (ch < 32 || ch > 127 ||
> > > 
> > > -            ch == '(' || ch == ')' ||
> > > +            ch == '(' || ch == ')' || ch == '/' ||
> > > 
> > >              ch == '\' || ch == '%' || ch == '#')
> > >              break;
> > >      
> > >      }
> > > > 
> > > > Hi,
> > > > 
> > > > I had a quick test by converting one GeoTIFF into
> > > 
> > > georeferenced PDF files
> > > 
> > > > with different parameters and opening results with Acrobat
> > > 
> > > Reader and TerraGo
> > > 
> > > > toolbar.
> > > > 
> > > > For TerraGo the metadata must be in OGC_BP style and ISO
> > > 
> > > style metadata must
> > > 
> > > > not exist (option BOTH does not work). What is odd is that
> > > 
> > > TerraGo toolbar
> > > 
> > > > finds coordinates if I run gdal_translate with -a_srs
> > > > epsg:3067 but not if I run it with -a_srs epsg:32635.
> > > > There seems to something different in the PDF headers, here
> > > 
> > > are short
> > > 
> > > > captures
> > > > from the beginnings of the files
> > > > 
> > > > EPSG:32635 which is not understood by TerraGo toolbar
> > > > 
> > > > %PDF-1.6
> > > > %<bh:ff><bh:ff><bh:ff><bh:ff>
> > > > 7 0 obj
> > > > << /CTM [ (0.5487347256) 0 0 (0.5487347256) (3409989.640548643)
> > > > (6956053.279989699) ] /Description (WGS 84 / UTM zone 35N) /Neatline
> > > > 
> > > > EPSG:3067 which is OK for TerraGo
> > > > 
> > > > %PDF-1.6
> > > > %<bh:ff><bh:ff><bh:ff><bh:ff>
> > > > 7 0 obj
> > > > << /CTM [ (0.5487347256) 0 0 (0.5487347256) (3409989.640548643)
> > > > (6956053.279989699) ] /Description
> > > 
> > > <FEFF0045005400520053003800390020002F00200054004D0033003500460
> > > 049004E00280045002C004E0029>
> > > 
> > > > /Neatline
> > > > 
> > > > Images are available here
> > > > http://latuviitta.org/documents/GDAL_OGC_32635.pdf
> > > > http://latuviitta.org/documents/GDAL_OGC_3067.pdf
> > > > 
> > > > -Jukka Rahkonen-
> > > > 
> > > > -Jukka Rahkonen-_______________________________________________
> > > > gdal-dev mailing list
> > > > gdal-dev at lists.osgeo.org
> > > > http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list