forked from MapServer/MapServer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDrawMap.java
More file actions
39 lines (34 loc) · 1.16 KB
/
DrawMap.java
File metadata and controls
39 lines (34 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import edu.umn.gis.mapscript.*;
/**
* <p>Title: Mapscript shape dump example.</p>
* <p>Description: A Java based mapscript example to create an image given a mapfile.</p>
* @author Yew K Choo ykchoo@geozervice.com
* @version 1.0
*/
public class DrawMap {
public static void usage() {
System.err.println("Usage: DrawMap {mapfile} {outfile}");
System.exit(-1);
}
public static void main(String[] args) {
if (args.length != 2) usage();
mapObj map = new mapObj(args[0]);
//map.getImagecolor().setRGB(153, 153, 204);
//styleObj st = map.getLayer(1).getClass(0).getStyle(0);
//st.getColor().setHex("#000000");
if( map.getLayer(1).getMetaData("hidden") != null ) {
System.out.println("Layer 1 is hidden? "+map.getLayer(1).getMetaData("hidden"));
}
int i=0;
//for (i=0; i<100; i++) {
imageObj img = map.draw();
System.out.println("Image size is: "+img.getSize());
System.out.println("Image size from getBytes is: "+img.getBytes().length);
System.out.println(i+") the map will be drawn to:"+args[1]);
img.save(args[1], map);
//}
img.delete();
map.delete();
//mapscript.msCleanup();
}
}