简体   繁体   English

无法使用 Curl 将要素类型上传到地理服务器 REST API

[英]Can't upload feature type to Geoserver REST API using Curl

Geoserver version 2.20.1地理服务器版本 2.20.1

I am attempting to register a PostGIS table as a layer in Geoserver.我正在尝试将 PostGIS 表注册为 Geoserver 中的图层。 Here is my Curl command in bash这是我在 bash 中的 Curl 命令

curl -v -u $GEOSERVER_ADMIN_USER:$GEOSERVER_ADMIN_PASSWORD \
        -XPOST -H "Content-type: text/xml" \
        -d "\
        <featureType>
            <name>$dataset</name>\
            <title>$dataset</title>\
            <nativeCRS class='projected'>EPSG:4326</nativeCRS><srs>EPSG:4326</srs>\
            <nativeBoundingBox>\
                <minx>-94.0301461140306003</minx>\
                <maxx>-91.0935619356926054</maxx>\
                <miny>46.5128696410899991</miny>\
                <maxy>47.7878144308049002</maxy>\
                <crs class='projected'>EPSG:4326</crs>\
            </nativeBoundingBox>
        </featureType>" \
        http://geoserver:8080/geoserver/rest/workspaces/foropt/datastores/postgis/featuretypes

where $dataset is the name of the table.其中$dataset是表的名称。

Here is the error I am getting:这是我得到的错误:

The retquest has not been applied because it lacks valid authentication credentialsn for the target resource.未应用该请求,因为它缺少目标资源的有效身份验证凭据。

I have never seen this error before.我以前从未见过这个错误。 And I can't see how it's an issue with my credentials, since I am successfully performing other tasks (such as importing GeoTIFFs) within the same bash script using the same credentials.而且我看不出我的凭据有什么问题,因为我正在使用相同的凭据在同一个 bash 脚本中成功执行其他任务(例如导入 GeoTIFF)。 What is going on here?这里发生了什么?

In this situation, Geoserver is setup alongside PostGIS in a docker-compose arrangement.在这种情况下,Geoserver 在docker-compose排列中与 PostGIS 一起设置。

Interestingly enough, when I first posted, I was using Postgres version 14, PostGIS version 3.1.有趣的是,当我第一次发帖时,我使用的是 Postgres 版本 14,PostGIS 版本 3.1。 When I revert back to using Postgres version 13, the error goes away (well, a new one crops up but it seems to be a separate issue--you know how it goes).当我恢复使用 Postgres 版本 13 时,错误消失了(好吧,出现了一个新问题,但它似乎是一个单独的问题——你知道它是怎么回事)。 ¯_(ツ)_/¯ ¯_(ツ)_/¯

I'm not familiar enough with Postgres versions to say what difference it made by reverting back to version 13 (maybe there are security changes at version 14??), but it worked for me.我对 Postgres 版本不够熟悉,无法说出恢复到版本 13 有什么不同(也许版本 14 有安全更改??),但它对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM