[Mapserver-users] Clueless newbie question

Jim Buzbee James.P.Buzbee at lmco.com
Thu Jan 8 15:58:25 EST 2004


Frank Warmerdam wrote:

> Jim Buzbee wrote:
> 
>>
>> I've been working on a quick proof-of-concept using mapserver and 
>> don't understand the process of creating a map file for some data I 
>> acquired.
>>
>

...

> 
> Jim,
> 
> This is an arc/info binary grid coverage.  You can use it directly
> in MapServer if you have GDAL support built-in, or use GDAL to convert it
> to other formats.
> 
>   http://www.remotesensing.org/gdal/frmt_various.html#AIG
> 
> Good luck,
> 

Thanks to everyone who pointed my to GDAL.  I've been experimenting with 
  it but have first taken a step back to see if I can just display a 
simple raster image.

I created a minimal map file like so :

NAME DEMO
STATUS ON
SIZE 600 600
EXTENT 388107.634400379 5203120.88405952 500896.339019834 5310243.30613897
UNITS METERS
SHAPEPATH "data"

LAYER
   NAME "raster"
   DATA "demo.jpg"
   TYPE RASTER
   STATUS ON
END

END

Where demo.jpg is a 600x600 grayscale jpeg image in my data directory. I 
then created a demo.wld file in the data directory like so :

2
0.0000000000
0.0000000000
-2
388107.634400379
5203120.88405952


I wrote a little Java program :


import java.io.*;
import edu.umn.gis.mapscript.*;

public class Test
{
    public static void main(String[] args) throws IOException
    {
       mapObj  map;
       imageObj image;

       System.loadLibrary("mapscript");

       map = new mapObj(args[0]);

       if ( map == null )
       {
          System.out.println("Could not create Map Object " + args[0] );
          System.exit(2);
       }

       image = map.draw();

       if ( image != null )
       {
          image.save("demo.png");
       }
       else
       {
          System.out.println("Error creating map using \"" + args[0] +"\"");
          System.exit(1);
       }
    }
}


Mapserver reports the following capabilities :

mapserv -v MapServer version 4.0.1 OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP 
SUPPORTS=FREETYPE INPUT=EPPL7 INPUT=JPEG INPUT=SHAPEFILE


The java program works fine using the map file from the ms_demo included 
in the 4.0.1 distribution. Using my map file, the program runs 
successfully but I just end up with a 600x600 solid white demo.png file.

I suspect the problem may be that the registration is off because I just 
copied the values from the demo data (without really understanding them...).

Any assistance is appreciated.

Jim Buzbee






More information about the mapserver-users mailing list