Skip to end of metadata
Go to start of metadata

This tutorial is designed to help you get a WFS running with your own Geographic data.

Install the default demo

Before installing your own data, ensure you can get the default mapbuilder demo working. Refer to http://mapbuilder.sourceforge.net/mapbuilder/demo/wfs-t/install.html which explains how to install mapbuilder and geoserver.

Create your own data

Refer to geoserver documentation for how to set up your own WFS data.

Copy the wfs-t demo

Edit index2.html and convert "config.xml" to "config2.xml"

Create a template.xml

The template.xml is used to populate a default FeatureCollection. The FeatureCollection will be used to populate the WFS Insert Transation.
Use template_roads.xml or template_cities.xml as an example.

One effective method of creating your template file is to look at the GML returned by a GetFeature request on your WFS layer. For example, if I am trying to edit "topp:roads", point your web browser to http://your.server:port/geoserver/wfs?request=GetFeature&typename=topp:roads and follow the structure of the GML feature member exactly but remove all attributes and coordinates specific to that feature.

It is important that you update the xml namespaces to be the same as your WFS. Ie, make sure you change the xmlns: attribute, and replace all the "topp:" strings with your namespace. In your template, this usually involves adding the namespace(s) to your gml:featureMember. An example template.xml for a point layer might look like:

Update featureCollection in config file

In config2.xml, check the FeatureCollection namespace to make sure the namespace(s) for your WFS are included.

Update EditLine/EditPoint attributes in config file

In config2.xml, update defaultModelUrl to reference your new template.xml file.

Update featureXpath. featureXpath is an Xpath reference to the GML coordinates in your template.xml which need to be updated. For example. if you were using the template.xml show above, your featureXPath for the EditPoint widget would look like:

Again, make sure that you use the XML namespaces in the Xpath reference (ie. "topp:the_geom" instead of just "the_geom")

  • No labels