0

i have installed the geoserver in my local system

and i tried to run the example code from openlayers the code as below

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <title>OpenLayers WFS Protocol with Filter</title>
    <link rel="stylesheet" href="http://localhost:8080/openlayers/theme/default/style.css" type="text/css">
    <script src="http://localhost:8080/openlayers/lib/OpenLayers.js"></script>
    <script src="http://maps.google.com/maps/api/js?v=3&amp;sensor=false"></script>
    <script type="text/javascript">
        var map, wfs;
       // OpenLayers.ProxyHost = "http://localhost:8080/openlayer/proxy.jsp?targetUrl=";
        var DeleteFeature = OpenLayers.Class(OpenLayers.Control, {
            initialize: function(layer, options) {
                OpenLayers.Control.prototype.initialize.apply(this, [options]);
                this.layer = layer;
                this.handler = new OpenLayers.Handler.Feature(
                        this, layer, {click: this.clickFeature}
                );
            },
            clickFeature: function(feature) {
                // if feature doesn't have a fid, destroy it
                if(feature.fid == undefined) {
                    this.layer.destroyFeatures([feature]);
                } else {
                    feature.state = OpenLayers.State.DELETE;
                    this.layer.events.triggerEvent("afterfeaturemodified",
                            {feature: feature});
                    feature.renderIntent = "select";
                    this.layer.drawFeature(feature);
                }
            },
            setMap: function(map) {
                this.handler.setMap(map);
                OpenLayers.Control.prototype.setMap.apply(this, arguments);
            },
            CLASS_NAME: "OpenLayers.Control.DeleteFeature"
        });

        function init() {

            var extent = new OpenLayers.Bounds(
                    -11593508, 5509847, -11505759, 5557774
            );


            map = new OpenLayers.Map('map', {
                projection: new OpenLayers.Projection("EPSG:900913"),
                displayProjection: new OpenLayers.Projection("EPSG:4326"),
                restrictedExtent: extent,
                controls: [
                    new OpenLayers.Control.PanZoom(),
                    new OpenLayers.Control.Navigation()
                ]
            });
            var gphy = new OpenLayers.Layer.Google(
                    "Google Physical",
                    {type: google.maps.MapTypeId.PHYSICAL, sphericalMercator: true}
            );

            var saveStrategy = new OpenLayers.Strategy.Save();

            wfs = new OpenLayers.Layer.Vector("Editable Features", {
                strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
                projection: new OpenLayers.Projection("EPSG:4326"),
                protocol: new OpenLayers.Protocol.WFS({
                    version: "1.1.0",
                    srsName: "EPSG:4326",
                    url: "http://localhost:8080/geoserver/wfs",
                    featureNS :  "http://opengeo.org",
                    featureType: "restricted",
                    geometryName: "the_geom",
                    schema: "http://localhost:8080/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=saartha:pointlayer"
                })
            });

            map.addLayers([gphy, wfs]);

            var panel = new OpenLayers.Control.Panel({
                displayClass: 'customEditingToolbar',
                allowDepress: true
            });

            var draw = new OpenLayers.Control.DrawFeature(
                    wfs, OpenLayers.Handler.Point,
                    {
                        title: "Draw Feature",
                        displayClass: "olControlDrawFeaturePolygon",
                        multi: true
                    }
            );

            var edit = new OpenLayers.Control.ModifyFeature(wfs, {
                title: "Modify Feature",
                displayClass: "olControlModifyFeature"
            });

            var del = new DeleteFeature(wfs, {title: "Delete Feature"});

            var save = new OpenLayers.Control.Button({
                title: "Save Changes",
                trigger: function() {
                    if(edit.feature) {
                        edit.selectControl.unselectAll();
                    }
                    saveStrategy.save();
                },
                displayClass: "olControlSaveFeatures"
            });

            panel.addControls([save, del, edit, draw]);
            map.addControl(panel);
            map.zoomToExtent(extent, true);
        }

    </script>
    <style>
        html,body,#map{
            height: 100%;
            width: 100%;
        }


        .customEditingToolbar {
            float: right;
            right: 0px;
            height: 30px;
        }
        .customEditingToolbar div {
            float: right;
            margin: 5px;
            width: 24px;
            height: 24px;
        }
        .olControlNavigationItemActive {
            background-image: url("http://localhost:8080/openlayers/theme/default/img/editing_tool_bar.png");
            background-repeat: no-repeat;
            background-position: -103px -23px;
        }
        .olControlNavigationItemInactive {
            background-image: url("http://localhost:8080/openlayers/theme/default/img/editing_tool_bar.png");
            background-repeat: no-repeat;
            background-position: -103px -0px;
        }
        .olControlDrawFeaturePolygonItemInactive {
            background-image: url("http://localhost:8080/openlayers/theme/default/img/editing_tool_bar.png");
            background-repeat: no-repeat;
            background-position: -26px 0px;
        }
        .olControlDrawFeaturePolygonItemActive {
            background-image: url("http://localhost:8080/openlayers/theme/default/img/editing_tool_bar.png");
            background-repeat: no-repeat;
            background-position: -26px -23px ;
        }
        .olControlModifyFeatureItemActive {
            background-image: url("http://localhost:8080/openlayers/theme/default/img/move_feature_on.png");
            background-repeat: no-repeat;
            background-position: 0px 1px;
        }
        .olControlModifyFeatureItemInactive {
            background-image: url("http://localhost:8080/openlayers/theme/default/img/move_feature_off.png");
            background-repeat: no-repeat;
            background-position: 0px 1px;
        }
        .olControlDeleteFeatureItemActive {
            background-image: url("http://localhost:8080/openlayers/theme/default/img/remove_point_on.png");
            background-repeat: no-repeat;
            background-position: 0px 1px;
        }
        .olControlDeleteFeatureItemInactive {
            background-image: url("http://localhost:8080/openlayers/theme/default/img/remove_point_off.png");
            background-repeat: no-repeat;
            background-position: 0px 1px;
        }

    </style>
</head>
<body onload="init()">

<div id="map"></div>

</body>
</html>

When i click on the save the request to geoserver is in pending for more then 10 min

enter image description here

1

The problem is related to your schema. OpenLayers uses it in xsi:schemaLocation, and It seems GeoServer doesn't like it. See http://jira.codehaus.org/browse/GEOS-6406.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.