comparison gnv/src/main/webapp/WEB-INF/jsp/wmslayout.jsp @ 585:2e690cb2247c

Show information about MapServer path and layer name after publishing calculated shapefiles as wms. Use MapServer settings configured in conf.xml to feed OpenLayers client. gnv/trunk@736 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 05 Mar 2010 09:33:30 +0000
parents b31e81f35b64
children 8315b0a40329
comparison
equal deleted inserted replaced
584:b31e81f35b64 585:2e690cb2247c
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> 3 <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
4 <%
5 String serverPath = (String) request.getAttribute("mapserver");
6 String mapfilePath = (String) request.getAttribute("mapfile");
7 String layerName = (String) request.getAttribute("layer");
8 %>
9
4 <html xmlns="http://www.w3.org/1999/xhtml"> 10 <html xmlns="http://www.w3.org/1999/xhtml">
5 <head> 11 <head>
6 <title> 12 <title>
7 <bean:message key="gnviewer.app.title"/> 13 <bean:message key="gnviewer.app.title"/>
8 </title> 14 </title>
21 var lat = 55; 27 var lat = 55;
22 var zoom = 5; 28 var zoom = 5;
23 var map, layer; 29 var map, layer;
24 30
25 function init() { 31 function init() {
26 if (getURLParam("target") == "wms") { 32 map = new OpenLayers.Map('map');
27 map = new OpenLayers.Map('map'); 33 var server = '<%=serverPath%>?MAP=<%=mapfilePath%>';
28 layer = new OpenLayers.Layer.WMS( 34 layer = new OpenLayers.Layer.WMS(
29 "MyWMS", 35 "MyWMS",
30 "http://denmark.atlas/cgi-bin/mapserv-gp?MAP=/opt/artifacts/mapfiles/mapfile.map", 36 server,
31 { 37 {
32 layers: getURLParam("layer"), 38 layers: '<%=layerName%>',
33 format: 'image/png' 39 format: 'image/png'
34 }, 40 },
35 { 41 {
36 singleTile: 'true' 42 singleTile: 'true'
37 } 43 }
38 ); 44 );
39 45
40 map.addLayer(layer); 46 map.addLayer(layer);
41 map.setCenter(new OpenLayers.LonLat(lon, lat), zoom); 47 map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
42 }
43 }
44
45 function getURLParam(strParamName){
46 var strReturn = "";
47 var strHref = window.location.href;
48
49 if ( strHref.indexOf("?") > -1 ){
50 var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
51 var aQueryString = strQueryString.split("&");
52
53 for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
54 if (aQueryString[iParam].indexOf(strParamName + "=") > -1 ) {
55 var aParam = aQueryString[iParam].split("=");
56 strReturn = aParam[1];
57 break;
58 }
59 }
60 }
61
62 return strReturn;
63 } 48 }
64 </script> 49 </script>
65 </head> 50 </head>
66 51
67 <body id="gnviewerbody" onLoad="init()"> 52 <body id="gnviewerbody" onLoad="init()">
76 <div id="page"> 61 <div id="page">
77 <jsp:include page="header.jsp" /> 62 <jsp:include page="header.jsp" />
78 <jsp:include page="index.jsp" /> 63 <jsp:include page="index.jsp" />
79 <jsp:include page="footer.jsp" /> 64 <jsp:include page="footer.jsp" />
80 65
81 <div id="map"></div> 66 <div class="outerMap">
67 <div id="wms">
68 <table>
69 <tr>
70 <td class="parameter"><bean:message key="gnviewer.wms.server.path"/>:</td>
71 <td class="wmsvalue"><%=serverPath%>?MAP=<%=mapfilePath%></td>
72 </tr>
73 <tr>
74 <td class="parameter"><bean:message key="gnviewer.wms.server.layer"/>:</td>
75 <td class="wmsvalue"><%=layerName%></td>
76 </tr>
77 </table>
78 </div>
79 <div id="map"></div>
80 </div>
82 </div> 81 </div>
83 </body> 82 </body>
84 </html> 83 </html>

http://dive4elements.wald.intevation.org