Adding International character support for layer names

From Ka-Map Wiki

Jump to: navigation, search

Posted on ka-Map mailing list by XiongJing.


Hi~ Few days ago I asked whether the groupname could be in Chinese. And I find it does. http://www.webmap.cn/basicmap/index.php is a good example. Here is the way to solve the problem, and I believe it also useful in other languages:

(1) add a metadata which called "group_title" in each group in .map file
   e.g:   LAYER
           NAME "Province"
           GROUP "Province"    (groupname in English)
           STATUS DEFAULT
           DATA ...
           TYPE POLYGON
           METADATA
             "OPACITY"    "50"
             "group_title"  "Chinese name"  *   (in Chinese)
           END
            ...
(2) in kamap.js file
    add a "title" attribute in  "layer" object:
       function _layer( szName, bVisible, opacity, szTitle,imageformat, bQueryable , scales)
        {     ...                                
            this.title = szTitle;                
              ...}
(3) add the "title" attribute like (2) in all files that have the "layer" object,which include "wmsLayer.js" and "init.php".
       Here we should notice the order of parameter  which we add.
       And in init.php file: we should add : $title = $oLayer -> getMatadata('group_title'); in 3 places.
(4)in kaLegend.js file 
   NO.421 row: td.innerHTML = name; which is to display the groupname.
   We set : td.innerHTML = oLayer.title;

¡¡¡¡¡¡ I tried the method¡¡and it really works. The method is provided bg ZHOU,Xu who from National Geomatics Center of China . Thanks very much .¡¡¡¡¡¡¡¡

Personal tools