Revision 6948 trunk/extensions/extPublish/src/org/gvsig/remoteservices/conf/mapserver/Test.java
Test.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.awt.Dimension; |
4 | 4 |
|
5 |
import org.gvsig.remoteservices.conf.mapserver.ToMap.RGB; |
|
6 | 5 |
|
7 | 6 |
|
8 |
|
|
9 | 7 |
public class Test { |
10 | 8 |
public static void main(String args[]) { |
11 | 9 |
//testShpMap(); |
... | ... | |
15 | 13 |
} |
16 | 14 |
|
17 | 15 |
static void testShpMap() { |
18 |
String mapFileName = "/etc/mapserver/wms.map"; |
|
19 |
DoMap map = new DoMap();
|
|
20 |
map.mapName= "TEST_MAPSERVER"; |
|
21 |
map.mapStatus="ON";
|
|
22 |
map.mapUnits="METERS";
|
|
16 |
String mapFileName = null; //"/etc/mapserver/wms.map";
|
|
17 |
MapServer.ConfigFile map = new MapServer.ConfigFile();
|
|
18 |
map.mapName = "TEST_MAPSERVER";
|
|
19 |
map.mapStatus = "ON";
|
|
20 |
map.mapUnits = "METERS";
|
|
23 | 21 |
map.mapShapePath = "/home/david/cv300/"; |
24 |
map.mapcrs= new ToMap.CRS("EPSG:23030",true);
|
|
22 |
map.mapcrs = new MapServer.CRS("EPSG:23030",true);
|
|
25 | 23 |
map.setExtent(638610.4375,4222780,789330,4484662.5); |
26 | 24 |
|
27 |
DoMap.WebMap web = new DoMap.WebMap();
|
|
28 |
web.imagepath="/var/tmp/";
|
|
29 |
web.imageurl="/var/tmp/";
|
|
30 |
web.metadata=new DoMap.MetadataWeb();
|
|
31 |
web.metadata.crs= new ToMap.CRS("EPSG:23030",false);
|
|
32 |
web.metadata.title="test shape";
|
|
33 |
web.metadata.onlineresource="http://localhost/mapserver/mapserv?map=/etc/mapserver/wms.map";
|
|
34 |
map.www=web;
|
|
25 |
MapServer.ConfigFile.WebMap web = new MapServer.ConfigFile.WebMap();
|
|
26 |
web.imagepath = "/var/tmp/";
|
|
27 |
web.imageurl = "/var/tmp/";
|
|
28 |
web.metadata = new MapServer.ConfigFile.MetadataWeb();
|
|
29 |
web.metadata.crs = new MapServer.CRS("EPSG:23030",false);
|
|
30 |
web.metadata.title = "test shape";
|
|
31 |
web.metadata.onlineresource = "http://localhost/mapserver/mapserv?map=/etc/mapserver/wms.map";
|
|
32 |
map.www = web;
|
|
35 | 33 |
|
36 |
DoMap.ShpLayer capa = new DoMap.ShpLayer();
|
|
37 |
DoMap.MapClass clase = new DoMap.MapClass("autopistas");
|
|
34 |
MapServer.ShpLayer capa = new MapServer.ShpLayer();
|
|
35 |
MapServer.MapClass clase = new MapServer.MapClass("autopistas");
|
|
38 | 36 |
capa.name = "autopistas"; |
39 | 37 |
capa.title = "Autopistas de la GV"; |
40 | 38 |
capa.type="LINE"; |
41 | 39 |
capa.data="autopistas"; |
42 | 40 |
capa.extent = null; |
43 | 41 |
capa.layerClass = clase; |
44 |
clase.estilo = new DoMap.StyleMap(
|
|
45 |
new RGB(120,120,120),new RGB(200,255,0));
|
|
46 |
capa.metadata=new DoMap.MetadataLayer();
|
|
42 |
clase.estilo = new MapServer.StyleMap(
|
|
43 |
new MapServer.RGB(120,120,120),new MapServer.RGB(200,255,0));
|
|
44 |
capa.metadata=new MapServer.MetadataLayer();
|
|
47 | 45 |
capa.metadata.setExtent(638610.4375,4222780,789330,4484662.5); |
48 | 46 |
capa.metadata.metalayertitle="Autopistas gv"; |
49 |
capa.layercrs= new ToMap.CRS("EPSG:23030",true);
|
|
47 |
capa.layercrs= new MapServer.CRS("EPSG:23030",true);
|
|
50 | 48 |
map.layers.add(capa); |
51 | 49 |
|
52 | 50 |
map.generate(mapFileName); |
... | ... | |
55 | 53 |
|
56 | 54 |
static void testPostGisMap(){ |
57 | 55 |
String mapFileName = "/etc/mapserver/wms.map"; |
58 |
DoMap map = new DoMap();
|
|
56 |
MapServer.ConfigFile map = new MapServer.ConfigFile();
|
|
59 | 57 |
map.mapName= "TEST_MAPSERVER_POSTGIS"; |
60 | 58 |
map.mapStatus="ON"; |
61 | 59 |
map.mapUnits="METERS"; |
62 | 60 |
map.mapShapePath = "/home/david/cv300/"; |
63 |
map.mapcrs= new ToMap.CRS("EPSG:23030",true);
|
|
61 |
map.mapcrs= new MapServer.CRS("EPSG:23030",true);
|
|
64 | 62 |
map.setExtent(638610.4375,4222780,789330,4484662.5); |
65 | 63 |
|
66 |
DoMap.WebMap web = new DoMap.WebMap();
|
|
64 |
MapServer.WebMap web = new MapServer.WebMap();
|
|
67 | 65 |
web.imagepath="/var/tmp/"; |
68 | 66 |
web.imageurl="/var/tmp/"; |
69 |
web.metadata=new DoMap.MetadataWeb();
|
|
70 |
web.metadata.crs= new ToMap.CRS("EPSG:23030",false);
|
|
67 |
web.metadata = new MapServer.MetadataWeb();
|
|
68 |
web.metadata.crs = new MapServer.CRS("EPSG:23030",false);
|
|
71 | 69 |
web.metadata.title="test shape"; |
72 | 70 |
web.metadata.onlineresource="http://localhost/mapserver/mapserv?map=/etc/mapserver/wms.map"; |
73 | 71 |
map.www=web; |
74 | 72 |
|
75 |
DoMap.PostgisLayer capa = new DoMap.PostgisLayer();
|
|
76 |
DoMap.MapClass clase = new DoMap.MapClass("autopistas");
|
|
73 |
MapServer.PostgisLayer capa = new MapServer.PostgisLayer();
|
|
74 |
MapServer.MapClass clase = new MapServer.MapClass("autopistas");
|
|
77 | 75 |
capa.name = "autopistas"; |
78 | 76 |
capa.title = "Autopistas de la GV"; |
79 | 77 |
capa.type="LINE"; |
80 | 78 |
capa.data="autopistas"; |
81 | 79 |
capa.extent = null; |
82 | 80 |
capa.layerClass = clase; |
83 |
clase.estilo = new DoMap.StyleMap(
|
|
84 |
new RGB(120,120,120),new RGB(200,255,0));
|
|
85 |
capa.metadata=new DoMap.MetadataLayer();
|
|
81 |
clase.estilo = new MapServer.StyleMap(
|
|
82 |
new MapServer.RGB(120,120,120),new MapServer.RGB(200,255,0));
|
|
83 |
capa.metadata=new MapServer.MetadataLayer();
|
|
86 | 84 |
capa.metadata.setExtent(638610.4375,4222780,789330,4484662.5); |
87 | 85 |
capa.metadata.metalayertitle="Autopistas gv"; |
88 |
capa.layercrs= new ToMap.CRS("EPSG:23030",true);
|
|
86 |
capa.layercrs= new MapServer.CRS("EPSG:23030",true);
|
|
89 | 87 |
capa.setConnParams("david", "chkdsk", "localhost", "betel", "5432"); |
90 | 88 |
capa.tabla = "autopistas"; |
91 | 89 |
capa.data = "the_geom from "+capa.tabla; |
... | ... | |
99 | 97 |
} |
100 | 98 |
|
101 | 99 |
static void testRasterMap(){ |
102 |
String mapFileName = "/etc/mapserver/wms.map"; |
|
103 |
DoMap map = new DoMap();
|
|
100 |
String mapFileName = null; //"/etc/mapserver/wms.map";
|
|
101 |
MapServer.ConfigFile map = new MapServer.ConfigFile();
|
|
104 | 102 |
map.mapName= "TEST_MAPSERVER_RASTER"; |
105 | 103 |
map.mapStatus="ON"; |
106 | 104 |
map.mapUnits="METERS"; |
107 | 105 |
map.mapShapePath = "/home/david/cv300/"; |
108 |
map.mapcrs= new ToMap.CRS("EPSG:23030",true);
|
|
106 |
map.mapcrs= new MapServer.CRS("EPSG:23030",true);
|
|
109 | 107 |
map.setExtent(395000,97000,429000,160000); |
110 | 108 |
|
111 |
DoMap.WebMap web = new DoMap.WebMap();
|
|
109 |
MapServer.WebMap web = new MapServer.WebMap();
|
|
112 | 110 |
web.imagepath="/var/tmp/"; |
113 | 111 |
web.imageurl="/var/tmp/"; |
114 |
web.metadata=new DoMap.MetadataWeb();
|
|
115 |
web.metadata.crs= new ToMap.CRS("EPSG:23030",false);
|
|
112 |
web.metadata=new MapServer.MetadataWeb();
|
|
113 |
web.metadata.crs= new MapServer.CRS("EPSG:23030",false);
|
|
116 | 114 |
web.metadata.title="test raster"; |
117 | 115 |
web.metadata.onlineresource="http://localhost/mapserver/mapserv?map=/etc/mapserver/wms.map"; |
118 | 116 |
map.www=web; |
119 | 117 |
|
120 |
DoMap.RasterLayer capa = new DoMap.RasterLayer();
|
|
121 |
DoMap.MapClass clase = new DoMap.MapClass("raster");
|
|
118 |
MapServer.RasterLayer capa = new MapServer.RasterLayer();
|
|
119 |
MapServer.MapClass clase = new MapServer.MapClass("raster");
|
|
122 | 120 |
capa.name = "raster"; |
123 | 121 |
capa.title = "raster de la GV"; |
124 | 122 |
capa.type="RASTER"; |
125 | 123 |
capa.data="foto.tif"; |
126 | 124 |
capa.extent = null; |
127 | 125 |
capa.layerClass = clase; |
128 |
clase.estilo = new DoMap.StyleMap(
|
|
129 |
new RGB(120,120,120),new RGB(200,255,0));
|
|
130 |
capa.metadata=new DoMap.MetadataLayer();
|
|
126 |
clase.estilo = new MapServer.StyleMap(
|
|
127 |
new MapServer.RGB(120,120,120),new MapServer.RGB(200,255,0));
|
|
128 |
capa.metadata=new MapServer.MetadataLayer();
|
|
131 | 129 |
capa.metadata.setExtent(395000,97000,429000,160000); |
132 | 130 |
capa.metadata.metalayertitle="raster gv"; |
133 |
capa.layercrs= new ToMap.CRS("EPSG:23030",true);
|
|
131 |
capa.layercrs= new MapServer.CRS("EPSG:23030",true);
|
|
134 | 132 |
capa.layerClass = clase; |
135 | 133 |
map.layers.add(capa); |
136 | 134 |
|
137 | 135 |
map.generate(mapFileName); |
138 |
//map.generate(); |
|
139 |
|
|
140 |
|
|
141 | 136 |
} |
142 | 137 |
|
143 | 138 |
/*public void addAutopistas(DoMap map) { |
... | ... | |
213 | 208 |
*/ |
214 | 209 |
|
215 | 210 |
public static void testWFSCanada() { |
216 |
String mapFileName = "data/wfs.map"; |
|
217 |
DoMap map = new DoMap();
|
|
211 |
String mapFileName = null; //"data/wfs.map";
|
|
212 |
MapServer.ConfigFile map = new MapServer.ConfigFile();
|
|
218 | 213 |
map.mapName = "TEST_WFS_MAPSERVER"; |
219 | 214 |
map.mapStatus = "ON"; |
220 | 215 |
map.mapUnits = "METERS"; |
221 | 216 |
map.mapShapePath = "../data"; |
222 |
map.mapcrs= new ToMap.CRS("EPSG:23030",true);
|
|
217 |
map.mapcrs= new MapServer.CRS("EPSG:23030",true);
|
|
223 | 218 |
map.symbolset = "../etc/symbols.sym"; |
224 | 219 |
map.fontset = "../etc/fonts.txt"; |
225 | 220 |
map.mapSize = new Dimension(400,300); |
226 |
map.imageColor = new ToMap.RGB(255,255,255);
|
|
221 |
map.imageColor = new MapServer.RGB(255,255,255);
|
|
227 | 222 |
map.setExtent(-2200000d,-712631d,3072800d,3840000d); |
228 | 223 |
|
229 |
DoMap.WebMap web = new DoMap.WebMap();
|
|
224 |
MapServer.WebMap web = new MapServer.WebMap();
|
|
230 | 225 |
web.imagepath = "/ms4w/tmp/ms_tmp/"; |
231 | 226 |
web.imageurl = "/ms_tmp/"; |
232 |
web.metadata = new DoMap.MetadataWeb();
|
|
227 |
web.metadata = new MapServer.MetadataWeb();
|
|
233 | 228 |
web.metadata.setServiceAsWFS(); |
234 |
web.metadata.crs = new ToMap.CRS("EPSG:42304 EPSG:42101 EPSG:4269 EPSG:4326", false);
|
|
229 |
web.metadata.crs = new MapServer.CRS("EPSG:42304 EPSG:42101 EPSG:4269 EPSG:4326", false);
|
|
235 | 230 |
web.metadata.title = "GMap WFS Demo Server"; |
236 | 231 |
web.metadata.onlineresource = "http://127.0.0.1/cgi-bin/mapserv.exe?"; |
237 | 232 |
web.metadata.ows_schemas_location = "http://ogc.dmsolutions.ca"; |
238 | 233 |
map.www=web; |
239 | 234 |
|
240 |
map.mapcrs= new ToMap.CRS("EPSG:42304",true);
|
|
235 |
map.mapcrs= new MapServer.CRS("EPSG:42304",true);
|
|
241 | 236 |
|
242 |
DoMap.ShpLayer capa = new DoMap.ShpLayer();
|
|
243 |
DoMap.MapClass clase = new DoMap.MapClass("Canada");
|
|
244 |
clase.estilo = new DoMap.StyleMap(
|
|
245 |
new RGB(120,120,120),new RGB(200,255,0));
|
|
237 |
MapServer.ShpLayer capa = new MapServer.ShpLayer();
|
|
238 |
MapServer.MapClass clase = new MapServer.MapClass("Canada");
|
|
239 |
clase.estilo = new MapServer.StyleMap(
|
|
240 |
new MapServer.RGB(120,120,120),new MapServer.RGB(200,255,0));
|
|
246 | 241 |
clase.template = "ttt_query.html"; |
247 | 242 |
capa.name = "province"; |
248 | 243 |
capa.type="POLYGON"; |
249 | 244 |
capa.data="province"; |
250 |
capa.layercrs = new ToMap.CRS("epsg:42304", true);
|
|
245 |
capa.layercrs = new MapServer.CRS("epsg:42304", true);
|
|
251 | 246 |
capa.layerClass = clase; |
252 |
capa.metadata=new DoMap.MetadataLayer();
|
|
247 |
capa.metadata=new MapServer.MetadataLayer();
|
|
253 | 248 |
capa.metadata.setServiceAsWFS(); |
254 | 249 |
capa.metadata.title = "Provinces"; |
255 | 250 |
capa.metadata.gml_include_items = "all"; |
256 | 251 |
capa.setDump(true); |
257 | 252 |
map.layers.add(capa); |
258 | 253 |
|
259 |
map.generate(); |
|
254 |
map.generate(mapFileName);
|
|
260 | 255 |
} |
261 | 256 |
} |
Also available in: Unified diff