Skip to content
This repository

Raster rendering bug and 'Segmentation fault' error #799

Closed
artemp opened this Issue October 11, 2011 · 8 comments

2 participants

Artem Pavlenko Dane Springmeyer
Artem Pavlenko
Owner

Large semi-transparent paletted PNG images (hillshade layer for the whole world, see attached test data) rendering bug. PNG part of XML used (for example):

 <Style name="zl04">
   <Rule>
     <RasterSymbolizer opacity="1.0" mode="multiply" scaling="bilinear8" filter-factor="-1" /></Rule>
 </Style>

 <Layer name="zl04">
   <StyleName>zl04</StyleName>
   <Datasource>
     <Parameter name="type">gdal</Parameter>
     <Parameter name="file">/home/mapnik/raster/zl04.png</Parameter>
   </Datasource>
 </Layer>

Using Mapnik2 r3009 and GDAL 1.8.0-1 under Debian.

Without additional vector data:

  1. At the 2nd zoom level get an error: 'Segmentation fault'.
  2. 1st zoom level - OK.

With additional vector data:

  1. At the 3rd zoom level get an error: 'Segmentation fault'.
  2. At 2nd zoom level get dark tiles without hillshade (not whole world, but 3/4 part of it).
  3. 1st zoom level - OK.
Artem Pavlenko
Owner

[Andrey VI] [http://rghost.ru/14612571 test data (3.5 MiB)]

Artem Pavlenko
Owner

[springmeyer] Andrey, can you try applying this patch:

Index: src/image_util.cpp
===================================================================
--- src/image_util.cpp  (revision 3040)
+++ src/image_util.cpp  (working copy)
@@ -363,7 +363,7 @@
     {
         ys = (y*source_height+offs_y)/target_height;
         int ys1 = ys+1;
-        if (ys1>=source_height)
+        if (ys1>=source_height-1)
             ys1--;
         if (ys<0)
             ys=ys1=0;
@@ -381,7 +381,7 @@
                 xprt = tw2;
             xprt1 = target_width-xprt;
             int xs1 = xs+1;
-            if (xs1>=source_width)
+            if (xs1>=source_width-1)
                 xs1--;
             if (xs<0)
                 xs=xs1=0;
Artem Pavlenko
Owner

[springmeyer] are you sure? are you sure the patch was applied correctly and that you reinstalled fully? are you using bilinear8 and the latest mapnik svn HEAD?

Artem Pavlenko
Owner

[Andrey VI] Unfortunately, this patch doesn't resolve any problem.

Artem Pavlenko
Owner

[Andrey VI] Yes, I'm sure that the patch was applied correctly. Now I have Mapnik2 r3047 installed.
But now I'm not sure that using bilinear8 with paletted PNG was a good idea. And that's why...[[BR]]
Initially (one month ago) I tried to render my colour PNG hillshade layer with rule

 <Style name="zl04">
   <Rule>
     <RasterSymbolizer opacity="1.0" mode="multiply" scaling="fast" filter-factor="-1" /></Rule>
 </Style>

but got a black and white image of the hillshade. Then I've changed scaling to "bilinear8". That solved the problem with colour, but led to other problems described above.[[BR]]
Today I've changed scaling settings back to "fast", and now it works properly - I get colour hillshade. But with bilinear8 it still doesn't work. And, probably, it should not work. Correct me if I'm wrong.[[BR]]

So, I don't know what has changed in code in the last month, but now I can use the "fast" option with my PNGs.

Artem Pavlenko
Owner

[springmeyer] pushing to 2.0.1

Dane Springmeyer
Owner

pushing to 2.1.x

Dane Springmeyer
Owner

closing in preference of #1529

Dane Springmeyer springmeyer closed this November 07, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.