Tag Info

New answers tagged

0

Solved! I start the process from layout view, but the script automatically switches to data view to turn various layers on/off. The issue was caused by the difference in scale when switching between views (still odd that the map was correct, just not the extent indicator!). I've corrected the issue by noting the scale at the start of the script and forcing ...


1

This should work: import arcpy, os, sys InFolder = sys.argv[1] OutFolder = sys.argv[2] arcpy.env.workspace = InFolder for ThisRas in arcpy.ListRasters(): arcpy.MakeRasterLayer_management (ThisRas,"Layer"); arcpy.SaveToLayerFile_management("Layer",OutFolder + "\\" + ThisRas + ".lyr",True,"CURRENT"); arcpy.Delete_management("Layer") It ...


0

Add all of your Tiffs to map by dragging them from ArcCatalog. then use this code in python windows: import arcpy from arcpy import env mxd = arcpy.mapping.MapDocument("CURRENT") env.workspace = "d:/Layers" for lyr in arcpy.mapping.ListLayers(mxd): print lyr.name try: arcpy.SaveToLayerFile_management(lyr, lyr.name + ".lyr", "RELATIVE") ...


0

Thanks for your input and ideas. I have solved it by giving the same field name ("SJ_count") in my input feature classes X1, X2, X3. After the join I altered the field name using the in-line variable substution string (count_name) given with the iterator as my addition. So my new field name became "SJ_count_%count_field%). An example of a field name woud ...


1

You should use Print Conductor for Batch Printing documents. I use it daily for my batch PDF Printing work. It prints all files at once with its DRAG and Drop feature. You can just select multiple folders or files and get them printed. Go to www.print-conductor.com to download the Print-Conductor


1

I can see that multiple comments aren't being understood. This is what I meant: import os,arcpy from arcpy import env mxd = arcpy.mapping.MapDocument("CURRENT") #arcpy.env.overwriteOutput = True fieldName = "RasterID" RowsField = "unknown" # the field (numeric) for the number of rows ColsField = "unknown" # the field (numeric) for the number of columns ...


1

You can do it using QGIS, this way: Open QGIS and open the QGIS Python console (Plugins->Python console). Check the following Python code snippet. Adjust the lines below the block Settings (i.e., myDir, myTargetDir, refSys, separator, xField, and cyField) to configure your own data: import os import glob # Settings myDir = '/path/to/txt/files/' # For ...


1

Make XY Event Layer is the tool you're looking for. You could import your text files into a file geodatabase and iterate through the feature classes, creating a new feature layer for each of your text files.


1

As @Michael Miles-Stimson has commented your calculate field method will overwrite all row values each loop through the raster list method. So, the table will only have one raster name for each record. In addition, it is unclear from your question if the update table has an equal number of rows for rasters that exist within the directory. If you are ...


0

What you are showing in the image is Join Field tool in batch mode (it is not a model created with model builder). So I think there is misunderstanding here! To achieve your goal do these steps: create an empty model Go to Insert > Iterators > Feature Classes Double click on "Iterate Feature Classes" tool and select your workspace (which contains your ...


0

A couple things to consider about your problem: GRID files can only be 9 characters long. GRID files like to have lots of associated files with them, and model builder doesn't do a very good job of cleaning them up after processes have been run. That said, I offer 3 solutions, since I have faced the exact same problem. I wasn't doing euclidean distances ...


2

For doing so, you need to i) remove the layer from the ToC, ii) rename the files that conform the Shapefile (i.e., shp, dbf, shx, prj, and the like), and iii) load the renamed layer to QGIS. If you look at it, it's similar to what the Table Manager plugin does. So, I adapted such code to rename Shapefiles, you can download it from here. You can run it this ...


0

Here is one option: Merge all common shps together in ArcGIS or QGIS (preferred to merge to gdb feature class) If you have QGIS installed you may use ogr2ogr command using OSGeo4W shell command utility to load to your pg database, e.g. For single table(s) in gdb ogr2ogr -f "PostgreSQL" PG:"host=serverName.xyz.com port=54321 user=userName dbname=mydbname ...


1

Solution -- import arcpy from arcpy import env arcpy.env.workspace = r"C:\VMshared\small_example_valley3\SnowDepth3" arcpy.env.overwriteOutput = True layerList = arcpy.ListFiles("*.tif.lyr") symbologyLayer = r"C:\VMshared\small_example_valley3\SnowColor2\snowdepthCOLOR.tif.lyr" for lyr in layerList: ...


1

To your first question: how can I use the arcpy.mapping.ListLayers() function without calling the current mxd? I would say the answer is to use something like: mxd = arcpy.mapping.MapDocument(r"C:\temp\test.mxd") for lyr in arcpy.mapping.ListLayers(mxd): print lyr.name # Added to show that ListLayers is working in place of: mxd = ...



Top 50 recent answers are included