Tag Info

Hot answers tagged

7

If you have the XY of the point, then you could create a PointGeometry. current_sr = arcpy.SpatialReference(102726) #Enter the current WKID for the point new_sr = arcpy.SpatialReference(4326) #This is the WKID for WGS84 point = arcpy.PointGeometry(arcpy.Point(7334719, 670307), current_sr) new_point = point.projectAs(new_sr) >>> ...


5

What you are doing works just fine. This is pretty much the same code but as a more elegant solution: flds = [f.name for f in arcpy.ListFields(lyr)]


3

As a test I suggest trying to change: outname = str(fc) + parish + ".xls" to outname = 'C:\\Parishes\\' + str(fc) + parish + ".xls" I suspect that trying to write a *.xls to a *.gdb (even though that is a folder) is what may be upsetting the tool.


3

Honestly, there's quite a bit wrong. I tried to do a quick cleanup, but admit I didn't test it: # Import arcpy module import arcpy import os # Set workspace arcpy.env.workspace = "E:\\GIS\\1.gdb" # Set the spatial reference sr1 = arcpy.SpatialReference("WGS 1984") sr2 = arcpy.SpatialReference("NAD 1927") sr3 = arcpy.SpatialReference("NAD 1983") # Set ...


3

You do not need the [0] brackets here on this statement: if photolink[0][:4] == "http": That would return "h" only and not "http" TRY if photolink[:4] == "http": The new arcpy.da.UpdateCursor in v10.1 and greater uses bracket indexes to relate to defined field(s) and also is faster since it does not iterate over each fc field. with ...


2

Hmm that is strange. Does this return True? >>> import arcpy >>> 'GetNAClassNames' in dir(arcpy.na) True I don't know how it could be missing, perhaps something could have gone wrong during your install?


2

If I understand the question, you are trying to have the same layout but have the map pan to each grid cell for printing to pdf. What version of ArcGIS are you using? At 10.x you can use data driven pages for this task. http://resources.arcgis.com/en/help/main/10.1/index.html#//00s90000003n000000 What is the purpose of clipping everything? As a faster ...


2

To solve this bad behaviour of arcgis folder parameter processing, you need to string escaped the string that comes from the tool parameter. For this, simply add this line: dest_root = parameters[0].value #ouputs C:\Users\678910\Documents dest_root = unicode(dest_root).encode('unicode-escape') #outputs C:\\Users\\678910\\Documents And one problem with ...


2

I think The best way would be to embed your spatial references into your list as sub-lists, i.e.: input = [["WGS84.xlsx",sr1],["NAD83.xlsx",sr2],["WGS84.xlsx",sr3],["Long_0_or_blank.xlsx",sr1]] Then update your script to (note use of ss[]): for ss in input: try: # ... Table1 = arcpy.ExcelToTable_conversion(textPath1 + ss[0], textPath3 ...


2

You won't be able to overwrite a feature class if it is locked in another application (such as when you have it open in ArcMap) or if any other user has accessed it. If you would have 10.1, you can check what are the connections established to the geodatabase (Connections tab under Geodatabase Administration). You could use arcpy: You can use ...


2

@PolyGeo's answer is accurate. But I just want to draw attention to the use of table views in the original case; they shouldn't be necessary. Code could be simplified down to something like this: import arcpy import os arcpy.env.workspace = r'C:\Parishes\Cameron.gdb' parish = "Cameron" # use other folder as needed out_folder = arcpy.env.scratchFolder ...


2

There's a few little problems here.. expanding on my comment you must release your cursor before using it again I have edited your code with the appropriate del statements and comments: import arcpy, math, sys, traceback # Condense onto one line from arcpy import env # you're not using this, why import it? class test: def __init__(self, workSpace): ...


2

Chad Cooper is right. change Text Field Length in Field Mapping. Make sure your length doesn't exceed your ouput workspace (FileGeodatabase, SDE, DBF) text field length limitation


2

Looks like there are 4 scenarios: Null values, empty values, http link values, and all other values, which you will turn into file paths. Whenever you use elif, you should really finish with an else, to catch all the remaining possibilities. This is what I would recommend for you: You can combine the first two tests, use rstrip in case a value is a single ...


1

Check that the workspace you're using exists. Using a list function when the workspace environment does not exist or is set to None (workspace's default setting in stand-alone Python) will return None. As pointed out in the comments this is not ideal (a List function should ideally generate an exception if the workspace doesn't exist).


1

You can do this is the following way: Run a spatial join to create a temporary dataset, you need to do this as this gives the ID relation you want, well ID X is on polyline ID Y. Create a standalone table from this spatial join which has nothing more than your polyline ID, Well ID and Flow volume. Join this table to your geometric network layer Run a ...


1

A few things here, not all of them might be contributing to the problem, but all of them strike me as a possible issue. arcpy.da.SearchCursor gets opened, but only one record is ever accessed (there is no for loop on cursor, or multiple .next() calls.) with arcpy.da.SearchCursor(aTable, return_flds, where_clause=where_str, sql_clause=sql_clause) as cursor: ...


1

There are several ways of successfully formatting values for a tool that accepts multivalues in Python. A semi-colon delimited string of data is a valid input for any geoprocessing parameter that accepts multiple inputs. This is valid, and is what you will be getting from GetParameterAsText on a multivalue parameter. A list of strings of the feature ...


1

try parameter = arcpy.GetParameter(1) inputLayers = parameter.values() This should give you the different layers as a list Afterwards you can access the individual layers by index or in a loop layer = inputLayers[0] or for layer in inputLayers: (do something with your layer)


1

Here is my solution... open in arcmap the suspect layer. zoom to the entire dataset. make it the only selectable layer (if there is more than one) start editing make a selection box around all of the features switch the selection you now have all the <NULL> geometry rows in the sde table. delete


1

The caching tools that exist in the ArcToolbox on Desktop simply make calls to the Caching tools that have been already published on the Server. If your workflow involves updating a cache through these tools, simply call the tools on Desktop, or call the already published tools on the Server. Publishing these tools as their own GP Service introduces an ...


1

First ensure that the input and target raster contain the same number of bands. pixel_type (1_BIT) You must set the pixel type to match your existing input raster datasets. If you do not set the pixel type, the 8-bit default will be used and your output may be incorrect. I suggest to run this tool from GUI (ArcMAP) and after a successful run, extract ...


1

The first three paragraphs of your scenario certainly fall under the unsupported category. It seems like you could add a step in your py script to create a child version of your child version immediately after your data load, and leave it there for your business needs. To answer your final question, no. Version state ID incrementation is not always current ...



Only top voted, non community-wiki answers of a minimum length are eligible