Tag Info

Hot answers tagged

10

You're using an arcpy.da.UpdateCursor. It by definition and design returns rows as lists, not as row objects. You need to use an arcpy.UpdateCursor if you want row objects. The old arcpy objects from 10.0 like arcpy.*Cursor are still there in 10.1 and still behave as expected. You can even use the old 9.3 arcgisscripting APIs and they'll still work the ...


9

newarray = array * 2.0 performs the math on the entire array, not just on one element. It should instead be something like this: raster = arcpy.Raster(r"C:\test.jpg") array = arcpy.RasterToNumPyArray(raster) # modify cell array[0,0] *= 2.0 # save to a new raster newraster = NumPyArrayToRaster(array) newraster.save(r"C:\export.gdb\t") Or, if you want ...


6

Not fully dynamic, but in general this python code snippet will update a text element with the topmost layer name that is turned on in the defined dataframe: mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] # default Layers dataframe for lyr in arcpy.mapping.ListLayers(mxd, "*", df): if lyr.visible == True: ...


5

Wikipedia defines sinuosity as: the ratio of the curvilinear length (along the curve) and the distance (straight line) between the end points of the curve So to calculate this in ArcGIS, you would need to determine: the curvilinear length of the line. You can use the Field Calculator the start and end points of the line. See this Stack Exchange ...


5

Yes, some of the tools use matplotlib. For example (in my 10.1 install): Multi-Distance Spatial Cluster Analysis (Ripleys K Function) <ArcGIS install folder>\ArcToolbox\Scripts\KFunction.py Incremental Spatial Autocorrelation (Moran's I) <ArcGIS install folder>\ArcToolbox\Scripts\MoransI_Increment.py Ordinary Least Squares <ArcGIS ...


5

You could just use the Dissolve tool based on the L2BLOCK field. Unless I'm misunderstanding.


5

There are a couple of ways I could think of to do it in the Symbology tab, which won't affect your original raster values: Set each of the classes to the same color. Select the five classes you want to consolidate. Right-click, and choose "Group Values." (This is described in "Combining Categories" for grouping vector data, but it also works for raster ...


4

To do this I would use the Intersect (Analysis) tool. The ArcPy code will be: import arcpy homesFC = <your path to input Homes> districtsFC = <your path to input Districts> homesWithDistrictFC = <your path to output> arcpy.Intersect_analysis ([homesFC, districtsFC], homesWithDistrictFC)


4

I think you're missing something in what johns has said in his comment. When you are looking at the symbology for the raster there are two renderers to choose from - stretched and RGB composite. However, on the RGB composite settings there is also a stretch option. You need to set this to None. There are a couple of ways to export a raster. If using the ...


4

It works in the python window because JHJ is likely a layer in the map and therefore can be reference in your script as "JHJ". When run outside of Arcmap, you need to tell arcpy where to look. Here are just a few ways you can do this (untested, but it should give you a few ideas): 1) jhj = ...


4

there are several categories in the utm section of esri crs projected. go to the projected coordinate systems. then to UTM, Then look at the nad83 BLM (US Feet). That should work in both autodesk and esri. (EPSG) 32165


4

You can't give your existing cells a distance to the line feature as in the Point Distance tool for vector points. You can, however, calculate a new raster of distances to the line feature using the Euclidean Distance tool. You will have to ensure that you sent your cell size and snap raster to the original raster, so you get essentially a new raster with ...


3

By using "<FNT name = 'Arial'>" + ' ←' + "</FNT>" + ' Pathway to Moosehide Village ' it came out fine and kept the original font. Thanks for all the suggestions.


3

If you define sinuosity as a measure of the deviation of a line from the shortest path (dividing total length by shortest possible path), on http://www.arcgis.com/home/item.html?id=00e708a448b74810a0e805c4a97f9d46, you can get a python toolbox "Calculate sinuosity" to it. Just download it and load it in ArcToolBox to make the script available. Note that the ...


3

See the Esri help file at http://resources.arcgis.com/en/help/main/10.1/index.html#//0017000000m7000000 which says: The Python result of this tool returns a geoprocessing Result object. In order to obtain the string value, use the Result object's getOutput method. So try using getOutput on your variable a as in the example on that page: import arcpy ...


3

Instead of using the same csvfile1 each time, define a variable that depends on the feature class name. For example: fcList = arcpy.ListFeatureClasses() for fc in fcList: csvFileName = 'CSV_{}.csv'.format(fc) # or just = fc + '.csv' for field in arcpy.ListFields(fc): csvwriter(csvFileName,field.name)


3

With cursors and the csv module, this should go pretty quick: import arcpy, csv, time arcpy.env.workspace = <path to gdb> table_list = arcpy.ListTables() csv_out = <path to csv> #Get name of fields from first entry fields = [x.name for x in arcpy.ListFields(table_list[0])] start = time.time() counter = 0 with open(csv_out, "wb") as f: ...


2

Esri is a little stuck with this because they want to preserve forward compatibility of old Python code people depend on. I really wish they would have changed the default by now though, as we get a lot of queries from users why their scripts fail in background processing -- because the default (VB) is not supported by arcpy 64 bit! Here's an example ...


2

I adapted the solution to move / shift points point into a certain direction (angle) and a given distance. Looks like: def shiftXYCoordinates(shape,angle,distance): point = shape.getPart(0) point.Y += distance * math.cos(math.radians(angle)) point.X += distance * math.sin(math.radians(angle)) return point and be called like shiftXYCoordinates(!SHAPE!, ...


2

When you say that you have imported your CAD drawings into ArcGIS, I am assuming that you now have either file geodatabase feature classes or shapefiles. Consequently you should be able to perform a spatial adjustment transformation on them: Transformations move or shift data within a coordinate system. They are often used to convert data from unknown ...


2

When performing the attribute join in ArcMap, the joined information (that you can see in the attribute table) is stored within a map document (.mxd) file. In order to save joined fields in the new shapefile (so it will have fields for each year you need), you have to export the joined layer from the table of contents. The result shapefile exported on the ...


2

The first error message comes from the fact that your raster is in float, so you have more that 65535 (aka 16bit) possible unique values, but this does not mean that the values is larger than 65535. You should convert your a raster to integer (e.g. with copy raster or with Int(raster) in map algebra tools) if you want to be able to build unique values, but ...


2

This is typically something that you can do with a spatial join. However, you should be aware that you cannot have several lines copied in a single feature : one feature can only store one line. With the spatial join, you can use "one-to-many" in order to duplicate your records when there are several relationships.


2

You can also visualize this by clicking your line symbology in the Table of Contents. Under the Esri line styles, select the symbology called "Arrow at End" and this will show you the directionality of the line.


2

Have you tried making a custom projection? Here is a walkthrough from esri knowledgebase.


2

You are referring to the variables by starting iterating items in your code before you actually declare the variables. The correct syntax would be: #Import arcpy module import arcpy # Local variables: A =['FL_RechargeArea','FL_AquiferProtectionArea','FL_AreaofContribution','GA_RechargeArea','GA_AquiferProtectionArea','GA_AreaofContribution'] B = ...


2

Once you get the shapefile/projection problem solved: Kriging is a method of interpolating points to create a continuous surface. I think that you actually want to use graduated colors to modify the symbology of the points, manually setting classification breaks at the values you need.


2

Open a new dataframe, don't add a basemap, just the shapefile, move your mouse around on the screen and look at the coordinates towards the middle are they small numbers that look like latitude and longitude? Open windows explorer and navigate to your shapefile... look for a *.prj file, if you don't have one, then you are working with data that no ...


2

I believe that you are probably encountering the same problem that has been discussed in the old Esri Discussion Forums under the aptly named title of "True Curves, True Evil". I have a reproducible (but long) test case of this phenomena in a Python/ArcPy script that I used to convince a client that what we were seeing was explainable and could be worked ...



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