[Consumes("application/json")] // supports only json
        public IActionResult Post(BufferOperationParam myJson)
        {
            var          pathToScriptFolder = Configuration["pathToAnalysisScriptFolder"];
            var          scriptName         = Configuration["AnalysisScriptNames:bufferScript"];
            var          qgisPython         = Configuration["ScriptRunners:qgisCmdPath"];
            ResultObject output;

            using (var tempFiles = new TempFileCollection())
            {
                string inputLayerFile = tempFiles.AddExtension("geojson");
                System.IO.File.WriteAllText(inputLayerFile, myJson.InputLayer.ToString());
                string args = _creator.buildBufferCommand(myJson, pathToScriptFolder, scriptName, inputLayerFile);
                output = _python.RunCMD(args, qgisPython);
            }
            return(_outputHandler.HandleQgisOutput(output));
        }
Beispiel #2
0
        [Consumes("application/json")] // supports only json
        public IActionResult Post(SelectByLocationOperationParam myJson)
        {
            var          pathToScriptFolder = Configuration["pathToAnalysisScriptFolder"];
            var          scriptName         = Configuration["AnalysisScriptNames:selectByLocationScript"];
            var          qgisPython         = Configuration["ScriptRunners:qgisCmdPath"];
            ResultObject output;

            using (var tempFiles1 = new TempFileCollection())
            {
                string inputLayerFile   = tempFiles1.AddExtension("geojson");
                string overlayLayerFile = Path.ChangeExtension(Path.GetTempFileName(), "geojson");
                tempFiles1.AddFile(overlayLayerFile, false);
                System.IO.File.WriteAllText(inputLayerFile, myJson.InputLayer.ToString());
                System.IO.File.WriteAllText(overlayLayerFile, myJson.OverlayLayer.ToString());
                string args = _creator.buildSelectByLocationCommand(myJson, pathToScriptFolder, scriptName, inputLayerFile, overlayLayerFile);
                output = _python.RunCMD(args, qgisPython);
            }
            return(_outputHandler.HandleQgisOutput(output));
        }