Thursday 8 July 2010

Results of Tests with scalestyle.rb

scalestyle.rb is a ruby script that performs the scaling operations outside mapnik. It modifies the line widths and font sizes directly in the stylesheet before it is passed to mapnik for rendering.

The following images were created with nik2img.py, all with a scale factor of 1.0.

Text

Labels are scaled correctly.

600x400 Scale factor of ruby script: 1.0

1200x800 Scale factor of ruby script: 2.0


1800x1200 Scale factor of ruby script: 3.0

Dashes

Dashes don't seem to be scaled.

600x400 Scale factor of ruby script: 1.0


1200x800 Scale factor of ruby script: 2.0

1800x1200 Scale factor of ruby script: 3.0

Lines

Lines either.

600x400 Scale factor of ruby script: 1.0

1200x800 Scale factor of ruby script: 2.0

1800x1200 Scale factor of ruby script: 3.0

Test Results

I wanted to post these results in redmine, but the wiki doesn't support resizing of images.

Here are the results of some tests with scale factors. The tests are organized according to the element they test. For each element tested (lines, dashes or fonts), I created a style based on osm.xml, removing the symbolizers I didn't need with the purpose of emphasizing the element. The images were created using nik2img.py.

Text

The three images appear scaled and very similar. The second image has twice the size of the first one, with a scale factor of 2 to fix the size of the labels. The third image has three times the size of the first and a scale factor of 2.

600x400 Scale-factor: 1.0

1200x800 Scale-factor: 2.0

1800x1200 Scale-factor: 3.0

Although the size of the labels seems to be correct, some of them move from one image to the other.

Dashes

The following images were created with a style that contained only line symbolizers with dashes.

600x400 Scale-factor: 1.0

1200x800 Scale-factor: 2.0

1800x1200 Scale-factor: 3.0

Lines

Lines also seem to be scaled correctly.

600x400 Scale-factor: 1.0

1200x800 Scale-factor: 2.0

1800x1200 Scale-factor: 3.0