[mapserver-users] MapServer + Weather Data

Jan Hartmann jhart at frw.uva.nl
Mon Nov 18 07:03:46 EST 2002


Daryl,

I have been plotting TrueType symbols in two ways: MapServer only and 
MapServer/PostGIS. Perhaps people know better solutions; if so let me know.


-----------------> MapServer only: <--------------------

1) Define your symbols in a separate symbol file:

symbol
   name 'wind1'
   type truetype
   font 'Esri_Weather'
   character "&#98"        # symbol number in character map
end

symbol
   name 'wind2'
   type truetype
   font 'Esri_Weather'
   character ""=&#99"
end

and so on for all the symbols you need

2) In the main section of your MapFile, indicate where your fonts and 
symbols live:

FONTSET "<path to fontset file>"
# see: http://mapserver.gis.umn.edu/doc36/fontset.html
SYMBOLSET "<path to the symbol file you made before>"

3) Create an annotation layer in your MapFile and create classes for 
each wind speed you want to have mapped:

class
   expression "([wind_speed] = 1)"
   symbol "wind1"
   size ...
   color ...
end
class
   expression "([wind_speed] = 2)"
   symbol "wind2"
   size ...
   color ...
end
...
and so on

-------------------> MapServer/PostGIS <---------------------------

1) In your PostGIS DATA statement, create a subselect to convert wind 
speeds to the character-numbers of the Esri_Weather font symbols you 
want to use:

select the_geom from
    (select oid
            case when wind_speed = 1 then chr(98)
                 when wind_speed = 2 then chr(99)
                 ...
            end as wind_speed_symbol
      from wind_table
     ) as foo

2) Create an annotation layer in your MapFile with just one class:

layer
    LabelItem wind_speed_symbol
    class
       label
          type truetype
          font Esri_Weather
          size ...
          color ...
       end
    end
end


As Paul says, you can just add a field like wind_direction in the DATA 
select and use LABELANGLEITEM to orientate the symbol.

Regards,

Jan Hartmann


> Daryl Herzmann wrote:
> 
>> Hi,
>>   Back in August, I posted a question about getting weather data into 
>> mapserver, in particular, wind barbs. 
>> http://mapserver.gis.umn.edu/wilma/mapserver-users/0208/msg00335.html
>>
>> I finally poked around with this task this evening and am horribly 
>> stuck :)
>>
>>   I have attached the ESRI Weather font output, which is what I assume 
>> I should be using to build wind barbs?  So I query my wind speeds out 
>> of the PostGIS database which is an attribute and am able to use the 
>> "weather" font to label the data points, but the symbols are wrong for 
>> the values.
>>
>>   So my question is how to associate the integer value of wind speed 
>> in knots with the font? 
>>   (hehe, then my next question is how to include visibility too, since 
>> this font file has that capability.)
>>
>> Thanks,
>>   Daryl
>>
>>
>> ------------------------------------------------------------------------
>>
> 
> 
> 

Jan Hartmann
Department of Geography
University of Amsterdam
jhart at frw.uva.nl




More information about the mapserver-users mailing list