0

I am learning ArcGIS pro sdk with no prior experience in c#.

Here is my code that exports the mapview to jpg, but I want it to export only the area that the user's rectangle covers.

protected override async Task<bool> OnSketchCompleteAsync(Geometry geometry)
    {

        var filePath = "";
        SaveItemDialog saveDialog = new SaveItemDialog();
        saveDialog.Title = "Save";
        saveDialog.OverwritePrompt = true;
        saveDialog.DefaultExt = "jpg";

        // If the save dialog was not dismissed, create the file
        if (saveDialog.ShowDialog() == true)
        {
            filePath=saveDialog.FilePath;
        }     
        var mv = MapView.Active;
        JPEGFormat JPG = new JPEGFormat()
        {
            HasWorldFile = true,
            Resolution = 300,
            OutputFileName = filePath,
            JPEGColorMode = JPEGColorMode.TwentyFourBitTrueColor,
            Height = 800,
            Width = 1200
        };

        ////Check to see if the path is valid and export
        if (JPG.ValidateOutputFilePath())
        {
            await QueuedTask.Run(() => mv.Export(JPG));  //Export the layout to PDF on the worker thread
        }
        return true;
    }

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.