POST
|
Hi Michael, sorry to have confused you. Let me elaborate. I have a spatial database (file geodatabase) with my feature classes. Now I want to use arcpy.InsertCursor to write certain information from my feature classes like area and length to tables in an access database (.accdb). My question is: Do I need to connect to the .accdb first and can I then use arcpy.InsertCursor to write that information to it?
... View more
06-20-2013
09:49 AM
|
0
|
0
|
537
|
POST
|
Hi Michael, yes, I am on a 64-bit operating system. Windows 7 Enterprise. The data is stored in a file geodatabase.
... View more
06-20-2013
07:54 AM
|
0
|
0
|
537
|
POST
|
Hi, I have a script that writes data via an InsertCursor to a .mdb. Now that .mdb has been changed into an .accdb and my script does not work anymore. It is giving me an IO error that a specific table is not found. When I look in my .accdb, the table is there. Do I need to connect to this new .accdb with the help of pyodbc? Does a regular insert cursor work then? Your help would be appreciated.
... View more
06-20-2013
07:11 AM
|
0
|
5
|
1196
|
POST
|
Hi Mathew, thanks for your answer. I got another answer that pushed me in the right direction. I have the user make the selection in ArcMap and input this feature class with the selected features as a feature layer in my toolbox tool. In the code, I just had to copy features and then create my feature layer to work with it. Please see the top part of my code attached. import arcpy,os from arcpy import env ws = arcpy.GetParameterAsText(0) pipes = arcpy.GetParameterAsText(1) env.workspace = ws pipesnew = os.path.join(ws,"Pipes") arcpy.CopyFeatures_management(pipes,pipesnew) arcpy.MakeFeatureLayer_management(pipesnew,"lyr")
... View more
06-17-2013
01:42 PM
|
0
|
0
|
210
|
POST
|
Hi, I am trying to write a python script and can't get over the first obstacle. I am on ArcMap 10.1. I want for the user to select features in ArcMap and then use these selected features in a python script. Is there a way to do that? Has somebody attempted that before and has some sample code? The code that I tried does not use the selection, but the whole feature class instead. Please see code snippet below. arcpy.AddMessage("Exporting selected features to working database...") arcpy.MakeFeatureLayer_management(fc1,"fclyr") arcpy.SetParameter(1,"fclyr") fc2 = os.path.join(ws1,"Pipes") arcpy.CopyFeatures_management("fclyr", fc2) Your help would be appreciated. Thanks!
... View more
06-17-2013
07:25 AM
|
0
|
2
|
351
|
POST
|
Hi, what is the best way to prevent someone from reading and editing python code? I tried py2exe, pyinstaller and cx_freeze to create an executable. I got the executables, but they don't run. I also looked into compiling the .py file into a .pyc file, but found on the internet, that these files are relatively easy to decompile. Is importing and password protecting the script my only option? And how safe is that? Thanks
... View more
03-13-2013
01:24 PM
|
0
|
1
|
3546
|
POST
|
Hi Bärbel, just use the field calculator or try the following reworked script: #Feature class: Tab = r'\\Tako\gis\03_basisdaten\pronatura\ch\gisdata\pronatura_1.gdb\Schutzgebiete\parz_pn' orgField = "Bemerkungen" provField = "Bemerkungen_prov" #Adding the new Field: arcpy.AddField_management(Tab,provField,"TEXT", "", "",254) #Copy the information from the original field to the new one: arcpy.CalculateField_management(Tab, provField, orgField, 'PYTHON') That should work, if both fields are text fields. There is no need to convert the field to str first. Thanks, Kat
... View more
08-01-2012
11:47 AM
|
0
|
0
|
537
|
POST
|
Hi Glenn, sorry I did not understand what you meant. This is strange, because it works fine for me. You could hard code the projection in the script itself, if it's the same every time you run the script. Just assign a variable for projection and point to the projection file on your hard drive, instead of using getParameterAsText. Another way of setting a default in toolbox is this: Define the projection parameter as a string and add your default in the value table field. Not very user friendly, but it might work better for you. Thanks, Kat
... View more
08-01-2012
11:13 AM
|
0
|
0
|
1093
|
POST
|
Hi Glenn, it is a little unclear about what you need to do here. Are you trying to get a spatial reference that is not hard-coded in a script? If so, you can get the spatial reference from your input data in the script and then carry it over to the other data you create. This would look like: sr = arcpy.Describe(infc).spatialReference # with infc being your input data Kat
... View more
07-31-2012
02:50 PM
|
0
|
0
|
1093
|
POST
|
Hello, what is the best way to get a feature class or raster name from a geoprocessing tool result? For example: buffer a feature class, get the name of the buffered feature class and write it to a table. The reason behind this, is to use that output feature class name in a new geoprocessing operation. List Rasters and List Feature classes does not work in this case, since I am not interested in all of the Rasters/Fcs in a workspace. Any help will be greatly appreciated. Thanks,
... View more
07-24-2012
02:40 PM
|
0
|
1
|
462
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|