Hot answers tagged

24

Take a look at my answer on this post. Make sure your featureNS value is in the "Edit Workspace Page under Namespace URI" in your GEOSERVER. Do not use something as generic as "http://postgis.org". Use something like "http://yourdomain/application/catalogLayer" or something unique like that. You can make this URI up, just make it unique. You ...


9

GeoServer has its own convention for JSONP callbacks, which is described here (coudn't find it mentioned in the official docs). So I quickly hacked a jsfiddle showing how you can use it with jQuery, just remember to set the url, workspace and layers so that they point to your geoserver.


7

To expand on my earlier comment for the benefit of Janne and other readers. When you use OpenLayers to make a WFS (and WFS-T) request you need to be aware of the same-origin policy, this is a clever way to prevent unscrupulous web sites from running malicious javascript exploits on your web browser. Basically what it says is that if a javascript app wants ...


7

The GeoTools library supports WFS-T. By using the class org.geotools.data.wfs.WFSDataStoreFactory you can connect to a WFS service. A transaction can be created using any class that implements the interface org.geotools.data.Transaction, for instance, the class org.geotools.data.DefaultTransaction. GeoTools has also classes that will allow you to work ...


7

You'll need to enable Transactional in the global WFS settings in the Services section of the side menu. Be careful with the workspace-specific service settings because they don't usually do what people think they do. Those settings only come into effect when you use the virtual endpoints such as http://localhost:8080/geoserver/myworkspace/wfs, but they have ...


6

For anybody interested in how to correctly use ajax and return jsonp from geoserver this is how its done: var url = "http://localhost:8080/geoserver/Common/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=cite:markers&outputFormat=text/javascript&format_options=callback:getJson"; $.ajax({ ...


6

For anyone who is having the same issue, this worked for me: In Geoserver, Go to "Data Security" section. Check if writing is allowed to anonymous user for all the workspace (..w), or create a new rule giving you access to the workspace in where your wfs-t layers are. Try Again.


6

This is because boundedBy / bbox is a property that OpenLayers creates when parsing the GML, it is not a real feature property. So when you update, you should clone the feature and get rid of it. Some example code: // do a WFS transaction to update the geometry var properties = feature.getProperties(); // get rid of bbox which is not a real property delete ...


6

Have a look at my blog for a bit on WFS-T. This uses the OL 3.5 library. https://medium.com/@goldrydigital/wfs-t-with-openlayers-3-16-6fb6a820ac58


6

While it's possible and common to publish views in GeoServer WFS, the access is limited to read-only usage, you won't be able to edit them. GeoServer normally marks views as read only because it cannot find a primary key in them (pk is mandatory to generate the gml:id and to support featureid filters). To make the view editable, assuming you can find a ...


5

You should be able to achieve this using a either Data/Layer or Service level security rules (they cannot be combined). See http://docs.geoserver.org/2.1.4/user/security/index.html for exact details, but something like this in layer permissions: WorkspaceA.*.r=* WorkspaceB.*.w=* I haven't tried this out, so I'm afraid I can't tell whether GetCapabilities ...


5

Simply add the attribute to the feature before the wfs-commit: // feat is the feature with the area the user drawn feat.attributes.INVADED_BY_ARMY_ID = 42; Of course, you should save somewhere the army id...


5

This looks like a bug in GeoServer. GeoServer needs to identify when a schemaLocation references the GeoServer's own WFS service and does this by looking at the hostname of the URL and comparing it to a list of known hostnames it generates at start up by looking at the network interfaces. If it fails to recognize itself it will make an HTTP request to ...


5

GeoServer indeed tends to swap coordinates on several occasions when using WFS. I couldn't backtrack this phenomenon to its exact origin, only to this post, where it is assumed, this confusion is created by the different axis orientation of EPSG:4326, and CRS:84, which are otherwise identical projections. A possible workaround could be implemented on the ...


5

The best place to look for details like this is in the standard. Inserting non spatial attributes is done in exactly the same way as adding spatial attributes. First check the schema of the feature type by using a describeFeature request, then construct a Transaction request with the attribute values in the same order as the schema requires.


5

when/where and why do I need to use the WFS-T capability of GeoServer? I think the answer to this question of need is of course: never If you think you have a better way of handling edits to features in your database, then do it your way. Whenever you write code for any purpose there is never a one hat fits all way of doing something, you should always ...


4

On the protocol definition, you need to set srsName: new OpenLayers.Layer.Vector('Wells', { strategies: [new OpenLayers.Strategy.BBOX(), config.saveStrategy], protocol: new OpenLayers.Protocol.WFS({ url: config.vectorWfs, featureType: "Wells_PRS", featureNS: "http://gisxxxx", ...


4

You need to use WFS-T, the T standing for transactional, which is what's required to be able to write-back. Both Openlayers and GeoServer support this. This question may help on the script side - WFS-T: changes not saved on an OpenLayers map There's also a sample tutorial here: http://www.gistutor.com/openlayers/22-advanced-openlayers-tutorials/47-...


4

Your Insert request contains an feature that doesn't match your Schema which is expecting the Point attribute to be called the_geom. You don't get an error because you have marked that feature as Nillable (or optional). <xsd:schema xmlns:gml="http://www.opengis.net/gml" xmlns:opengeo="http://opengeo.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ...


4

You don't really need any geospatial Python libraries. WFS-T is simply based on http requests. OGR does not support all WFS-T operations e.g no lock support according to official OGR WFS documentation. As long as you provide the payload, the authentication, the URL endpoint, you may just use Python requests library to simplify calls to the WFS-T endpoint. ...


4

Make sure that you are using an EPSG code of http://www.opengis.net/gml/srs/epsg.xml#4326 instead of epsg:4326 so that the X/Y lat/Lon mapping is fixed rather than variable as it is with epsg:4326. Then make sure you are encoding the geometries that you send in the same order as you have told GeoServer to expect them. See the GeoServer documentation for a ...


4

Here are three general causes of read only layers (cannot remember any other): Lack of primary key (seems you already checked it's not the case) Security (just authenticate as the admin user while doing WFS-T to factor it out) Table contains a column type that GeoServer does not understand and thus cannot modify (e.g., hstore in postgresql)


3

UPDATE 2 The link to the Community Edition of the OpenGeo Suite can be found here. UPDATE It would seem that OpenGeo has removed the community edition. You can still use GeoExplorer though. The OpenGeo Suite Community edition has a GeoExplorer web app that you can use to style and edit layers. You can install it along with the OpenGeo Suite or by ...


3

According to Wikipedia: The WFS specification defines interfaces for describing data manipulation operations of geographic features. Data manipulation operations include the ability to: get or query features based on spatial and non-spatial constraints create a new feature instance delete a feature instance update a feature instance ...


3

Thanks unicoletti, the callback change worked. I now have: $.ajax({ url: "http://localhost:8090/geoserver/cite/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=cite:markers&maxFeatures=50&outputFormat=json&format_options=callback:processMarkers", dataType: "jsonp", }); and it returns the json, which I successfully ...


3

I had a similar problem before, what helped me, that I uncommented the line that starts with "schema", so like this: geometryName: "the_geom", //schema: "http://localhost/geoserver/wfs/DescribeFeatureType?version=1.1.0&;typename=IIRS1:india_state" }) and also I think this line is maybe wrong: url: "http://localhost:8089/geoserver/IIRS1/wms", ...


3

You don't say what versions of the software you are using but if it is a recent PostGIS (1.9+) and an older GeoServer (2.1.x -) then you will need to run the legacy.sql script to add geomFromText() (and other functions) back into PostGIS. See http://postgis.refractions.net/docs/PostGIS_FAQ.html#legacy_faq for more details.


3

I have been struggling with the same issue, and so far the simple solution is to force the server side WFS-T handler (in my case tinyows v1.0.0) to ignore the schema validation. This has potential security side effects, so it is not a 'production-ready' solution, but a step in the right direction. Looking at the generated XML, it appears that the schema for ...


3

First thing to check: is your server / test webpage on 'medford.opengeo.org'? If it isn't, you won't be able to access WFS because of the Same Origin Policy. You can technically use a proxy to fix this. (though in my opinion this is just a case of WFS being a poorly designed protocol)


3

I know that this question is 3 years old, but I think it will help future people reading this subject. You can find an OpenLayers implementation of topology here: http://dev.openlayers.org/sandbox/bjornharrtell/eventbasedtopology2/examples/topology.html


Only top voted, non community-wiki answers of a minimum length are eligible