Friday, 12 February 2016

wfs - Upload GML to Geoserver as Layer through REST


I have to upload a GML file to my geoserver through REST. I tried to use importer but it doesn't work (even manually). More specifically, the importer module never generate tasks automatically for GML. When I use another REST call to generate tasks, it returns max-stack-limit error. Further, I noticed that GML is not in the supporting list of importer extension.


Here is the code I used to create a import event:


          var uri = 'http://192.168.0.30:8080/geoserver/rest/imports';
var data = JSON.stringify({"import": {
"targetWorkspace": {
"workspace": {

"name": "wfsresult"
}
},
"targetStore": {
"dataStore": {
"name": "WFSSourceResult"
}
},
"data": {
"type": "file",

"file": "/home/zhangj/geoserverDownload/data/wfsresult/u4f3809a0-56a3-11e7-894d-8dc4d5efd317/result.xml.kml"
}
}});
Request({
uri: uri,
method: 'POST',
auth: auth,
headers: {
'content-type': 'application/json'
},

body: data
}, (err, response, body) => {
if(err) {
reply(err);
} else {
reply(body);
}
});
}


Am I using importer extension correctly?


If importer doesn't fit my situation, what should I use?


I got that wfs transaction may be a good solution. How should I use it?




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...