MapScript projection error - CGI works fine
Pascal Ehlert
dadark at DADARK.DE
Tue Jun 12 04:29:53 PDT 2007
Hi Mapserver Community!
This is my first post here, I hope the project is still active.
I've just been trying to migrate my MapServer stuff from the CGI version to
the Ruby MapScript version
for better integration with my Rails (for those of you who don't know, it's
a Ruby web framework) application.
Now, while CGI is working fine, the MapScript refuses to work at all,
because of a projection error.
This really confuses me, I'm using exactly the same mapfile for both of them.
This is what I do in Ruby and the error I get:
--
irb(main):001:0> require "mapscript"
=> true
irb(main):002:0> include Mapscript
=> Object
irb(main):003:0> map = MapObj.new("/var/www/map/moz_serv/moz.map")
RuntimeError: loadProjection(): Projection library error. Projection support
is not available.
--
And here comes my mapfile.. I know it's not perfect and actually it wasn't
even me who created it, but at least it works with CGI.
--
CONFIG PROJ_LIB /usr/share/proj/
FONTSET /var/www/odamap/fontset
PROJECTION
"init=epsg:4306"
END
MAP
#UNITS METERS
NAME "Mozambique"
STATUS ON
# SHAPEPATH "./shape"
EXTENT 24.5969016666667 -26.86644 46.4558883333333 -10.4722 SIZE 800 650
IMAGECOLOR 255 255 255
WEB
IMAGEPATH "/var/www/odamap/tmp/"
IMAGEURL "/tmp/"
TEMPLATE "global1.phtml"
END
REFERENCE
STATUS ON
IMAGE "./reference/reference.gif"
SIZE 160 112 #Farbe f�r die Umrandung (hier blau)
EXTENT 24.5969016666667 -26.86644 46.4558883333333 -10.4722 COLOR -1 -1 -1
#F�llfarbe f�r die Referenzkarte (-1 stellt die Farbe aus)
OUTLINECOLOR 0 0 255
END
QUERYMAP
STATUS ON
#SIZE -1 -1 #SIZE 600 500 #Die Kartengr��e eingeben
STYLE HILITE
COLOR 0 0 250
END
# LEGEND
# STATUS EMBED
# TRANSPARENT TRUE
# POSITION LR
# END
SCALEBAR
STATUS ON
TRANSPARENT ON
UNITS kilometers
INTERVALS 5
STYLE 1
LABEL
SIZE small
COLOR 0 0 0
END
END
OUTPUTFORMAT
NAME "png"
MIMETYPE "image/png"
DRIVER "GD/PNG"
EXTENSION "png"
IMAGEMODE RGB
TRANSPARENT OFF
END
########### REST OF AFRICA ############
LAYER
NAME "Africa"
TYPE POLYGON
STATUS DEFAULT
DATA "the_geom from africa"
LABELITEM "cntry_name"
CONNECTIONTYPE POSTGIS
CONNECTION "user=*** password=*** dbname=moz host=127.0.0.1 port=5432"
CLASS
STYLE
COLOR 250 250 250
OUTLINECOLOR 0 0 0
END
LABEL
TYPE truetype
COLOR 0 0 0
OUTLINECOLOR 255 255 255
SIZE 10
FONT arialbd
ANTIALIAS TRUE
MINDISTANCE 100
END
END
END
#######################################
LAYER
NAME "Province"
#STATUS DEFAULT
DATA "the_geom from moz_adm1"
TYPE POLYGON
CONNECTIONTYPE POSTGIS
CONNECTION "user=*** password=*** dbname=moz host=127.0.0.1 port=5432"
#CLASSITEM "province"
LABELITEM "adm1"
CLASS
NAME "GeoDaten_Province"
EXPRESSION ([province] in ('%province%'))
TEMPLATE "./templates/zusatzdaten.html"
LABEL
TYPE truetype
COLOR 0 0 0
OUTLINECOLOR 255 255 255
SIZE 10
FONT arialbd
MINDISTANCE 100
END
STYLE
COLOR 250 250 250
OUTLINECOLOR 0 0 0
END
END
CLASS
NAME "non Projects Province"
TEMPLATE "./templates/zusatzdaten.html"
STYLE
COLOR 250 250 100
OUTLINECOLOR 0 0 0
END
END
END
LAYER
NAME "Districts"
# DATA "the_geom from moz_adm2"
DATA "the_geom from district"
TYPE POLYGON
#STATUS DEFAULT
CONNECTIONTYPE POSTGIS
CONNECTION "user=*** password=*** dbname=moz host=127.0.0.1 port=5432"
LABELITEM "district"
#TRANSPARENCY 50
#CLASSITEM "district"
CLASS
#NAME "GeoDaten_Districts"
EXPRESSION ([district] in ('%district%'))
TEMPLATE "./templates/zusatzdaten1.html"
LABEL
TYPE truetype
COLOR 0 0 0
OUTLINECOLOR 255 255 255
SIZE 8
FONT verdana
MINDISTANCE 100
END
STYLE
COLOR 250 250 250
OUTLINECOLOR 0 0 0
END
END
CLASS
#NAME "non Projects Districts"
TEMPLATE "./templates/zusatzdaten1.html"
STYLE
COLOR 250 250 100
OUTLINECOLOR 0 0 0
END
END
END
LAYER NAME "Text1"
DATA "the_geom from moz_adm1"
CONNECTIONTYPE POSTGIS
CONNECTION "user=*** password=*** dbname=moz host=127.0.0.1 port=5432"
STATUS ON
TYPE POLYGON
LABELITEM "adm1"
MINSCALE 0
MAXSCALE 100
CLASS
LABEL
TYPE truetype
COLOR 0 0 0
OUTLINECOLOR 255 255 255
SIZE 9
FONT arialbd MINDISTANCE 100
END
END
END
LAYER NAME "Text2"
# DATA "the_geom from moz_adm3"
DATA "the_geom from district"
CONNECTIONTYPE POSTGIS
CONNECTION "user=*** password=*** dbname=moz host=127.0.0.1 port=5432"
STATUS ON
TYPE POLYGON
# LABELITEM "district"
LABELITEM "adm2"
MINSCALE 0
MAXSCALE 100
CLASS
LABEL
TYPE truetype
COLOR 0 0 0
OUTLINECOLOR 255 255 255
SIZE 8
FONT verdana MINDISTANCE 100
END
END
END
LAYER
NAME "River"
TYPE LINE
STATUS DEFAULT
DATA "the_geom from rivers"
CONNECTIONTYPE POSTGIS
CONNECTION "user=*** password=*** dbname=moz host=127.0.0.1 port=5432"
CLASS
STYLE
COLOR 0 0 250
OUTLINECOLOR 20 20 0
END
END
END
LAYER
NAME "Mayor_Cities"
TYPE POINT
STATUS DEFAULT
DATA "the_geom from mayor_cities"
CONNECTIONTYPE POSTGIS
CONNECTION "user=*** password=*** dbname=moz host=127.0.0.1 port=5432"
CLASS
STYLE
COLOR 0 0 250
OUTLINECOLOR 20 20 0
END
END
END
LAYER
NAME "Lakes"
TYPE POLYGON
STATUS DEFAULT
DATA "the_geom from lakes"
CONNECTIONTYPE POSTGIS
CONNECTION "user=*** password=*** dbname=moz host=127.0.0.1 port=5432"
CLASS
STYLE
COLOR 0 0 250
OUTLINECOLOR 20 20 0
END
END
END
LAYER
NAME "polpulated_places"
# TYPE LINE
TYPE POLYGON
STATUS DEFAULT
DATA "the_geom from populated_places"
CONNECTIONTYPE POSTGIS
CONNECTION "user=*** password=*** dbname=moz host=127.0.0.1 port=5432"
CLASS
STYLE
COLOR 0 0 250
OUTLINECOLOR 20 20 0
END
END
END
--
Many thanks in advance!
Pascal
More information about the MapServer-users
mailing list