Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Here is the code block (the layers are stored in Oracle database):

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

    var adresspt_wfs = new OpenLayers.Layer.Vector("Address points WFS", {
     strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
        protocol: new OpenLayers.Protocol.WFS({
        url: "http://localhost:8080/geoserver/wfs",
        featureType: "RAILWAY",
        featureNS: "http://localhost:8080/MIA",
        srsName: "EPSG:900913",
        geometryName: "SDO_GEOMETRY"
      })
    });
    map.addLayer(adresspt_wfs);   

Please correct me if I'm wrong: It adds new vector layer "Address points WFS", on which we can edit/delete/add some vector objects. After save all that will be saved RAILWAY table as a geometry objects in SDO_GEOMETRY column using WFS service, that is part of GeoServer (in my case i use GeoServer)... Is that right?

Also, I don't quite understand what is "featureNS" and where to find the proper one for my layer.

If i open: http://localhost:8080/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=MIA:RAILWAY in address bar-browser hangs on opening that schema..
MIA is my default workspace, its URI is http://localhost:8080/MIA

Ive tried many configurations for initializing the WFS protocol, but cant save drawn geometry into database.. Please show me what am i doing wrongly during this initialization?

Please consider that I'm completely new to "geo" programming.

share|improve this question
add comment

2 Answers 2

up vote 7 down vote accepted

Take a look at this code example:

var adresspt_wfs = new OpenLayers.Layer.Vector("Address points WFS", {
 strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
    protocol: new OpenLayers.Protocol.WFS({
    url: "http://localhost:8080/geoserver/wfs",
    featurePrefix: "XXXX" //<-- GeoServer workspace name
    featureType: "RAILWAY",//<-- layer name
    featureNS: "http://localhost:8080/MIA", //<-- Edit Workspace Namespace URI
    srsName: "EPSG:900913",
    geometryName: "SDO_GEOMETRY" //<-- geometry field
  })
});

The featureNS property is equivalent to your Namespace URI in the Edit Workspace page of GeoServer:

enter image description here

Here's a tutorial

share|improve this answer
    
Did everything as you wrote, but request timed out. If i try to open domain:8080/geoserver/wfs i get schema with exception: <ows:Exception exceptionCode="MissingParameterValue" locator="request"> <ows:ExceptionText> Could not determine geoserver request from http request org.geoserver.platform.AdvancedDispatchFilter$AdvancedDispatchHttpRequest@3f40a0‌​25 </ows:ExceptionText> </ows:Exception> –  0x49D1 Mar 7 '12 at 6:33
    
..Think i have some problems with reverse proxy. –  0x49D1 Mar 7 '12 at 8:22
add comment

As CaptDragon says it is the namespace for the features returned by the server.

As a sample if you make a request to the open server 'http://demo.opengeo.org/geoserver/wfs'

you will get a XML (a GML file) like:

<?xml version="1.0" encoding="UTF-8"?>
<wfs:FeatureCollection 
    xmlns="http://www.opengis.net/wfs" 
    xmlns:wfs="http://www.opengis.net/wfs"     
    xmlns:topp="http://www.openplans.org/topp"  <--- THIS !!!
    xmlns:gml="http://www.opengis.net/gml" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://www.openplans.org/topp 
    http://demo.opengeo.org/geoserver/wfs?service=WFS&amp;version=1.0.0&amp;request=DescribeFeatureType&amp;typeName=topp%3Astates http://www.opengis.net/wfs http://demo.opengeo.org/geoserver/schemas/wfs/1.0.0/WFS-basic.xsd">

<topp:the_geom>  <--- YOUR GEOM IS WITHIN THE topp Namespace
   <gml:MultiPolygon srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
       <gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing>
          <gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs="," ts=" ">-88.071564,37.51099 -88.087883,37.476273 -88.311707,37


    <gml:boundedBy>
        <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">       
            <gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs="," ts=" ">-124.731422,24.955967 

As you can see your the requestes features are named "topp:the_geom".

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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