[mapserver-dev] getExpressionString issue

Jeff McKenna jmckenna at gatewaygeomatics.com
Fri Mar 25 05:51:03 PDT 2016


Hi David,

I just realized that I did recently face an odd issue on Ubuntu as well: 
I was generating a mapfile with mapscript, and everything was fine on 
Windows.  But on the client's Ubuntu server the same process was having 
problems - such as values being displayed.  This was difficult to debug. 
  The fix?  Oh boy, yikes.  Recent versions of MapServer require 
mapfiles to be in UTF-8 format.  I tested that on Ubuntu through iconv 
tools and bingo, that was indeed the problem.

If it isn't related to your case, then at least this is a good one to 
keep in mind.  It sure humbled me :)

Happy Easter to all.

-jeff

-- 
Jeff McKenna
MapServer Consulting and Training Services
http://www.gatewaygeomatics.com/



On 2016-03-24 11:56 AM, Donald wrote:
> I'm using MapServer version 6.2.0, in Ubuntu. I pasted a piece of the
> code that I'm using that is a little different from the one you
> presented but it's working for all expressions that don't have dots in
> it. Do you think that it could be a problem related to MapServer version ?
>
>
>     public static function _zoomtoclass ( $_map, $_classname ){
>
>          $class = $_map->getClassByName($_classname);
>          $layer = $class->getLayer();
>
>          if ($class->isPostgisType()){
>              $connection = $class->getConnection();
>              $metadatatable = $class->getMetadataDataTable();
>              if ($metadatatable != ''){
>                  $table = $metadatatable;
>              } else {
>                  $table = $class->getDataTable();
>              }
>              $postis_table_obj = new ngPostgisLayer($connection, $table);
>
>              $classitem = $class->getClassitem();
>
>              $expression = $class->getExpressionString();
>
>
> [...]
>
> 2016-03-24 14:06 GMT+00:00 Jeff McKenna <jmckenna at gatewaygeomatics.com
> <mailto:jmckenna at gatewaygeomatics.com>>:
>
>     Hi David,
>
>     I have tested this locally using a string field that has values of
>     "0.5 - 1.0" the same as yours, and have setup a mapfile layer with
>     an expression of: EXPRESSION "0.5 - 1.0"  I am able to correctly
>     echo that expression through PHPmapscript's getExpressionString()
>     such as:
>
>        // open existing mapfile
>        $oMap = ms_newMapObj("./getexpression.map");
>        //get layer
>        $oLayer = $oMap->getLayerByName("test");
>        //get class
>        $oClass = $oLayer->getClass(0);
>        //get expression
>        $expression =  $oClass->getExpressionString();
>
>        echo $expression;
>
>
>     I am testing with MS4W 3.1.3 (MapServer 7.0.1).
>
>     -jeff
>
>
>     --
>     Jeff McKenna
>     MapServer Consulting and Training Services
>     http://www.gatewaygeomatics.com/
>
>
>
>     On 2016-03-24 8:23 AM, Donald wrote:
>
>         Hello everyone,
>
>         I have a mapfile with the folowing setup.
>
>         CLASS
>                 NAME "a7127d96d561327f30ee0e4d3d3bb43e"
>                 EXPRESSION ('[reu]' = '0.5 - 1.0')
>                 STYLE
>                   COLOR 76 179 42
>                   OUTLINECOLOR 76 179 42
>                   SIZE 3
>                 END # STYLE
>                 TITLE "1525c/62c//0.5 - 1.0"
>         END # CLASS
>
>            Whenever I call the method
>         /$class->getExpressionString() /I get a string "05 - 10" instead
>         of "0.5
>         - 1.0". What should I do to solve this issue ?
>
>         Thanks,
>
>         David
>         /
>         /
>
>



More information about the mapserver-dev mailing list