1

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?

  • 1
    Is /home/zhangj/geoserverDownload/data/wfsresult/u4f3809a0-56a3-11e7-894d-8dc4d5efd317/result.xml.kml on the geoserver machine? Are the permissions such that the geoserver process (tomcat or however you're running it) can read from that file. Are you actually expecting KML or GML? – BradHards Jun 22 '17 at 5:56
  • when you say doesn't work, what happens - is there an error message? what about in the GeoServer log file? – Ian Turton Jun 22 '17 at 7:42
  • 1
    Please also share a sample of the GML. – Andrea Aime Jun 22 '17 at 7:59
  • @BradHards It is not on the geoserver machine. I thought it works as uploading the file from local machine to geoserver. I expect GML. But in the documentation, it doesn't say GML is supported. So I tried KML – zhangjinzhou Jun 22 '17 at 17:50
  • @iant It always say no file found. – zhangjinzhou Jun 22 '17 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.