Hi, I have been trying to create a workspace, a new PostGIS datastore and publish a SQL view based layer on GeoServer 2.21.1 using REST API. Creating workspace and the datastore works as given in the documentation <https://docs.geoserver.org/latest/en/user/rest/index.html#rest> (even though it is outdated). Creating a layer doesn't work though. Here is my XML file with the layer definition:
<?xml version="1.0" encoding="UTF-8"?> <featureType> <name>network-edges</name> <nativeName>network-edges</nativeName> <enabled>true</enabled> <title>Network Edges</title> <abstract>Edges present in a network</abstract> <srs>EPSG:4326</srs> <nativeBoundingBox> <minx>-180</minx> <maxx>180</maxx> <miny>-90</miny> <maxy>90</maxy> <crs>EPSG:4326</crs> </nativeBoundingBox> <latLonBoundingBox> <minx>-180</minx> <maxx>180</maxx> <miny>-90</miny> <maxy>90</maxy> <crs>EPSG:4326</crs> </latLonBoundingBox> <metadata> <entry key="JDBC_VIRTUAL_TABLE"> <virtualTable> <name>network_edges</name> <sql>select "ID","GEOMETRY" from topo."TOPO_EDGE_GEOMETRY" where "ID" = 1</sql> <escapeSql>false</escapeSql> <keyColumn>ID</keyColumn> <geometry> <name>GEOMETRY</name> <type>LineString</type> <srid>4326</srid> </geometry> </virtualTable> </entry> </metadata> </featureType> I POST the xml file to the geoserver using curl: curl -u admin:geoserver -XPOST -H "Content-type: text/xml" -d @create_layer_network_edges.xml " http://localhost:8080/geoserver-2.21.1/rest/workspaces/indres-test/datastores/indres-db-test/featuretypes " Response: Schema 'network-edges' does not exist. I am seeing one error and one warning in the log file: - WARN [rest.catalog] - Unable to fill in metadata from underlying feature source. java.io.IOException: Schema 'http://indres-test:network-edges' does not exist - ERROR [geoserver.rest] - Schema 'network-edges' does not exist. In the GUI, when I go to create layer window and select the Postgis datasource, I see a featureType named "network_edges" in the list of database tables. When I open it, I see that the native and lat/lon bounding boxes are not set and the sql view definition is not editable. After manually setting the bbox, the layer is successfully published. Could you please help me figure out why I get the above-mentioned errors and why the layer is not created upon making a POST request with the above XML? I actually need to use a parameterized sql statement. However, when I change the SQL statement to include a parameter, I get the errors "ERROR [geoserver.rest] - Error looking up primary key" and "ERROR: syntax error at or near "%" " Any leads would be appreciated. I have been stuck with this problem for a few days already. Thanks and regards, Sangeetha.
_______________________________________________ Geoserver-users mailing list Please make sure you read the following two resources before posting to this list: - Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/ - The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users