Hi,
I am new in all about Arcgis. Can you tell me how I can donwload the map?
I have a map with marker I need to take a photo and save in my CRM because I am using this image in my reports!
I am working with google and i used static map for this
Hi Andre
There are a couple ways by which you can accomplish what you need:
1. Make a new Layout in your project. Add a Map frame to your layout. Define the map you want within that map frame. You can then use the following code snippet (also available in the API Reference guide here) to export the map as a PNG file:
//This example demonstrates how to export an individual map frame on a layout to PNG.
//Added referencesusing ArcGIS.Desktop.Core; //Projectusing ArcGIS.Desktop.Layouts; //Layout classesusing ArcGIS.Desktop.Framework.Threading.Tasks; //QueuedTaskusing ArcGIS.Desktop.Mapping; //Export formats
public class ExportMapFrameToPNGExample
{
public static Task ExportMapFrameToPNGAsync(string LayoutName, string MFName, string Path)
//Reference a layoutitem in a project by name LayoutProjectItem layoutItem = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals(LayoutName));
if (layoutItem == null)
return Task.FromResult<Layout>(null);
//Create PNG format with appropriate settings PNGFormat PNG = new PNGFormat();
PNG.Resolution = 300;
PNG.OutputFileName = Path;
return QueuedTask.Run(() =>
//Export MapFrame Layout lyt = layoutItem.GetLayout(); //Loads and returns the layout associated with a LayoutItem MapFrame mf = lyt.FindElement(MFName) as MapFrame;
if (PNG.ValidateOutputFilePath())
mf.Export(PNG);
}
});
2. If you want your add-in to display Pro's "Export Map" dialog, you can use the following code snippet to execute an ICommand using IPlugInWrapper. This snippet can be added to a button's click handler, for example:
internal class Button1 : Button
protected override void OnClick()
IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper("esri_sharing_ExportMap"); // Export Map button's ID.
var command = wrapper as ICommand; // tool and command(Button) supports this
if ((command != null) && command.CanExecute(null))
command.Execute(null);
Thanks
Uma Harano
ArcGIS Desktop SDK team
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.