postgresql - geoserver wfs-t 是只读异常

标签 postgresql postgis openlayers-3 geoserver

我正在尝试使用 GeoServer 通过 WFS-T 保存更改: 这是我从地理服务器获取功能的代码

var sourceWFS = new ol.source.Vector({
    loader: function (extent) {
        $.ajax('http://127.0.0.1:8080/geoserver/kairosDB/ows', {
            type: 'GET',
            data: {
                service: 'WFS',
                version: '1.1.0',
                request: 'getFeature',
                typename: 'wfs_geom',
                srsname: 'EPSG:3857',
                bbox: extent.join(',') + ',EPSG:3857'
            }
        }).done(function (response) {
            sourceWFS.addFeatures(formatWFS.readFeatures(response));
        });
    },
    // strategy: ol.loadingstrategy.tile(ol.tilegrid.createXYZ()),
    strategy: ol.loadingstrategy.bbox,
    projection: 'EPSG:3857'
});

这是将特征保存到服务器的代码

var formatGML = new ol.format.GML({
    featureNS: 'http://127.0.0.1:8080/geoserver/kairosDB',
    featureType: 'wfs_geom',
    srsName: 'EPSG:3857'
});

但是当我将特征保存到服务器时,出现了这个错误

2017-02-01 14:30:02,339 ERROR [geoserver.ows] - 
org.geoserver.wfs.WFSTransactionException: {http://127.0.0.1:8080/geoserver/kairosDB}wfs_geom is read-only
    at org.geoserver.wfs.Transaction.execute(Transaction.java:269)
    at org.geoserver.wfs.Transaction.transaction(Transaction.java:106)
    at org.geoserver.wfs.DefaultWebFeatureService.transaction(DefaultWebFeatureService.java:172)
    at sun.reflect.GeneratedMethodAccessor195.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)

wfs_geom表已有主键,创建脚本:

CREATE TABLE public.wfs_geom
(
    id bigint NOT NULL,
    geometry geometry,
    CONSTRAINT wfs_geom_pkey PRIMARY KEY (id)
)
WITH (
    OIDS = FALSE
)
TABLESPACE pg_default;

ALTER TABLE public.wfs_geom
    OWNER to postgres;

GRANT ALL ON TABLE public.wfs_geom TO postgres;

-- Index: sidx_wfs_geom

-- DROP INDEX public.sidx_wfs_geom;

CREATE INDEX sidx_wfs_geom
    ON public.wfs_geom USING gist
    (geometry)
    TABLESPACE pg_default;

你能帮帮我吗?

最佳答案

这很有魅力:http://osgeo-org.1560.x6.nabble.com/Read-only-error-when-editing-a-WFS-T-td5284537.html

There is a rule in the "Data security" section that do allow to write to this workspace for all, but the writing is not allowed to anonymous user for all the workspace (..w) The strange behaviour is that in yesterday I can edit the layer using a client.. and I do not understand why, moreover using QGIS I cannot edit the layer, but QGIS support the WFS-T

关于postgresql - geoserver wfs-t 是只读异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41972613/

相关文章:

postgresql - PostGIS 中未找到 ST_Extrude 函数

javascript - 如何计算路径上两点之间的距离?

javascript - Openlayers 3 无法删除功能

ruby-on-rails - ActiveRecord 查找不存在与属性关联的实例

kml - Postgis 到 KML,包括色域

python - Django + psycopg2 OperationalError 无法打开证书文件 "/root/.postgresql/postgresql.crt": Permission denied

postgresql - 为 postgis 过滤 openstreetmap 数据

javascript - 添加图像和动画线串

php - dbconnection 类 PGSQL 重写函数

postgresql - 使用 exec 而不是 select 调用函数