1 <html xmlns="http://www.w3.org/1999/xhtml">
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">
10 OpenLayers.ProxyHost = "proxy.cgi?url=";
13 map = new OpenLayers.Map('map');
14 var wms = new OpenLayers.Layer.WMS(
16 "http://sigma.openplans.org/geoserver/wms",
17 {layers: 'topp:tasmania_state_boundaries'}
21 // Word to the Wise from an anonymous OpenLayers hacker:
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).
27 // Specifically, in the first parameter you write typename:
28 // 'topp:myLayerName', and in the following option list
29 // typeName: 'myLayerName'.
31 // If you have topp included in the second one you will get
32 // namespace 14 errors when trying to insert features.
34 wfs = new OpenLayers.Layer.WFS(
36 "http://sigma.openplans.org/geoserver/wfs",
37 {typename: 'topp:tasmania_cities'},
39 typename: "tasmania_cities",
40 featureNS: "http://www.openplans.org/topp",
41 extractAttributes: false,
42 commitReport: function(str) {
43 OpenLayers.Console.log(str);
48 map.addLayers([wms, wfs]);
50 var panel = new OpenLayers.Control.Panel({
51 displayClass: "olControlEditingToolbar"
54 var draw = new OpenLayers.Control.DrawFeature(
55 wfs, OpenLayers.Handler.Point,
57 handlerOptions: {freehand: false, multi: true},
58 displayClass: "olControlDrawFeaturePoint"
62 var save = new OpenLayers.Control.Button({
63 trigger: OpenLayers.Function.bind(wfs.commit, wfs),
64 displayClass: "olControlSaveFeatures"
68 new OpenLayers.Control.Navigation(),
72 map.addControl(panel);
74 map.zoomToExtent(new OpenLayers.Bounds(140.64,-44.42,151.89,-38.80));
79 <body onload="init()">
81 <h1 id="title">WFS Transaction Example</h1>
86 Shows the use the WFS layer for transactions.
89 <div id="map" class="smallmap"></div>
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.