[Geoserver-users] Rest Api - Adding a PostGIS database

Hi,

First of all I'm not an IT guy and I known my doubts can be annoying for
someone that work in the space.

I'm trying to use the Rest API with cURL to transfer postgis data to
Geoserver.
For that I'm following the REST configuration examples at Geoserver
Documentation
(http://docs.geoserver.org/stable/en/user/rest/examples/curl.html)

The first step of creating a workspace (acme) was succefful with this comand
line
/curl -v -u admin:**** -XPOST -H "Content-type: text/xml" -d
"<workspace><name>acme</name></workspace>"
http://localhost/geoserver/rest/workspaces/

Than I try to Adding a PostGIS database and a I get stucked with something
quiet basic.
In the documentation says I should create a xml file, which I did:

<dataStore>
  <name>spo</name>
  <connectionParameters>
    <host>localhost</host>
    <port>5432</port>
    <database>spo</database>
    <user>postgres</user>
    <passwd>****</passwd>
    <dbtype>postgis</dbtype>
  </connectionParameters>
</dataStore>

The database exists
<http://osgeo-org.1560.x6.nabble.com/file/n5233905/db.png&gt;

I saved the xml at:
/...applications/geoserver-2.8.0/data/workspaces/acme/

Than I run the command:
/curl -v -u admin:geoserver -XPOST -T spo.xml -H "Content-type: text/xml"
http://localhost/geoserver/rest/workspaces/acme/datastores/

And get this error:
/curl: Can't open 'spo.xml'!/

I imagine that I'm saving the xml file in the wrong place...

I appreciate any help.

Thanks,
Pedro

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Rest-Api-Adding-a-PostGIS-database-tp5233905.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

Hi Pedro,

···

On Mon, Nov 2, 2015 at 1:25 PM, Pedro <pedro.ferro@anonymised.com.> wrote:

Than I run the command:
/curl -v -u admin:geoserver -XPOST -T spo.xml -H “Content-type: text/xml”
http://localhost/geoserver/rest/workspaces/acme/datastores/

And get this error:
/curl: Can’t open ‘spo.xml’!/

I imagine that I’m saving the xml file in the wrong place…

Looks like curl itself is unable to locate the file… is spo.xml in the current working directory when you execute the curl command?
If not, use the absolute path like this:

curl -v -u admin:geoserver -XPOST -T /path/to/spo.xml …

Hope this helps.

Best regards,
Stefano Costa

==
GeoServer Professional Services from the experts! Visit
[http://goo.gl/it488V](http://goo.gl/it488V) for more information.
==
Dott. Stefano Costa
Senior Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:     +39 0584 1660272

[http://www.geo-solutions.it](http://www.geo-solutions.it)
[http://twitter.com/geosolutions_it](http://twitter.com/geosolutions_it)

-------------------------------------------------------
AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate.
Il loro utilizzo è consentito esclusivamente al destinatario del
messaggio, per le finalità indicate nel messaggio stesso. Qualora
riceviate questo messaggio senza esserne il destinatario, Vi preghiamo
cortesemente di darcene notizia via e-mail e di procedere alla
distruzione del messaggio stesso, cancellandolo dal Vostro sistema.
Conservare il messaggio stesso, divulgarlo anche in parte,
distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità
diverse, costituisce comportamento contrario ai principi dettati dal
D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely
for the attention and use of the named addressee(s) and may be
confidential or proprietary in nature or covered by the provisions of
privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New
Data Protection Code).Any use not in accord with its purpose, any
disclosure, reproduction, copying, distribution, or either
dissemination, either whole or partial, is strictly forbidden except
previous formal approval of the named addressee(s). If you are not the
intended recipient, please contact immediately the sender by
telephone, fax or e-mail and delete the information in this message
that has been received in error. The sender does not give any warranty
or accept liability as the content, accuracy or completeness of sent
messages and accepts no responsibility  for changes made after they
were sent or for other risks which arise as a result of e-mail
transmission, viruses, etc.

Stefano Costa-4 wrote

Hi Pedro,

On Mon, Nov 2, 2015 at 1:25 PM, Pedro &lt;

pedro.ferro@

&gt; wrote:

Than I run the command:
/curl -v -u admin:geoserver -XPOST -T spo.xml -H "Content-type: text/xml"
http://localhost/geoserver/rest/workspaces/acme/datastores/

And get this error:
/curl: Can't open 'spo.xml'!/

I imagine that I'm saving the xml file in the wrong place...

Looks like curl itself is unable to locate the file... is spo.xml in the
current working directory when you execute the curl command?
If not, use the absolute path like this:

curl -v -u admin:geoserver -XPOST -T /path/to/spo.xml ...

Hope this helps.

--

Best regards,
Stefano Costa

Thanks Stefano.

Yes, it was related with that...
Just change the prompt to the directory where the file was and voilá, works!

Thanks again for the help and like I said at first "I known my doubts can be
annoying"....

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Rest-Api-Adding-a-PostGIS-database-tp5233905p5233943.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

Hi,

Could someone give me a hint whether Geoserver WFS can handle PostgreSQL (PostGIS) tables which have columns containing arrays? Thanks!

Regards,
Nhan

On Mon, Nov 2, 2015 at 4:20 PM, Nhan Vo <nhanvo@anonymised.com> wrote:

Hi,

Could someone give me a hint whether Geoserver WFS can handle PostgreSQL
(PostGIS) tables which have columns containing arrays? Thanks!

It cannot. This would be a new feature, read this document in case you need
it:
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

-------------------------------------------------------

Hi again,

As I said in my first post

I'm trying to use the Rest API with cURL to transfer postgis data to
Geoserver.
For that I'm following the REST configuration examples at Geoserver
Documentation
(http://docs.geoserver.org/stable/en/user/rest/examples/curl.html)

Now I'm stucked in a PUT operation and appreciate any help

I was able to add a postgis table/view at Geoserver, with this command line:
/curl -v -u admin:**** -XPOST -H "Content-type: text/xml" -d
"<featureType><name>v_spofproc_geo</name></featureType>"
http://localhost:8080/geoserver/rest/workspaces/acme/datastores/spo/featuretypes/

Know I would like to update the same postgis table and I just replaced the
POST for PUT, like this:
/curl -v -u admin:**** -XPUT -H "Content-type: text/xml" -d
"<featureType><name>v_spofproc_geo</name></featureType>"
http://localhost:8080/geoserver/rest/workspaces/acme/datastores/spo/featuretypes/

but I get an error: /HTTP/1.1 405 Method Not Allowed/

About to connect() to localhost port 8080 (#0)
* Trying ::1...
* Connected to localhost (::1) port 8080 (#0)
* Server auth using Basic with user 'admin'

PUT /geoserver/rest/workspaces/acme/datastores/spo/featuretypes HTTP/1.1
Authorization: Basic YWRtaW46Z2Vvc2VydmVy
User-Agent: curl/7.29.0
Host: localhost:8080
Accept: */*
Content-type: text/xml
Content-Length: 54

* upload completely sent off: 54 out of 54 bytes
< HTTP/1.1 405 Method Not Allowed
< Server: GlassFish Server Open Source Edition 4.1
< X-Powered-By: Servlet/3.1 JSP/2.3 (GlassFish Server Open Source Edition
4.1 Java/Oracle Corporation/1.8)
< Allow: POST, GET
< Date: Tue, 03 Nov 2015 12:18:11 GMT
< Server: Noelios-Restlet-Engine/1.0..8
< Transfer-Encoding: chunked
<
* Connection #0 to host localhost left intact

I try to add a space at XPUT (X PUT), but had the same result

Thanks in advance,
Pedro

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Rest-Api-Adding-a-PostGIS-database-tp5233905p5234150.html
Sent from the GeoServer - User mailing list archive at Nabble.com.