]> dev.renevier.net Git - syp.git/blob - openlayers/examples/wfs-t.html
move templates to a specific directory
[syp.git] / openlayers / examples / wfs-t.html
1 <html xmlns="http://www.w3.org/1999/xhtml">
2   <head>
3     <title>OpenLayers: WFS-T</title>
4     <link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
5     <link rel="stylesheet" href="style.css" type="text/css" />
6     <script src="../lib/Firebug/firebug.js"></script>
7     <script src="../lib/OpenLayers.js"></script>
8     <script type="text/javascript">
9         var map, wfs;
10         OpenLayers.ProxyHost = "proxy.cgi?url=";
11
12         function init() {
13             map = new OpenLayers.Map('map');
14             var wms = new OpenLayers.Layer.WMS(
15                 "State",
16                 "http://sigma.openplans.org/geoserver/wms",
17                 {layers: 'topp:tasmania_state_boundaries'}
18             );
19             
20             //
21             // Word to the Wise from an anonymous OpenLayers hacker:
22             //             
23             // The typename in the options list when adding/loading a wfs 
24             // layer not should contain the namespace before, (as in the 
25             // first typename parameter to the wfs consctructor).
26             // 
27             // Specifically, in the first parameter you write typename: 
28             // 'topp:myLayerName', and in the following option list 
29             // typeName: 'myLayerName'. 
30             // 
31             // If you have topp included in the second one you will get 
32             // namespace 14 errors when trying to insert features.
33             //
34             wfs = new OpenLayers.Layer.WFS(
35                 "Cities",
36                 "http://sigma.openplans.org/geoserver/wfs",
37                 {typename: 'topp:tasmania_cities'},
38                 {
39                     typename: "tasmania_cities",
40                     featureNS: "http://www.openplans.org/topp",
41                     extractAttributes: false,
42                     commitReport: function(str) {
43                         OpenLayers.Console.log(str);
44                     }
45                 }
46             );
47            
48             map.addLayers([wms, wfs]);
49
50             var panel = new OpenLayers.Control.Panel({
51                 displayClass: "olControlEditingToolbar"
52             });
53
54             var draw = new OpenLayers.Control.DrawFeature(
55                 wfs, OpenLayers.Handler.Point,
56                 {
57                     handlerOptions: {freehand: false, multi: true},
58                     displayClass: "olControlDrawFeaturePoint"
59                 }
60             );
61             
62             var save = new OpenLayers.Control.Button({
63                 trigger: OpenLayers.Function.bind(wfs.commit, wfs),
64                 displayClass: "olControlSaveFeatures"
65             });
66            
67             panel.addControls([
68                 new OpenLayers.Control.Navigation(),
69                 save, draw
70             ]);
71
72             map.addControl(panel);
73             
74             map.zoomToExtent(new OpenLayers.Bounds(140.64,-44.42,151.89,-38.80));
75         }
76         
77     </script>
78 </head>
79 <body onload="init()">
80
81     <h1 id="title">WFS Transaction Example</h1>
82     
83     <div id="tags">
84     </div>
85     <p id="shortdesc">
86         Shows the use the WFS layer for transactions.
87     </p>
88     
89     <div id="map" class="smallmap"></div>
90     
91     <p id="docs">
92     This is an example of using a WFS layer type. Note that it requires a 
93     working GeoServer install, which the OpenLayers project does not maintain;
94     however, if you're interested, you should be able to point this against
95     a default GeoServer setup without too much trouble.
96     </p>
97
98
99
100     </body>
101 </html>
102
103