Mapnik producing incorrect image.

View: New views
2 Messages — Rating Filter:   Alert me  

Mapnik producing incorrect image.

by James McManus :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi - I'm using Mapnik to produce choropleth maps.  I find that in some cases Mapnik produces images that are incorrect, relative to the actual data values. I've attached an image showing one of these errors.  I've also attached the mapfile used to create it.  I added an arrow, pointing to one of the census tracts that is colored incorrectly.  The data value for this tract is 790145.32, so its color should be the darkest hue of red.  There are other tracts in the same image, such as the one below it, that have values over 700000 and correctly have dark red hue.  I've produced maps from other columns in the same postgreSQL table, one with similar large (F6.2) numbers and one with smaller (F3.2) numbers.  The map produced using the larger numbers have some tracts that are incorrect, while the census tracts are all correct for the map produced from smaller numbers .  I've checked this many ways and come out with the same results.  This makes me think that Mapnik, may be having problems with the larger numbers, in the XML file.  Is anybody aware of similar problems? Should I represent the numbers in the XML file, in a different form?

Thanks
Jim


<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Map>
<Map srs="+init=epsg:2264" buffer_size="128">

 <Style name="ctavgrtaxval0906_style">
  <Rule>
   <Filter>[avg_r_tax_val_0906] <= 100000.00</Filter>
   <MinScaleDenominator>800000</MinScaleDenominator>
   <PolygonSymbolizer>
    <CssParameter name="fill">#FFE5E5</CssParameter>
    <CssParameter name="fill-opacity">0.5</CssParameter>
   </PolygonSymbolizer>
   <LineSymbolizer>
    <CssParameter name="stroke">#000000</CssParameter>
    <CssParameter name="stroke-width">0.5</CssParameter>
   </LineSymbolizer>
  </Rule>
  <Rule>
   <Filter>[avg_r_tax_val_0906] > 100000.00 and [avg_r_tax_val_0906] <= 200000.00</Filter>
   <MinScaleDenominator>800000</MinScaleDenominator>
   <PolygonSymbolizer>
    <CssParameter name="fill">#FF9999</CssParameter>
    <CssParameter name="fill-opacity">0.5</CssParameter>
   </PolygonSymbolizer>
   <LineSymbolizer>
    <CssParameter name="stroke">#000000</CssParameter>
    <CssParameter name="stroke-width">0.5</CssParameter>
   </LineSymbolizer>
  </Rule>
  <Rule>
   <Filter>[avg_r_tax_val_0906] > 200000.00 and [avg_r_tax_val_0906] <= 350000.00</Filter>
   <MinScaleDenominator>800000</MinScaleDenominator>
   <PolygonSymbolizer>
    <CssParameter name="fill">#FF4D4D</CssParameter>
    <CssParameter name="fill-opacity">0.5</CssParameter>
   </PolygonSymbolizer>
   <LineSymbolizer>
    <CssParameter name="stroke">#000000</CssParameter>
    <CssParameter name="stroke-width">0.5</CssParameter>
   </LineSymbolizer>
  </Rule>
  <Rule>
   <Filter>[avg_r_tax_val_0906] > 350000.00 and [avg_r_tax_val_0906] <= 500000.00</Filter>
   <MinScaleDenominator>800000</MinScaleDenominator>
   <PolygonSymbolizer>
    <CssParameter name="fill">#FF0000</CssParameter>
    <CssParameter name="fill-opacity">0.5</CssParameter>
   </PolygonSymbolizer>
   <LineSymbolizer>
    <CssParameter name="stroke">#000000</CssParameter>
    <CssParameter name="stroke-width">0.5</CssParameter>
   </LineSymbolizer>
  </Rule>
  <Rule>
   <Filter>[avg_r_tax_val_0906] > 500000.00 and [avg_r_tax_val_0906] <= 700000.00</Filter>
   <MinScaleDenominator>800000</MinScaleDenominator>
   <PolygonSymbolizer>
    <CssParameter name="fill">#B30000</CssParameter>
    <CssParameter name="fill-opacity">0.5</CssParameter>
   </PolygonSymbolizer>
   <LineSymbolizer>
    <CssParameter name="stroke">#000000</CssParameter>
    <CssParameter name="stroke-width">0.5</CssParameter>
   </LineSymbolizer>
  </Rule>
  <Rule>
   <Filter>[avg_r_tax_val_0906] > 700000.00</Filter>
   <MinScaleDenominator>800000</MinScaleDenominator>
   <PolygonSymbolizer>
    <CssParameter name="fill">#660000</CssParameter>
    <CssParameter name="fill-opacity">0.5</CssParameter>
   </PolygonSymbolizer>
   <LineSymbolizer>
    <CssParameter name="stroke">#000000</CssParameter>
    <CssParameter name="stroke-width">0.5</CssParameter>
   </LineSymbolizer>
  </Rule>
 </Style>

 <Layer name="ctavgrtaxval0906" srs="+init=epsg:2264" status="on" clear_label_cache="off">
  <StyleName>ctavgrtaxval0906_style</StyleName>
  <Datasource>
   <Parameter name="type">postgis</Parameter>
   <Parameter name="host">localhost</Parameter>
   <Parameter name="dbname">wake</Parameter>
   <Parameter name="user">apache</Parameter>      
   <Parameter name="table">(select ST_Buffer(the_geom, 2) as the_geom,
                            avg_r_tax_val_0906 from censustracts2000
                            where avg_r_tax_val_0906 is not null
                            order by stfid) as ctavgrtaxval0906</Parameter>
   <Parameter name="estimate_extent">false</Parameter>
   <Parameter name="extent">1947126.12, 596061.63, 2258533.48, 891583.72</Parameter>
  </Datasource>
 </Layer>
 
</Map>

_______________________________________________
Mapnik-users mailing list
Mapnik-users@...
https://lists.berlios.de/mailman/listinfo/mapnik-users

test1.png (98K) Download Attachment

Re: Mapnik producing incorrect image.

by Dane Springmeyer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

James,

Thanks for digging into this so thoroughly and thanks to Jon for  
finding and fixing the bug.

Cheers to you guys!

Dane


On Sep 9, 2009, at 2:24 PM, James McManus wrote:

> Hi - I'm using Mapnik to produce choropleth maps.  I find that in  
> some cases Mapnik produces images that are incorrect, relative to  
> the actual data values. I've attached an image showing one of these  
> errors.  I've also attached the mapfile used to create it.  I added  
> an arrow, pointing to one of the census tracts that is colored  
> incorrectly.  The data value for this tract is 790145.32, so its  
> color should be the darkest hue of red.  There are other tracts in  
> the same image, such as the one below it, that have values over  
> 700000 and correctly have dark red hue.  I've produced maps from  
> other columns in the same postgreSQL table, one with similar large  
> (F6.2) numbers and one with smaller (F3.2) numbers.  The map  
> produced using the larger numbers have some tracts that are  
> incorrect, while the census tracts are all correct for the map  
> produced from smaller numbers .  I've checked this many ways and  
> come out with the same results.  This makes me think that Mapnik,  
> may be having problems with the larger numbers, in the XML file.  Is  
> anybody aware of similar problems? Should I represent the numbers in  
> the XML file, in a different form?
>
> Thanks
> Jim
> <test1.png><test.xml>_______________________________________________
> Mapnik-users mailing list
> Mapnik-users@...
> https://lists.berlios.de/mailman/listinfo/mapnik-users

_______________________________________________
Mapnik-users mailing list
Mapnik-users@...
https://lists.berlios.de/mailman/listinfo/mapnik-users