Hi,
I am using the following python function & the Geoserver REST API to create
a layer.
def
publish_layer(layer_name,store_name,workspace_name,table_name,geoserver_url,user,password):
'''(str,str,str,str,str,str) -> response
Returns the server response code for publishing a layer using the REST
API
'''
#This will be a POST call using the Geoserver REST API
headers = {'Content-Type': 'application/xml'}
url = geoserver_url +
'/workspaces/{0}/datastores/{1}/featuretypes'.format(workspace_name,store_name)
post_data = """<featureType>"""\
+"""<name>{}</name></featureType>""".format('pub_roads')\
+""" <nativeName>{}</nativeName>""".format('pub_roads')\
+"""<title>{}</title>""".format('roads')
#Perform the request
r =
requests.post(url,headers=headers,auth=HTTPBasicAuth(user,password),data=post_data)
return r.status_code
Executing this function returns a 201 code which indicates that the layer is
created however instead of having a layer with the name 'pub_roads' I am
presented with a layer named 'roads'.
Is there an issue with using underscores in POSTS using the REST API? Any
documentation with POST examples for layers is also welcome.
Geoserver versions tested 2.10.1 and 2.11.0
Regards,
D.
--
View this message in context:
http://osgeo-org.1560.x6.nabble.com/Create-layer-tp5317197.html
Sent from the GeoServer - User mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users