Opened 9 years ago

Closed 5 years ago

#5910 closed defect (wontfix)

Strange label size in PDF

Reported by: oleinik Owned by: warmerdam
Priority: normal Milestone: closed_because_of_github_migration
Component: OGR_SF Version: svn-trunk
Severity: normal Keywords:
Cc:

Description (last modified by oleinik)

I trying to export my vector data to PDF. Geometry exported normally, but labels - does not. I attach source of test file in python. Line 24 in test.py sets the results scale factor. Result files with scale factors 1 and 2 also attached. Both files must have identical aspect ratio between linear object and label size, but test2.pdf has label two size large then test1.pdf Tell me please how can I set properly label size ?

Attachments (4)

test.py (1.1 KB ) - added by oleinik 9 years ago.
Python source code
test1.pdf (2.7 KB ) - added by oleinik 9 years ago.
Result file with K = 1
test2.pdf (2.7 KB ) - added by oleinik 9 years ago.
Result file with K = 2
test_ground.pdf (2.7 KB ) - added by oleinik 9 years ago.
Result file with K = 1, Label Units - grounds

Download all attachments as: .zip

Change History (11)

by oleinik, 9 years ago

Attachment: test.py added

Python source code

by oleinik, 9 years ago

Attachment: test1.pdf added

Result file with K = 1

by oleinik, 9 years ago

Attachment: test2.pdf added

Result file with K = 2

comment:1 by oleinik, 9 years ago

Description: modified (diff)

comment:2 by oleinik, 9 years ago

Description: modified (diff)

comment:3 by Jukka Rahkonen, 9 years ago

By reading http://www.gdal.org/ogr_feature_style.html I believe that the default unit of label sixe is points. What I suppose you want is perhaps g: Map Ground Units (whatever the map coordinate units are). Try what happens if you define the exact unit in your code

"LABEL(f:""Arial"",s:{}g,t:""TEST"")"

Issue tracker is not the best place for asking questions about how to use GDAL. Write a mail to gdal-dev mailing list next time and leave bug tracker for identified bugs.

by oleinik, 9 years ago

Attachment: test_ground.pdf added

Result file with K = 1, Label Units - grounds

comment:4 by oleinik, 9 years ago

Thank for you suggestion, but it does not working, see attachment. I check every Feature Style Unit Systems before write this issue. I think that PDF writer has error either in converting label size or in trasforming coordinates in internal PDF units.

comment:5 by Jukka Rahkonen, 9 years ago

I made a test with two geometries:

POLYGON ((
        160 311, 
        160 640, 
        531 640, 
        531 311, 
        160 311
    ))

POINT (
    320 480
)

For the point I created an attribute OGG_STYLE and inserted value

LABEL(f:""Arial"",s:0.1g,t:""TEST"")

Saved into a shapefile, converted into PDF wit ogr2ogr

ogr2ogr -f pdf style.pdf style.shp

Changing the value of s:0.1g is changing the size of text in the PDF file. I had to experiment a bit with the size. s:1g printed only a half of the T with a huge font. I wonder in what units these values expressed as "g" are really printed into PDF.

I suggest for you too to make some working result with ogr2ogr first and then try to reproduce the same with Python.

comment:6 by oleinik, 9 years ago

Changing the value of s:0.1g is changing the size of text in the PDF file.

Yes, but size of text in PDF file is not associated with the coordinates of first geometry. We can set it's size to 1 unit - nothing changed.

POLYGON ((
  319 481, 
  321 481, 
  321 479, 
  319 479, 
  319 481
))

comment:7 by Even Rouault, 5 years ago

Milestone: closed_because_of_github_migration
Resolution: wontfix
Status: newclosed

This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.

Note: See TracTickets for help on using tickets.