POST
|
Whoops left off a + sign
def FindLabel ( [Name] ):
Split = [Name].split(",")
Split = Split[0] #drops everything after comma
Split = Split.split("-") #splits by the hyphen
if len(Split) == 2:
expression = Split[0] + "- \n" + Split[1]
elif len(Split) == 3:
expression = Split[0] +"-" + Split[1] + "- \n" + Split[2]
return expression
GIve that a shot.
... View more
05-16-2014
01:24 PM
|
0
|
0
|
1113
|
POST
|
positives = arcpy.SearchCursor("cwdpts4Anlys",' "ELISALYMPHNODE" = \'Positive\' ' , "", "SAMPLE_ DATE" ')
I think you have an extra single quote at the end. You single quote for the expression ends at the end of the 2nd parameter, then I see no single quote for the one on the end to go with. SHould be like this I believe.
positives = arcpy.SearchCursor("cwdpts4Anlys",' "ELISALYMPHNODE" = \'Positive\' ' , "", "SAMPLE_ DATE" )
And yes, syntax errors are the devil.
... View more
05-16-2014
01:18 PM
|
0
|
0
|
402
|
POST
|
This may work, it will depend on how many names come before the comma. This should drop everything after the comma, then put the first two cities on top with the 3rd city beneath, if there are only two cities hyphenated, then it will stacked them one atop another.
def FindLabel ( [Name] ):
Split = [Name].split(",")
Split = Split[0] #drops everything after comma
Split = Split.split("-") #splits by the hyphen
if len(Split) == 2:
expression = Split[0] + "- \n" Split[1]
elif len(Split) == 3:
expression = Split[0] +"-" + Split[1] + "- \n" + Split[2]
return expression
Make sure you use python and advanced expression. Unfortunately I have no data to test on but hopefully this does it.
... View more
05-16-2014
01:11 PM
|
0
|
0
|
1113
|
POST
|
I think we had an overkill of responses for this thread.
... View more
05-15-2014
07:01 AM
|
0
|
0
|
642
|
POST
|
You are doing nothing wrong, it just is printing the location on the harddrive of each field, instead of the name. If you need to retrieve the actual name of the field, you need to use the .baseName or .aliasName method on each field. More on that can be found getting field attributes here: http://resources.arcgis.com/en/help/main/10.2/index.html#//018z0000004n000000 If you are writing in the interative python window, you'd probably want something like this if you wanted to just delete the "unwanted_field".
fieldlist = arcpy.ListFields('my_feature_class')
for field in fieldlist:
if field.baseName == "unwanted_field":
arcpy.DeleteField_management('my_feature_class", field)
Hope this helps Edit: Oops looks like James beat me to it.
... View more
05-15-2014
06:50 AM
|
0
|
0
|
642
|
POST
|
I didn't really review the calculate field parameters before writing my response earlier arcpy.CalculateField_management(preparedfeatures, "Priority", "!" + field.baseName + "!", "PYTHON_9.3", "") should be used, as the 3rd parameter needs to be an SQL expression for the field name, not the field name itself. I'm not sure about actually changing the field name with python, you'd at minimum would have to open an editting session and even then you probably could only edit the Alias Name, not the Base Name. I could be completely wrong about that, someone please correct me if I am. Hope this helps
... View more
05-13-2014
12:54 PM
|
0
|
0
|
698
|
POST
|
Hi Charlie A few things. First off, prifield = arcpy.ListFields(preparedfeatures, 'Pri*'), makes prifield a list filled with all the fields that meet your parameters. To get individual fields from this list you need to use a for loop or indexes. Secondly, it is not incorrect what it was returning, it was returning the space on your hard drive where the data is stored. To get the actual name value of the field you need to call .baseName on it or .aliasName So you would need something like
prifield = arcpy.ListFields(preparedfeatures, 'Pri*')
for field in prifield:
if field.baseName != "Priority":
arcpy.AddWarning('The priority field was named ' + str(field.baseName) + " and will be renamed.")
arcpy.AddField_management(preparedfeatures, "Priority", "SHORT", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
arcpy.CalculateField_management(preparedfeatures, "Priority", field , "PYTHON_9.3", "")
more on getting info about fields can be found here http://resources.arcgis.com/en/help/main/10.2/index.html#//018z0000004n000000 Hope this helps you.
... View more
05-13-2014
09:40 AM
|
0
|
0
|
698
|
POST
|
Could you post a screenshot of the CAD to Geodatabase Tool with your inputs before you run it? Also, can you post a view of the geodatabase in either the catalog or ArcCatalog after the tool finishes?
... View more
05-13-2014
09:24 AM
|
0
|
0
|
389
|
POST
|
sorry I misunderstood the first time. If you do a table to table conversion on the raster attribute table and export as a dbf table, excel can open the file if you change the extension to .xls instead of .dbf(.xlsx does not work). I'm not entirely familiar with raster attribute tables so working with what I got. Otherwise I'm not sure of a non-python way to do this.
... View more
05-13-2014
06:49 AM
|
0
|
0
|
936
|
POST
|
You can add the Raster to ASCII tool, it should output it to a text file for you. http://resources.arcgis.com/en/help/main/10.1/index.html#//001200000005000000
... View more
05-13-2014
05:44 AM
|
0
|
0
|
936
|
POST
|
Make sure when you make your feature class to NOT give it a projection, or put it in a Geographic Coordinate System. Let it just project as a raw lat/long value and it should be fine, as ArcGIS projects all data on the fly to the projection of the dataframe. Since the data is not projected, it does not need to be given a projection. I'm guessing the lat/long values came from a GPS or something? I made some points for around Memphis, TN from raw lat/long and when I brought them in with in NAD83 UTM 15N it put them off the coast of the Galapagos Islands.
... View more
05-09-2014
12:44 PM
|
0
|
0
|
579
|
POST
|
If you give the shapefile a projection when it comes in, then it could be off since the values you are giving it are raw lat/long values. I'd try bringing in the points with either an unknown projection or WGS 1984 Geographic Coordinate System. Also what projection is your data frame in?
... View more
05-09-2014
12:31 PM
|
0
|
0
|
579
|
POST
|
I assumed so, but its been a day of silly mistakes so I thought I'd check. What method did you use for making the shapfile from points? Easiest way is usually going to the catalog opening the excel sheet, right clicking on it and selecting "Create Feature Class"
... View more
05-09-2014
11:55 AM
|
0
|
0
|
579
|
POST
|
Make sure that if it supposed to be in southern or western hemispheres you have negative lat or long values.
... View more
05-09-2014
11:40 AM
|
0
|
0
|
579
|
POST
|
It happens, especially on Fridays. Glad you got it worked out.
... View more
05-09-2014
11:35 AM
|
0
|
0
|
473
|
Title | Kudos | Posted |
---|---|---|
1 | 02-22-2017 08:58 AM | |
1 | 05-03-2017 07:34 AM | |
1 | 01-19-2017 09:31 AM | |
1 | 10-14-2015 12:34 PM | |
1 | 04-11-2018 12:27 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|