Geographic Information Systems Asked by TonyAngelino on April 20, 2021
I’m using geoserver 2.13.1 with postgres 9.5 and postgis 2.4.2.
I am trying to use REST api to create workspace (works) and in it a datastore of postgis type. I have already prepared a template database in postgres and trying to use it here (this is the xml body of the post request to /geoserver/rest/workspaces/workspace_name/datastores):
<dataStore>
<name>datastore_name</name>
<description>dummy description</description>
<type>PostGIS</type>
<enabled>true</enabled>
<connectionParameters>
<entry key="Estimated extends">false</entry>
<entry key="schema">venue</entry>
<entry key="fetch size">1000</entry>
<entry key="Max open prepared statements">50</entry>
<entry key="Connection timeout">20</entry>
<entry key="preparedStatements">false</entry>
<entry key="database">mydbname</entry>
<entry key="port">5432</entry>
<entry key="min connections">1</entry>
<entry key="dbtype">postgis</entry>
<entry key="Loose bbox">true</entry>
<entry key="host">localhost</entry>
<entry key="max connections">10</entry>
<entry key="user">foo</entry>
<entry key="passwd">bar</entry>
<entry key="create database">true</entry>
<entry key="create database params">WITH TEMPLATE=mydbtemplate</entry>
</connectionParameters>
<__default>true</__default>
</dataStore>
The geoserver datastore is created as expected (and I’m getting 201 http code back), but the database itself is not created. No error messages.
Only if I open that store now via geoserver web interface and click on the save button (without changing anything), only then is the database really created using desired template. So, all those params are correct, but there is something missing on the server side, like a commit or something, that would trigger the create db job.
I have tried:
I don’t see any other REST API function looking even remotely related to “apply changes”. So, how can I achieve that via REST API?
You can perform several operation on workspaces. Please check the link https://docs.geoserver.org/latest/en/api/#/latest/en/api/1.0.0/workspaces.yaml
Answered by Rajat Upadhyay on April 20, 2021
You should do an operation that forces the datastore to be actually created and do something against the database. Like listing its feature types, which you can do via REST.
Answered by Andrea Aime on April 20, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP