Problems with Java Mapscript

Umberto Nicoletti umberto.nicoletti at GMAIL.COM
Mon Nov 19 06:06:19 EST 2007


Try to change the imagetype to png:

IMAGETYPE png

and please send txt/plain only emails to this list.

Umberto

On Nov 19, 2007 11:50 AM, Luis Conti <conti_lui at gva.es> wrote:
> Sorry, my last message don't see correctly.
>
>
>
> Hello:
>
> I'm new using Java Mapscript but I can't execute the examples (
> DrawMap.java) with my testmap.map.
>
> This is my system.
>
> Linux OpenSuse 10.2
> mapserv -v results
> MapServer version 4.8.4 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP
> OUTPUT=PDF OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER
> SUPPORTS=WMS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=THREADS SUPPORTS=GEOS
> INPUT=EPPL7 INPUT=POSTGIS INPUT=GDAL INPUT=SHAPEFILE
>
> Java -v results
> java version "1.5.0_08"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_08-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_08-b03, mixed mode, sharing)
>
> the Java IDE is netbeans 5.5.1
>
> This is my testmap file:
>
>
> MAP
> NAME servidor
> EXTENT 626680 4191039 817176 4519393
>  SYMBOLSET "etc/symbol.sym"
> FONTSET "etc/fonts.txt"
>  IMAGECOLOR 255 153 255
> IMAGETYPE jpeg
>  RESOLUTION 96
>
>
>
> WEB
>     IMAGEPATH "/var/www/tmp"
>     IMAGEURL "/tmp"
>      METADATA
>         "wms_title" "servidor wms icv"
>              "wms_online_resource"
> "******************************************"
>              "wms_srs" "EPSG:23030 EPSG:25830 EPSG:4230 EPSG:4258"
>
>      END
> END
>
> REFERENCE
>      EXTENT 626690 4186545 823410 4519390
>     IMAGE "./key_map.png"
>      SIZE 150 200
>     STATUS ON
>      COLOR -1 -1 -1
>     OUTLINECOLOR 255 0 0
>  END
>
> PROJECTION
>     "init=epsg:23030"
>  END
>
> OUTPUTFORMAT
>     NAME jpeg
>    DRIVER "GD/JPEG"
>     MIMETYPE "image/jpeg"
>    IMAGEMODE RGB
>    EXTENSION "jpg"
>     FORMATOPTION "QUALITY=100"
> END
>
>  OUTPUTFORMAT
>    NAME png
>     DRIVER "GD/PNG"
>    MIMETYPE "image/png"
>    IMAGEMODE RGBA
>     EXTENSION "png"
>    TRANSPARENT ON
>     FORMATOPTION "INTERLACE=ON"
> END
>
>  OUTPUTFORMAT
>    NAME gif
>     DRIVER "GD/gif"
>    MIMETYPE "image/gif"
>    IMAGEMODE PC256
>     EXTENSION "gif"
>    TRANSPARENT ON
>     FORMATOPTION "INTERLACE=ON"
> END
>
>  LAYER
>     NAME "rios_principales_1000"
>      GROUP "Hidrografía"
>     CONNECTION "host=****** port=****** dbname=capas user=*******
> password=******"
>     CONNECTIONTYPE Postgis
>      DATA "the_geom from rios_principales_1000"
>     TYPE LINE
>      METADATA
>         "wms_name" "rios_principales_1000"
>         "wms_group_title" "Hidrografía"
>      END
>     CLASS
>          NAME "riosPpal1000"
>         TITLE ""
>         SIZE 4
>          COLOR 0 112 255
>             LABEL
>              ANGLE AUTO
>             MINDISTANCE 1500
>              COLOR 190 232 255
>             OUTLINECOLOR 0 112 255
>              SIZE 8
>             TYPE  truetype
>              FONT "fritqat-italic"
>             POSITION auto
>         END
>      END
>     STATUS ON
>  END
>
> END
>
> The same testmap.map works fine with php_mapscript.
>
> When execute the DrawMap.java example crash in the line (43)
>
>  imageObj img = map.draw();
>
> This is the error:
>
>  Exception in thread "main" java.lang.UnknownError: Unable to initialize
> image.
>         at edu.umn.gis.mapscript.mapscriptJNI.mapObj_draw (Native Method)
>         at edu.umn.gis.mapscript.mapObj.draw(mapObj.java:382)
>          at es.gva.icv.jmapscript.DrawMap.main(DrawMap.java:43)
>
> I have searched about this error in internet, but I have found nothing.
>
> Thanks in advance.
> Luis Conti
>



More information about the mapserver-users mailing list