[gdal-dev] geospatialPDF DPI and EXTRA_IMAGES

Even Rouault even.rouault at spatialys.com
Thu May 26 08:23:05 PDT 2016


On Thursday 26 May 2016 09:38:21 Luca Delucchi wrote:
> On 25 May 2016 at 17:12, Even Rouault <even.rouault at spatialys.com> wrote:
> > The following extract from the driver should hopefully answer your 
questions :
> more or less yes, now I understood a little bit more but..
> 
> >     double dfUserUnit = dfDPI * USER_UNIT_IN_INCH;
> >     double dfWidthInUserUnit = nWidth / dfUserUnit + sMargins.nLeft +
> >     sMargins.nRight; double dfHeightInUserUnit = nHeight / dfUserUnit +
> >     sMargins.nBottom + sMargins.nTop;> 
> > --> nWidth and nHeight are the dimensions of the source raster in pixel.
> 
> if I have no raster how can I found this two values?

Ah ok, so you create a vector dataset then ?

Here's the relevant code in pdfwritabledataset.cpp:

    double dfRatio = (sGlobalExtent.MaxY - sGlobalExtent.MinY) / 
(sGlobalExtent.MaxX - sGlobalExtent.MinX);

    int nWidth, nHeight;

    if (dfRatio < 1)
    {
        nWidth = 1024;
        nHeight = static_cast<int>(nWidth * dfRatio);
    }
    else
    {
        nHeight = 1024;
        nWidth = static_cast<int>(nHeight / dfRatio);
    }

where sGlobalExtent is the georeferenced extent of the vectors added in the 
PDF vector layer.

Even



-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list