|
POST
|
Have you tried the following book? http://www.amazon.com/Beginning-ArcGIS-Desktop-Development-using/dp/1118442547/ref=sr_1_fkmr0_1?ie=UTF8&qid=1447684365&s…
... View more
11-16-2015
06:33 AM
|
2
|
3
|
1702
|
|
POST
|
To add to the above responses, below is how this would look in the code. The workflow will vary depending on if you're executing the code in-process or out-of-process. # Option A : When you're executing code in-process #
import arcpy
# Use this line if you're not sure if it's already true
arcpy.env.addOutputsToMap = True
# Executing tool will automatically add layer to map
arcpy.management.MakeFeatureLayer(r"Path\To\GDB\FeatureClass", "NameForLayer")
# Option B : When you're executing code out-of-process #
import arcpy
# Hook into the map document
mxd = arcpy.mapping.MapDocument(r"Path\To\MapDocument")
# Hook into the data frame where you want to add the layer
df = arcpy.mapping.ListDataFrames(mxd)[0]
# Create a Layer object
lyr = arcpy.management.MakeFeatureLayer(r"Path\To\GDB\FeatureClass", "NameForLayer").getOutput(0)
# Add the layer object to the map
arcpy.mapping.AddLayer(df, lyr) Add Layer http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-mapping/addlayer.htm
... View more
11-14-2015
11:08 PM
|
2
|
5
|
5680
|
|
POST
|
Did refresh the display? I would assume that you'd need to make a call to IActiveView.PartialRefresh(ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewGeoSelection, null, null);
... View more
11-13-2015
04:49 PM
|
1
|
1
|
1038
|
|
POST
|
I just tested this and most of it appears easily possible. Below is a screenshot that shows that I was able to get this to work. You'll see in the addin that I was about to included the out-of-the-box python window button on my toolbar. With my example I had to separate this workflow into two steps. The user has to click the Python Window command to show the window and it appears that the print statements will show up in this window. If I were to use ArcObjects I could the window to launch when clicking on the button. I'd assume in python that you'd need to use the comtypes library to interact with ArcObjects directly. Within the python code you'd need to grab an instance of the Python Window and launch it prior to executing your code. You can find the command using the guid for the python window as shown below. ICommandBars commandBars = ArcMap.Application.Document.CommandBars;
UID commandID = new UIDClass { Value = "{1A7E7146-BDFB-4755-93DE-100171382BFF}" };
ICommandItem commandItem = commandBars.Find(commandID, false, false);
commandItem.Execute(); To be honest, if I had to implement this workflow and didn't require any user interaction with the command I would honestly just run this against the geoprocessing framework as Rebecca Strauch, GISP suggested. The geoprocessing framework should provide you with everything you'd need to present to the user and would aid in helping you not block the UI thread when executing your task.
... View more
11-13-2015
09:21 AM
|
1
|
0
|
1377
|
|
POST
|
I don't think that your original model is going to work. The create table will create a new blank table in memory, but you won't have any records for the Calculate Field to update. The Calculate Field tool cannot create new records in the table, so the output would be an empty table that is passed to the Create XY Event tool. If you wanted this to work in its simplest form you could leverage a RecordSet parameter. This would just require that you provide a schema for the RecordSet. The below model worked for me. The dialog shown is how your users would provide the inputs to the RecordSet parameter. As a result of using the RecordSet users would be able to input multiple points. If you wanted to expose a variable for the two coordinates (i.e. a Double type parameter for the X_Coord and a Double type parameter for the Y_Coord) without using python you could accomplish this, but you wouldn't be able to use the Create Table tool without using the append tool. I would think that you'd need to have already created a table with a single row. You'd need to copy this table into memory, use calculate field against this to update the already available row, and then create your features from this. I was able to accomplish this with the below model.
... View more
11-12-2015
04:22 PM
|
1
|
0
|
2434
|
|
POST
|
Hi Adam, I apologize for the delay. I'll attach the sample application to this message. As to which SDK you should use, it would depend on your business requirements with the Runtime SDK. I personally prefer .NET because I'm more proficient in it and typically work in Windows environments, but I also leverage Java, Android, and iOS when the project requires using one of those SDKs. The sample I've written uses the Runtime for .NET SDK. For each runtime API there should a sample application included that would most likely have a sample that shows how to open a tile package. I would assume that if you're familiar with other languages you shouldn't have too much trouble rewriting this sample into those languages. I've also included a copy of the logic I used below along with an image of the application. You'll see that the application contains a single button that you can use to load tile packages from disk. using System.Windows.Forms;
using Esri.ArcGISRuntime.Controls;
using System;
using System.Diagnostics;
using System.Linq;
using System.Windows;
using Esri.ArcGISRuntime.Layers;
namespace LoadTilePackage
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private async void LoadButton_OnClick(object sender, RoutedEventArgs e)
{
// Allow the user to browse to a tile package
string tpkPath = BrowseFolderForFile("Please select a Tile Package", "Tile Package (*.tpk)|*.tpk");
if (String.IsNullOrEmpty(tpkPath))
return;
// Create a map to hold the layer
Map map = new Map();
// Load the tile package
ArcGISLocalTiledLayer layer = new ArcGISLocalTiledLayer(tpkPath);
await layer.InitializeAsync();
// Add the tpk to the map
map.Layers.Add(layer);
// Replace the MapView's map with the new map
MyMapView.Map = map;
}
public string BrowseFolderForFile(string title, string extension)
{
OpenFileDialog openFileDialog = new OpenFileDialog
{
Filter = extension,
Multiselect = false,
ShowHelp = true,
Title = title
};
if (openFileDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
return string.Empty;
string fileName = openFileDialog.FileName;
return fileName;
}
}
}
... View more
11-11-2015
05:03 PM
|
0
|
0
|
1261
|
|
POST
|
Hi Jean, This error appears to be related to the custom coordinate system. From looking at your projection it appears that you're using 2154 : RGF_1993_Lambert_93. In your shapefile you've renamed this coordinate system to RGF93_Lambert_93, which makes the system treat this as a custom coordinate system even though it appears that you've only only changed the name and none of the other values within the system's definition. I've been able to replicate this issue using the developer sample for loading shapefiles, which I've included in the attachments. Is there a reason why you're needing to use the custom name for this system? Everything appears to work fine if I use the exact definition as shown in the documentation. Projected Coordinate Systems Projected coordinate systems—ArcGIS Runtime SDK for .NET | ArcGIS for Developers PROJCS["RGF_1993_Lambert_93",GEOGCS["GCS_RGF_1993",DATUM["D_RGF_1993",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",700000.0],PARAMETER["False_Northing",6600000.0],PARAMETER["Central_Meridian",3.0],PARAMETER["Standard_Parallel_1",44.0],PARAMETER["Standard_Parallel_2",49.0],PARAMETER["Latitude_Of_Origin",46.5],UNIT["Meter",1.0]]
... View more
11-10-2015
09:28 AM
|
0
|
0
|
629
|
|
POST
|
The Collect Values tool would not be valid input for the Clip tool. In the above model you're using the iterator to select each feature. This selected feature is used within the Clip tool and the output name of the resulting clip feature uses a chosen value from the selected feature. I would think in this case if you wanted to use Collect Values you'd be wanting to create a collection of the shapefiles created by the iterator. I've included a screenshot of how this model would work on my machine. The screenshot contains comments on the logic behind each tool used within the model.
... View more
11-10-2015
08:59 AM
|
0
|
1
|
1997
|
|
POST
|
I'm not sure if the bug I logged would be applicable for this. I've also never seen this error. Do you have access to Esri Support so that you can have a case logged for this to determine if we can replicate this in-house?
... View more
11-10-2015
08:26 AM
|
0
|
2
|
1986
|
|
POST
|
I believe that there is enough information on the Esri website for you to be able to quickly put a sample together. The hard part would be if you're not familiar with programming and have to also learn C# or VB.Net. If you install Visual Studio on your machine I don't mind writing up a quick application that you can use to load the packages.
... View more
11-06-2015
12:22 PM
|
0
|
2
|
1261
|
|
POST
|
Do you have access to Visual Studio or are you looking for a deployed application that would allow you to test this?
... View more
11-06-2015
10:58 AM
|
0
|
4
|
1261
|
|
POST
|
You can accomplish this within an edit session. You just need to close the line or polygon after creating the 3rd vertex. Introduction to the Editing Tutorial (Version 10.3.X) http://desktop.arcgis.com/en/desktop/latest/manage-data/editing-fundamentals/introduction-to-the-editing-tutorial.htm Editing Geodatabases Tutorial (9.3.X) http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=Editing_Geodatabases_Tutorial
... View more
11-05-2015
06:41 PM
|
1
|
3
|
1746
|
|
POST
|
I haven't tried, but I would think that you'd have to leverage the GeoEnrichment Service if you don't have the datasets available. Esri GeoEnrichment https://developers.arcgis.com/en/features/geo-enrichment/ There are probably also other APIs available online that may also provide this information. Google Places https://developers.google.com/places/web-service/search
... View more
11-05-2015
06:27 PM
|
0
|
0
|
478
|
|
POST
|
Hi Nigel, I only had about 20 minutes to actually test this out today so I'm going to update you with my assumptions based on what I've seen so far. I'm thinking that there may be a bigger problem at play here. Everything works fine for me when I output the tables to a file geodatabase. When I change the output workspace to an enterprise geodatabase thing begin to fail. I ran a quick test in ArcMap and the Table to Geodatabaase tool is also failing there when the output workspace is an enterprise geodatabase. I'm not sure if there is something wrong with my enterprise geodatabase or if the tool is having a problem with the sde naming conventions. I've pasted the code I used to test below. You should be able to modify it and test it on your machine. Could you let me know if you're able to get the Table To Geodatabase tool to work from ArcMap? using System;
using System.Collections.Generic;
using ESRI.ArcGIS.ConversionTools;
using ESRI.ArcGIS.DataManagementTools;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Geoprocessing;
using ESRI.ArcGIS.Geoprocessor;
using Path = System.IO.Path;
namespace TransportTable
{
class Program
{
private static readonly LicenseInitializer m_aoInit = new LicenseInitializer();
private static readonly Dictionary<string, string> m_connProps = new Dictionary<string, string>
{
{"SERVER", "uzumaki"},
{"INSTANCE", @"sde:sqlserver:uzumaki\express2014"},
{"DBCLIENT", "SQLSERVER"},
{"DATABASE", "gdb"},
{"AUTHENTICATION_MODE", "DBMS"},
{"USER", "sde"},
{"PASSWORD", "sde"},
{"VERSION", "sde.DEFAULT"}
};
static readonly string m_gdbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"ArcGIS\Default.gdb");
const string m_tblName = "MyCitiez";
static readonly string m_gdbPathOut = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "MyGDBData.gdb");
static readonly string m_sdePathOut = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "ConnToSDE.sde");
[STAThread()]
static void Main(string[] args)
{
//ESRI License Initializer generated code.
m_aoInit.InitializeApplication(new [] { esriLicenseProductCode.esriLicenseProductCodeAdvanced }, new esriLicenseExtensionCode[] { });
var in_ws = OpenWorkspace(m_gdbPath) as IFeatureWorkspace;
var table = in_ws.OpenTable(m_tblName);
var outGdbWs = OpenWorkspace(m_gdbPathOut);
var outSdeWs = OpenWorkspace(m_connProps);
foreach (var workspace in new [] {outGdbWs, outSdeWs})
{
foreach (var workflow in new [] {Workflow.UseObjects, Workflow.UseStrings})
{
Console.WriteLine("WORKSPACE IS {0} AND WORKFLOW USES {1}", workspace.WorkspaceFactory.WorkspaceType, workflow == Workflow.UseObjects ? "OBJECTS" : "STRINGS");
ExportToTable(table, workspace, workflow);
}
}
Console.WriteLine();
Console.Write("Press enter to exit...");
Console.ReadLine();
//ESRI License Initializer generated code.
//Do not make any call to ArcObjects after ShutDownApplication()
m_aoInit.ShutdownApplication();
}
private static void ExportToTable(ITable inTable, IWorkspace outWorkspace, Workflow workflow)
{
var fws = outWorkspace as IFeatureWorkspace;
if ((outWorkspace as IWorkspace2).NameExists[esriDatasetType.esriDTFeatureClass, (inTable as IDataset).BrowseName])
{
var table = fws.OpenTable((inTable as IDataset).BrowseName) as IDataset;
if (table.CanDelete())
table.Delete();
}
Geoprocessor gp = new Geoprocessor {OverwriteOutput = true};
try
{
TableToGeodatabase tool;
//TableToTable tool;
if (workflow == Workflow.UseStrings)
{
Console.WriteLine("*** USING OBJECTS ***");
tool = new TableToGeodatabase
{
Input_Table = inTable,
Output_Geodatabase = fws
};
//tool = new TableToTable
//{
// in_rows = inTable,
// out_path = workspace,
// out_name = (inTable as IDataset).BrowseName
//};
}
else
{
Console.WriteLine("*** USING STRINGS ***");
var tuul = new CreateDatabaseConnection
{
out_folder_path = Path.GetDirectoryName(m_sdePathOut),
out_name = Path.GetFileName(m_sdePathOut),
database_platform = "SQL_SERVER",
instance = m_connProps["INSTANCE"],
account_authentication =
m_connProps["AUTHENTICATION_MODE"] == "DBMS" ? "DATABASE_AUTH" : "OPERATING_SYSTEM_AUTH",
username = m_connProps["USER"],
password = m_connProps["PASSWORD"],
save_user_pass = "SAVE_USERNAME",
database = m_connProps["DATABASE"],
version = m_connProps["VERSION"]
};
var rezult = gp.Execute(tuul, null) as IGeoProcessorResult2;
gp.ClearMessages();
tool = new TableToGeodatabase
{
Input_Table =
string.Format(@"{0}\{1}", (inTable as IDataset).Workspace.PathName,
(inTable as IDataset).BrowseName),
Output_Geodatabase =
outWorkspace.WorkspaceFactory.WorkspaceType == esriWorkspaceType.esriLocalDatabaseWorkspace
? outWorkspace.PathName
: rezult.GetOutput(0).GetAsText()
};
//tool = new TableToTable
//{
// in_rows = string.Format(@"{0}\{1}", (inTable as IDataset).Workspace.PathName, (inTable as IDataset).BrowseName),
// out_path = rezult.GetOutput(0).GetAsText(),
// out_name = (inTable as IDataset).BrowseName
//};
}
var result = gp.Execute(tool, null) as IGeoProcessorResult2;
Console.WriteLine(result.GetMessages(0));
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
object sev = 2;
Console.WriteLine(gp.GetMessages(ref sev));
}
finally
{
Console.WriteLine("");
Console.WriteLine("##############################");
Console.WriteLine("");
}
}
private static IWorkspace OpenWorkspace(string wsPath)
{
var factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.FileGdbWorkspaceFactory");
var wsFactory = Activator.CreateInstance(factoryType) as IWorkspaceFactory;
if (System.IO.Directory.Exists(wsPath))
return wsFactory.OpenFromFile(wsPath, 0);
var wsName = wsFactory.Create(Path.GetDirectoryName(wsPath), Path.GetFileName(wsPath), null, 0);
var name = wsName as IName;
return name.Open() as IWorkspace;
}
private static IWorkspace OpenWorkspace(Dictionary<string, string> ConnProps)
{
var factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.SdeWorkspaceFactory");
var wsFactory = Activator.CreateInstance(factoryType) as IWorkspaceFactory;
var propset = new PropertySetClass();
foreach (var prop in ConnProps)
propset.SetProperty(prop.Key, prop.Value);
return wsFactory.Open(propset, 0);
}
}
enum Workflow
{
UseStrings,
UseObjects
}
}
... View more
11-05-2015
05:15 PM
|
1
|
1
|
869
|
|
POST
|
I would assume the code is failing because of how you're setting the input_table parameter of the tool. It looks like you're using the name of the feature class and not the path to it on disk. I wouldn't expect this to work because within the code you didn't set the current workspace to your geodatabase. I would suggest either supplying the ITable to the tool, providing the full path to the table, or setting the environment variable so that you can utilize the name of the feature class (I'd think you'd want to use IDataset.BrowseName instead of the AliasName). Also, you'll want to avoid create the SdeWorkspaceFactory with the call to new SdeWorkspaceFactory. You'll want to use the activator to create an instance of this class. This is documented on the following page: Interacting with singleton objects http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/#/Interacting_with_singleton_objects/00010000043p000000/
... View more
11-05-2015
03:02 PM
|
1
|
0
|
869
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-19-2016 04:45 AM | |
| 1 | 09-24-2015 06:45 AM | |
| 1 | 09-15-2015 10:49 AM | |
| 1 | 10-12-2015 03:07 PM | |
| 1 | 11-25-2015 09:10 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|