Hi Benjamin,
You probably have to update the openmap.properties file so the layers
you want to have in the image are defined.
The ImageServer class can be run directly. You might want to look at
the main() function, it does pretty much what you are trying to do in
your code, but it's using the projection parameters defined in the
openmap.properties file instead of defining them in the code.
- Don
On Tuesday, August 12, 2003, at 04:25 PM, Benjamin.May@bookspan.com
wrote:
>
> Okay, I found the http://openmap.bbn.com/data/ folder, downloaded
> everything in there and put it into my openmap-4.5.4 directory under
> data. I
> even uncompressed and untar'd everything. I am still not seeing
> anything in
> my images tho. :( Is there something I need to do to make openmap be
> aware
> that this data is present? My current directory structure is:
>
> $home/openmap-4.5.4/data
> $home/openmap-4.5.4/data/etopo
> $home/openmap-4.5.4/data/icons
> $home/openmap-4.5.4/data/shape
> $home/openmap-4.5.4/data/citiesx020.csv
> $home/openmap-4.5.4/data/citiesx020.csv.gz
> $home/openmap-4.5.4/data/nexrad_1008199902.txt
>
> With the shape folder containing most of the files...
>
> Also, here is my code:
>
>
> import java.util.*;
> import java.io.*;
> import com.bbn.openmap.image.*;
> import com.bbn.openmap.proj.*;
>
> public class Test{
>
> Properties P;
>
> public Properties getMapProperties(){
> if (P == null){
> try{
> FileInputStream s = new
> FileInputStream("openmap.properties");
> P = new Properties();
> P.load(s);
> }catch(Exception e){
> e.printStackTrace();
> System.exit(0);
> }
> }
>
> return P;
> }
>
> public static void main(String argv[]) throws Exception{
> Date start = new Date();
> Test t = new Test();
> byte [] outfile = t.getMapAsJPEG();
> FileOutputStream out = new FileOutputStream("test.jpg");
> out.write(outfile);
> out.close();
> Date end = new Date();
> long timediff = (end.getTime() - start.getTime()) ;
> System.out.println("Runtime : " + timediff + " milliseconds ");
> }
>
> public com.bbn.openmap.proj.Projection getMapProjection(){
> int width = 640, height = 480;
> float longitude = 40.47f;
> float latitude = -100f;
>
> //float longitude = 45.0f;
> //float latitude = -90.0f;
> int scale = 50000000000;
>
> System.out.println(ProjectionFactory.getProjType(Mercator.MercatorName)
> );
> Projection proj =
>
> ProjectionFactory.makeProjection(ProjectionFactory.getProjType(Mercator
> .Merc
> atorName),
> latitude,
> longitude,
> scale,
> width,
> height
> );
> System.out.println(proj);
> return proj;
>
> }
>
> public byte [] getMapAsJPEG()
> throws Exception
> {
>
> Properties props = getMapProperties();
>
> ImageServer imageServer = new ImageServer("mapDemo", props);
>
> com.bbn.openmap.image.SunJPEGFormatter formatter = new
> com.bbn.openmap.image.SunJPEGFormatter();
> formatter.setImageQuality(1.0f);
> imageServer.setFormatter(formatter);
> byte [] imageBytes = imageServer.createImage(getMapProjection());
> return imageBytes;
> }
>
> }
> Thanks!
> --
> [To unsubscribe to this list send an email to "majdart@bbn.com"
> with the following text in the BODY of the message "unsubscribe
> openmap-users"]
>
>
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, BBN Technologies, dietrick@bbn.com
10 Moulton Street, Cambridge, MA 02138
617-873-3031 [fax]-2794
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-- [To unsubscribe to this list send an email to "majdart@bbn.com" with the following text in the BODY of the message "unsubscribe openmap-users"]Received on Tue Aug 12 18:08:05 2003
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:36 EDT