Ruby mapscript oddness
The Cunctator
cunctator at GMAIL.COM
Fri Nov 17 13:28:44 PST 2006
Here.... ruby chokes on the EXPRESSION. (For example, EXPRESSION (25>0)
works.)
MAP
NAME "Election Results"
STATUS ON
EXTENT -2450520 -1730156 2332934 1953725
SIZE 600 450
SHAPEPATH "./data"
SYMBOLSET "./etc/symbols.sym"
FONTSET "./etc/fonts.txt"
IMAGETYPE PNG
IMAGECOLOR 255 255 255
UNITS METERS
#
# Start of OutputFormat object
#
OUTPUTFORMAT
NAME "png"
MIMETYPE "image/png"
DRIVER "GD/PNG"
EXTENSION "png"
IMAGEMODE PC256
TRANSPARENT FALSE
END
#
# Start of layer definitions
#
LAYER
NAME "House of Representatives"
GROUP "House of Representatives"
STATUS ON
DATA "the_geom FROM (SELECT state, seatnumber, gid, the_geom,
round(cast(dempct*100 as numeric),2) as dempct
from cds
) a using unique gid using srid=-1"
TYPE POLYGON
CONNECTIONTYPE POSTGIS
CONNECTION "user=user dbname=cd host=host"
UNITS METERS
LABELITEM "seatnumber"
LABELMAXSCALE 4000000
TEMPLATE "newtemplate.html"
CLASSITEM "dempct"
CLASS
NAME "Democrat"
EXPRESSION ([dempct] > 25)
STYLE
SYMBOL 11
COLOR 0 0 255
OUTLINECOLOR 0 0 0
SIZE 1
END
END
CLASS
STYLE
SYMBOL 7
COLOR 0 0 0
OUTLINECOLOR 0 0 0
SIZE 1
END
END
END
END
On 11/17/06, Steve Lime <Steve.Lime at dnr.state.mn.us> wrote:
>
> The mapfile would help...
>
> >>> The Cunctator <cunctator at GMAIL.COM> 11/17/2006 1:09:48 PM >>>
> I'm happy to give settings/sample files etc but maybe someone has some
> idea
> what my problem is -- I'm guessing it has to do with the installation.
>
> The following script:
>
> #!/usr/bin/env ruby
>
> require "mapscript"
> include Mapscript
>
> map=MapObj.new("test.map")
> image = map.draw
> image.save('test.png')
>
> fails:
>
> in `draw': msEvalExpresssion: Expression parser error. Failed to parse
> expression;msyyparse(): Expression parser error. syntax
> error;msEvalExpression: Expression parser error. Failed to parse
> expression;msyyparse():
> ...
>
> etc.
>
> whereas the php script
>
> <?php
> if(!extension_loaded("MapScript")) {
> dl('php_mapscript.'.PHP_SHLIB_SUFFIX);
> }
>
> $map = ms_newMapObj("test.map");
>
> $image = $map->draw();
> $image->saveImage('test.png');
>
> ?>
>
> works fine.
>
> map.drawLegend
> and
> map.drawScalebar
> work fine.
>
> Anyone have thoughts or what information would people need to
> diagnose?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20061117/f2706949/attachment.htm>
More information about the MapServer-users
mailing list