[Cartoweb-users] Solution: colors (value ranges) in legend do not correspond to colors (value ranges) in map

Stefan Neumeier stefan.neumeier at vti.bund.de
Wed Aug 17 04:02:09 EST 2011

Dear all,

finally I found how to alter the code to get rid of the error (It 
might not be the most elegant way but it works).

The problem was that in the mapfile I joined a geometry table with an 
attribute table to create the geostat layer. But as the attribute table 
contained several entries for every region in the geometry table 
cartoweb created a map with geometries x entries in attributes  table 
whereas the single regions seemed to overlap each other so that only the 
top most regions are visible (causing the impression of wrong classified 
regions). So not only the regions
containing the data from the year and measurement of interest but all 
regions got classified and depicted as overlapping polygons...

As for me it was not feasible to alter the database connection or table 
structure (this would have meant heavy programming in order to get all 
my other adaptions to work with the new structure etc.) I solved the 
problem by altering the code in the serverGeostat.php -> function 
by inserting following 'code' below the $msLayer = line:

1) Retrieve the data expression of the original geostat layer


2) Modification of the data expression by inserting a where clause
    selecting only the year (and measurement) of interest

3) Altering the Overlay Layer accordingly:

  $la = new LayerOverlay();
  $la-> name = <my geostat layer name>;
  $la->data -> $NewRequest;

4) Update the map:



More information about the Cartoweb-users mailing list