通过Node.js将.tif上载到GeoServer
如何通过Node.js将.tif文件上载到正在运行的GeoServer?我想上传一个GeoTIFF,由GeoServer作为WMS提供 GeoServer使用405进行响应,我认为这是正确的()。很遗憾,我在GeoServer上找不到该文件 这是我的代码:通过Node.js将.tif上载到GeoServer,node.js,geoserver,wms,geotiff,Node.js,Geoserver,Wms,Geotiff,如何通过Node.js将.tif文件上载到正在运行的GeoServer?我想上传一个GeoTIFF,由GeoServer作为WMS提供 GeoServer使用405进行响应,我认为这是正确的()。很遗憾,我在GeoServer上找不到该文件 这是我的代码: // GeoServer upload var http = require('http'); var auth = 'Basic ' + new Buffer('admin' + ':' + 'geoserver').toString(
// GeoServer upload
var http = require('http');
var auth = 'Basic ' + new Buffer('admin' + ':' + 'geoserver').toString('base64');
//build the object to post
var post_data = (path.join(paperpath, paperid, "geotiff", req.files["otherfiles"][fileno].originalname)); // Path to .tif file
var s = JSON.stringify(post_data);
var post_options = {
host: 'localhost',
port: '9000',
path: '/geoserver/rest/workspaces/myWorkspace/coveragestores/test/file',
method: 'POST',
headers: {
'Content-Length': s.length,
'Content-Type': 'image/tif',
'Authorization': auth
}
}
// Set up the request
var post_req = http.request(post_options, function(res) {
res.setEncoding('utf8');
console.log(res.statusCode);
res.on('data', function(chunk) {
console.log('Success! ' + chunk);
});
});
// post the data
post_req.write(s);
post_req.end();
我认为首先需要将文件上载到一个可从geoserver访问的文件夹中(最好是在geoserver数据目录的文件夹中),然后使用RESTAPI配置覆盖率存储。 检查这个,它会给你一个提升