POST
|
I need to write an arcpy script which will allow me to change the layers of a map document to point from a file geodatabase to a sqlite database with the same table names and data. I was able to use the following to migrate from a gdb to a sql server database: import arcpy mxd = arcpy.mapping.MapDocument(r"C:\test\mytestmap.mxd") mxd.replaceWorkspaces(r"C:\test\src.gdb","FILEGDB_WORKSPACE",r"C:\test\dest.sde","SDE_WORKSPACE") mxd.SaveACopy(r"C:\test\newmap.mxd") I tried to do the same with this code: import arcpy mxd = arcpy.mapping.MapDocument(r"C:\test\mytestmap.mxd") mxd.replaceWorkspaces(r"C:\test\src.gdb","FILEGDB_WORKSPACE",r"C:\test\dest.sqlite","SDE_WORKSPACE") mxd.SaveACopy(r"C:\test\newmap.mxd") I have tried to use the destination workspace as SDE_WORKSPACE,FILEGDB_WORKSPACE, and TEXT_WORKSPACE, but i only get "ValueError: MapDocObject: Unexpected error" Is there another way to do this work or am I missing a step? I need to do a batch of documents and will need to do it again in the future, so a script is the best way to proceed, if I can. Steve
... View more
02-18-2020
03:19 PM
|
0
|
0
|
227
|
POST
|
I need to write an arcpy script which will allow me to change the layers of a map document to point from a file geodatabase to a sqlite database with the same table names and data. I was able to use the following to migrate from a gdb to a sql server database: import arcpy mxd = arcpy.mapping.MapDocument(r"C:\test\mytestmap.mxd") mxd.replaceWorkspaces(r"C:\test\src.gdb","FILEGDB_WORKSPACE",r"C:\test\dest.sde","SDE_WORKSPACE") mxd.SaveACopy(r"C:\test\newmap.mxd") I tried to do the same with this code: import arcpy mxd = arcpy.mapping.MapDocument(r"C:\test\mytestmap.mxd") mxd.replaceWorkspaces(r"C:\test\src.gdb","FILEGDB_WORKSPACE",r"C:\test\dest.sqlite","SDE_WORKSPACE") mxd.SaveACopy(r"C:\test\newmap.mxd") I have tried to use the destination workspace as SDE_WORKSPACE,FILEGDB_WORKSPACE, and TEXT_WORKSPACE, but i only get "ValueError: MapDocObject: Unexpected error" Is there another way to do this work or am I missing a step? I need to do a batch of documents and will need to do it again in the future, so a script is the best way to proceed, if I can. Steve
... View more
10-24-2019
09:36 AM
|
0
|
1
|
337
|
POST
|
In ArcMap, I can create a layer, and assign it a single symbol and then under "Advanced" -> Transparency and assign a field name to be the percentage. I am trying do that in c#. I have not seen any code samples to do something like this. I tried by creating a SimpleRenderer, assigned it a SimpleFillSymbol, and then casted the SimpleRenderer as type ITransparencyrenderer and set the transparency field to the data field in the layer. But, the transparency does not appear.
... View more
03-07-2017
04:03 PM
|
0
|
0
|
641
|
POST
|
I have a web map where I have a base layer with the states, and a feature layer with several dozen polygons. I have set the identity function (which for this app is always on for a single click) to use the feature layer. I am wondering if it is possible to detect when there is a feature that the cursor is going over, and then change it to indicate there is data on it, and when the user moves off of the feature, and there is nothing there, it changes back to the default cursor.
... View more
10-24-2016
04:39 PM
|
0
|
2
|
3300
|
POST
|
I was wondering if there are any samples for interacting with SQLite/spatialite with c#. I understand how to use the filegdbworkspacefactory that allows me to specify a file to create a workspace, and then from there I can get to the feature classes. I do not see any workspace factories that seem to support SQLite and Spatialite. In this case, I need to manipulate several feature classes and geoprocessing functions. I know how to create the database both in c# ado.net code and arcpy createsqlitedatabase. But no such luck on accessing the feature classes. In the past, it was simple with the workspace factories, but I need to know how to do it with the SQLite database engine. Any help or suggestions or links to a code snippet would be appreciated. Steve Paplanus
... View more
06-27-2015
11:43 PM
|
0
|
1
|
4087
|
POST
|
I am stumped. I have a sql server database, and I have a table with valid geometry fields. I am able to define the ISqlWorkspace, and build the IQueryDescription by doing a "select * from maptable" (and I have tried specifiying manually the fields, no change. I am able to retrieve the column names and values via the SqlWorkspace.GetColumns() call. But when I try to take this queryDescription and SqlWorkspace, I am unable to cast it to a featureclass. Is there any samples or tutorials or ideas on how to make the MapControl to display a table with Sql Server 2008 R2 Spatial's geometry column in c# or vb.net? Any help would be appreciated. Steve
... View more
05-11-2012
11:57 AM
|
0
|
0
|
2439
|
POST
|
I am receiving an error : Unable to cast COM object of type 'System.__ComObject' to interface type 'ESRI.ArcGIS.Geodatabase.IFeatureClass'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{D4803EE6-79F4-11D0-97FC-0080C7F79481}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)). when I execute: " IFeatureClass queryFClass = (IFeatureClass)queryClass; " I am following the sample code I found for creating a query layer that is extracting data from an Sql Server 2008 spatial database that I want to add to the ESRI AxMapControl. I am not sure why it is failing, and any suggestions would be helpful. Here is the code: // Create the SQL workspace factory Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.SqlWorkspaceFactory"); IWorkspaceFactory wsFact = (IWorkspaceFactory)Activator.CreateInstance(factoryType); // Set the connection properties IPropertySet connectionProps = new PropertySet(); connectionProps.SetProperty("dbclient", "SQLServer"); connectionProps.SetProperty("serverinstance", "rixen"); connectionProps.SetProperty("authentication_mode", "OSA"); connectionProps.SetProperty("database", "Test_iBet"); string s1 = string.Empty; // Open the workspace IWorkspace ws = wsFact.Open(connectionProps, 0); ISqlWorkspace sqlWS = (ISqlWorkspace)ws; try { // Create a QueryDescription to get the spatial data IQueryDescription queryDescription = sqlWS.GetQueryDescription("select * from FY2012Activities"); queryDescription.OIDFields = "PID"; IStringArray columnNames = null; IStringArray columnTypes = null; IVariantArray areNullable = null; ILongArray columnSizes = null; ILongArray columnPrecisions = null; ILongArray columnScales = null; sqlWS.GetColumns("FY2012Activities", out columnNames, out columnTypes, out areNullable, out columnSizes, out columnPrecisions, out columnScales); // The arrays are all the same size, so this is safe, and as a sanity check. This does return all the columns from FY2012Activites table. for (int i = 0; i < columnNames.Count; i++) { Console.WriteLine("Name: {0}", columnNames.get_Element(i)); Console.WriteLine("Type: {0}", columnTypes.get_Element(i)); Console.WriteLine("Is Nullable: {0}", areNullable.get_Element(i)); Console.WriteLine("Size: {0}", columnSizes.get_Element(i)); Console.WriteLine("Precision: {0}", columnPrecisions.get_Element(i)); Console.WriteLine("Scale: {0}", columnScales.get_Element(i)); } string newName = string.Empty; ITable queryClass = sqlWS.OpenQueryClass(newName, queryDescription); IFeatureClass queryFClass = (IFeatureClass)queryClass; // Get a feature layer from the feature class //IFeatureClass fCls = queryClass as IFeatureClass; IFeatureLayer fLyr = new FeatureLayer(); fLyr.FeatureClass = queryFClass; // Add the layer to the map control mapControl.AddLayer(fLyr); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); }
... View more
05-05-2012
05:32 PM
|
0
|
0
|
2217
|
POST
|
Is it possible to programatically create a new feature layer and then add that to the geodatabase inside the map package and add it as a layer on the map document? Steve
... View more
01-18-2012
12:10 PM
|
0
|
0
|
589
|
POST
|
I have a utility library to support that supports two ArcEngine programs. I need to implement in WCF that also has geoprocessor calls. Do I need to call ESRI.ArcGIS.Runtime.Bind in each library function that contains an geoprocessor and/or ArcObjects? Do I need to also call aoInitialize.Initialize in each function with a geoprocessor/arcobjects and do a aoInitialize.Shutdown at the end of the function call? Any clarification on proper usage would be appreciated. Steve
... View more
01-18-2012
06:22 AM
|
0
|
0
|
659
|
IDEA
|
There needs to be a clean way of integrating the ease of use of Python with class libraries written in .NET. This would enable routines and utilities that have been written outside of the "Arc" world to be accessible to arc.
... View more
08-06-2010
03:25 PM
|
7
|
1
|
414
|
POST
|
I have a python script, and I need to call an external .net dll that has a series statistical functions to finish processing my assessment. Is it possible to call a .NET dll from python or modelbuilder, and how would you do it? The dll has no UI classes, just straight processing code. Any help or suggestion would help. Steve
... View more
07-27-2010
04:37 PM
|
0
|
1
|
1861
|
Title | Kudos | Posted |
---|---|---|
7 | 08-06-2010 03:25 PM |
Online Status |
Offline
|
Date Last Visited |
07-28-2022
04:03 PM
|