[mapserver-users] Label attribute bindings

Tim Urwin t.urwin at ed.ac.uk
Thu Jun 5 10:22:42 EDT 2008


Hi Steve,

Unfortunatly not, it is a single digit 1-9 in an attribute field which 
we mapped to the two letter characters used by mapserver for text 
position, eg ll cc etc. We would just like to be able to look this up 
for each feature rather than apply a blanket approach for the layer. We 
would prefer not to edit the data as it changes get updated on a regular 
basis (we get updates every 6 to 8 weeks from ordnance suervey) and the 
database table has just under 22 and a half million entries.

Thanks

Tim

Stephen Woodbridge wrote:
> Tim,
>
> When you say "OS has determined the best position for the label", what 
> form is this attribute in? Is the x-y position attribute columns? or 
> some offset x-y attribute? or what?
>
> If it is an x-y position that you would rather use that the default 
> the_geom geometry position of the feature then it would probably be 
> possible to create a view that makes that x-y appear as 
> setsrid(makepoint(x_col,y_col),27700) as the_geom in the view and then 
> add a record to the geometry_columns table for this view. for 
> performance you might want to add this column to the orginal table and 
> index it.
>
> Then you should be able to renter the annotation using the view or the 
> alternate column in the table.
>
> -Steve W
>
> Tim Urwin wrote:
>> Hi all,
>>
>> This is a questuion about label attribute bindings.
>>
>> We are about to migrate some of our Ordnance Survey MasterMap data 
>> from a propriety system to using mapserver serving the data from a 
>> PostGIS database for screen maps. We are currently using Mapserver 
>> 5.02 and are very happy with the results we have achieved so far, 
>> however, due to only being able to set a single value for the 
>> position of a label has caused much of the text to be badly 
>> misaligned with the underlying features.
>>
>> OS has determined the best position for the label and provide this as 
>> attribute data for each text label point and we would like to be able 
>> to utilise it. Is there anyway to make the position label attribute 
>> accept a binding as some of the other values do, e.g. angle which we 
>> also use. The problem we have is that no single value works with the 
>> data to provide a good map result, therefore we would like to be able 
>> to use each feature's value as opposed to a global value.
>>
>> Any help or insights in how to achieve this will be gratefully 
>> received. At the moment our applications access Mapserver via CGI 
>> mode directly without the use of mapscript although we could 
>> investigate that option.
>>
>> The following is an example of one of the entries in the mapfile for 
>> a label layer.
>>
>> LAYER
>>
>>   NAME "Heritage labels"
>>
>>   METADATA
>>      "wms_title" "Heritage labels"
>>      "wms_srs"   "EPSG:27700"
>>      "wms_extent"   "0.0 0.0 700000.0 1300000.0"
>>   END
>>
>>   STATUS OFF
>>
>>   CONNECTIONTYPE postgis
>>   CONNECTION "user=XXXX password=XXXX dbname=XXXX host=XXXX port=XXXX"
>>   DATA '"anchorpoint" from "cartographictext" using unique "fid" 
>> using SRID=27700'
>>
>>   PROCESSING    "CLOSE_CONNECTION=DEFER"
>>
>>   TYPE Annotation
>>
>>   LABELITEM 'textstring'
>>
>>   FILTER ("layer" = '59')
>>
>>   CLASS
>>      NAME 'Antiquity Text (82)'
>>         LABEL
>>           COLOR     0 0 0
>>           OUTLINECOLOR 255 255 255
>>           TYPE      TRUETYPE
>>           FONT      arial-italic
>>           SIZE      8
>>           ANGLE  [angle]
>>           ANTIALIAS TRUE
>>           POSITION  CC
>>           PARTIALS  TRUE
>>           ENCODING 'UTF-8'
>>         END
>>   END
>>
>>   MINSCALEDENOM 100.0
>>   MAXSCALEDENOM 5500.0
>>
>>   PROJECTION
>>   "init=epsg:27700"
>>   END
>> END
>>
>>
>> many thanks
>>
>> Tim
>>
>
>
>


-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



More information about the mapserver-users mailing list