|
POST
|
To address your basic problem of concatenating list items, you can use .join(): Strings: >>> myList = ['1','2','3','4']
>>> ''.join(myList)
'1234' Integers (uses map(), which first calls str() for each item in myList): >>> myList = [1,2,3,4]
>>> ''.join(map(str,myList))
'1234'
... View more
06-01-2015
09:34 AM
|
1
|
0
|
1592
|
|
POST
|
Untested, but I believe you can run Select Layer By Attribute, specifying CLEAR_SELECTION as the selection type.
... View more
05-29-2015
03:22 PM
|
1
|
1
|
2001
|
|
POST
|
The following Python script will dump the table in the feature layer 'fc' to the csv file 'outCSV': >>> import csv
... fc = "points"
... outCSV = r'C:/junk/myNewCSV.csv'
... with open(outCSV, 'w') as csvfile:
... csvwriter = csv.writer(csvfile, delimiter=',')
... with arcpy.da.SearchCursor(fc,"*") as cursor:
... for row in cursor:
... csvwriter.writerow(row)
... View more
05-28-2015
02:24 PM
|
3
|
0
|
2327
|
|
POST
|
You could try this tool set, or write your own in Python using the csv library.
... View more
05-28-2015
02:03 PM
|
0
|
2
|
2327
|
|
POST
|
I don't believe you need all the quotes around the \n's: outFile.write('x is ' + str(X) + 'meters,\n Y is' + str(Y) + 'and \n ipsos is' + str(IPSOS))
... View more
05-28-2015
01:57 PM
|
2
|
7
|
3784
|
|
POST
|
Here is the help for exporting tables. Hint: change the "Save as type" to 'Text File'.
... View more
05-28-2015
01:53 PM
|
2
|
4
|
2327
|
|
POST
|
Check that your input shapefile indeed has a field called 'OID' and not the more usual 'FID' field. Compare: >>> arcpy.env.workspace = r"C:\junk"
... input = "points"
... fields = ['heading','distance']
... with arcpy.da.SearchCursor(input,fields,"OID = 1") as cursor:
... for row in cursor:
... print row
...
Runtime error
Traceback (most recent call last):
File "<string>", line 5, in <module>
RuntimeError: A column was specified that does not exist.
>>> arcpy.env.workspace = r"C:\junk"
... input = "points"
... fields = ['heading','distance']
... with arcpy.da.SearchCursor(input,fields,"FID = 1") as cursor:
... for row in cursor:
... print row
...
(192, 533)
... View more
05-28-2015
01:43 PM
|
2
|
10
|
3784
|
|
POST
|
You seem to be getting frustrated, to put it mildly, so my first advice is to take a break and get a fresh start some other time. Other than that, here is exactly how I georeference images. 1.) Open your image outside ArcMap or print your image so you can look at it. 2.) Start up ArcMap. Make sure the georeferencing toolbar is added. 3.) Add some georeferenced data that you will use to match your image to. There must be some common features between this data layer and your image so that you can make a match (you must make at least three matches). 4.) Add your image using the Add Data button. The image should appear in the Table of Contents and in the dropdown portion of the georeferencing toolbar. Make sure the image is the selected layer in the dropdown portion of the georeferencing toolbar. 5.) Zoom the map so that your georeferenced data (from step 3) is approximately showing the area in your image. 6.) In the georeferencing toolbar, under 'Georeferencing' menu, choose fit to display. Your image should appear, but it's not georeferenced yet. 7.) Find one of the common features on your image. Click the 'Add Control Points' button in the georeferencing toolbar. Click on the image on the common feature to add the first control point. Click the common feature from your georeferenced data to place the second control point. Now you've matched one of your common features between the image and 'the world'. You can click the 'View Link Table' button on the georeferencing toolbar to convince yourself. In fact, get familiar with the link table - this is where you can delete control points when you make a mistake. 8.) Repeat step 7 at least 2 more times with other pairs of common features. You must make at least 3 matches. Try to spread them out across your image. At some point, usually less than 10 matches, the more matches you make, the worse your georeferencing will be, so don't overdo it. 9.) When you're satisfied, click 'Update Georeferencing' under the 'Georeferencing' menu on the georeferencing toolbar. That's it! This was a very long-winded way to say: use the georeferencing toolbar to match common features using control points.
... View more
05-27-2015
02:23 PM
|
2
|
0
|
3104
|
|
POST
|
Do not try to nest old-style cursors. They behave erratically, at best. However, arcpy.da cursors nest properly.
... View more
05-27-2015
01:12 PM
|
3
|
0
|
1868
|
|
POST
|
Just a demo of Curtis' point. The workspace environment is only used when it hasn't been overridden by a full path: >>> arcpy.env.workspace = r'C:\junk\File_GDB.gdb'
>>> out_shape = r'C:\junk\out_shape.shp'
>>> in_shape = r'C:\junk\points.shp'
>>> arcpy.Buffer_analysis(in_shape,out_shape,"50 METERS")
<Result 'C:\\junk\\out_shape.shp'>
>>> arcpy.Buffer_analysis(in_shape,'buffer',"50 METERS")
<Result 'C:\\junk\\FILE_GDB.gdb\\buffer'>
... View more
05-26-2015
09:38 AM
|
1
|
0
|
2277
|
|
POST
|
most if not all DBMSes do not guarantee the ordering of results unless you use an ORDER BY clause I've seen this statement before and I don't doubt that, technically, it may be true. However, I've never seen an example demonstrating this, never witnessed an Update Cursor returning records out of order myself, and never been provided with any measure of how often this may occur. I have just created 1 million records in a shapefile (of course, this creates an autonumbered FID), numbered them separately with an Update Cursor counter ("order not guaranteed"), and calculated the difference to a new field. Repeated 10x. In all cases, every single row returned difference of zero. I'm not sure: perfect out of ten million seems good to me, and I do realize that "big data" wants to be perfect every time (I don't want to be a credit card company's billionth transaction that messes up), but for static data that you can check, I'd just trust an Update Cursor.
... View more
05-25-2015
09:57 AM
|
2
|
1
|
2423
|
|
POST
|
Oh, you're right, yes, you would. Read too fast. As Blake is getting at, you would first have to either collect the first or max value (whichever you want) into a variable and then run through the cursor: row[0] = maxValue - (counter * 5)
counter = counter + 1
cursor.updateRow(row)
... View more
05-22-2015
10:47 AM
|
2
|
0
|
2423
|
|
POST
|
If your OIDs are in order and consecutive (0,1,2,3,...), you could apply a field calculation like: ColumnA - (OID*5) The better, more complicated way, not relying on OIDs, would be to use an UpdateCursor and a counter to update each row value. Inside the cursor, you would have something like: row[0] = row[1] - (counter * 5)
counter = counter + 1
cursor.updateRow(row)
... View more
05-22-2015
10:07 AM
|
0
|
2
|
2423
|
|
POST
|
It looks like 'test' may be in the description for your layer. If so, either 1.) delete it from the description, or 2.) change the legend style properties not to show the description. 1.) 2.)
... View more
05-22-2015
09:17 AM
|
0
|
1
|
1401
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-30-2013 02:22 PM | |
| 1 | 04-12-2011 11:19 AM | |
| 1 | 09-17-2021 09:43 AM | |
| 1 | 04-04-2012 12:05 PM | |
| 2 | 07-16-2020 11:31 AM |
| Online Status |
Offline
|
| Date Last Visited |
07-15-2023
12:11 AM
|