|
POST
|
Hmmm... I'm not sure. I reran your code against my feature class and it works. What coordinate reference system are you using? I was using NAD83 UTM 17, but with a different CRS you may be out of bounds using such a large value for 'max'. Also, did you change the values in your table to meters? The buffer makes buffers of the number of linear units in the dataset, so if your dataset is in meters, the buffers will be meters, if feet, then the buffers will be in feet, etc. Can you also try adding the following line above line 23 to get a count of out_buffs? len(out_buffs)
... View more
01-18-2017
01:55 PM
|
1
|
4
|
2054
|
|
POST
|
Here is a quick way to switch between coordinate reference systems based on a field. Notes: - my zone field is an integer (values are 9 or 10, indicating which NAD83 UTM Zone the point is in). Yours is text, but you can convert it to integer like below (takes zone text value, minus the last character, and converts to integer): cur_wkid = int(wkid_shift + int(row[1][:-1])) - the script relies on the wkid number being related to the zone number. In my example, I add 26900 to the zone number to get the wkid number. So, zone 9 becomes wkid = 26909 (the correct wkid for NAD83 UTM Zone 9). In your case, you need to add 31960 to the zone number. So, zone 22 becomes wkid = 31982, and zone 21 becomes wkid = 31981. - change the values for fc, zone_field, x_field, y_field, and wkid_shift to match your data. - you should probably make a back-up copy, just in case things go wrong. Script: >>> fc = 'merge' # your feature class
... fc_sr = arcpy.Describe(fc).spatialReference # get the spatial reference
... zone_field = 'UTM_Zone' # change to your zone field
... x_field = 'Easting' # change to your x field
... y_field = 'Northing' # change to your y field
... wkid_shift = 26900 # change to 31960
... with arcpy.da.UpdateCursor(fc,['SHAPE@',zone_field,x_field,y_field],spatial_reference=fc_sr) as cursor: # loop through features
... for row in cursor:
... cur_wkid = int(wkid_shift + row[1]) # calculate new wkid for the feature
... proj_point = row[0].projectAs(arcpy.SpatialReference(cur_wkid)).centroid # project a new point
... row[2] = proj_point.X # get the x value of the new point
... row[3] = proj_point.Y # get the y value of the new point
... cursor.updateRow(row) # write the new values to the feature
... View more
01-16-2017
11:24 AM
|
1
|
0
|
1280
|
|
POST
|
There's no single tool that will do this for you, as far as I know. You generally need additional information (multispectral imagery, terrestrial ecosystem/forestry mapping, etc.) to build a model, incorporating things you know about what you want to model (height, density, smoothness, reflective characteristics, etc.).
... View more
01-13-2017
02:30 PM
|
1
|
0
|
3538
|
|
POST
|
If you symbolize the feature class by letter code and description (under symbology tab in layer attributes -> categories -> unique values, many fields), then the legend entry will be "letter code, description".
... View more
01-12-2017
01:00 PM
|
1
|
0
|
3810
|
|
POST
|
Rather than hard-coding the name of the OID/FID (sort_field = 'OBJECTID'), you can get it dynamically by describing the data: sort_field = arcpy.Describe(in_points).OIDFieldName
... View more
01-10-2017
11:20 AM
|
0
|
0
|
2276
|
|
POST
|
I don't exactly know what you're trying to do. You're the one who needs to understand the logic of your script. Split() splits a string by a delimiter, which I think is the basic step you're missing, but you need to play with it, understand what's happening, and then change the logic of your script to achieve the final goal. Come up with your new script and if it doesn't do what you think it should, either post and ask for more help, or do some debugging to figure it out.
... View more
01-05-2017
09:15 AM
|
1
|
0
|
5155
|
|
POST
|
I was just showing how you can break apart a given text string into parts based on a delimiter. You can still use GetParameterAsText() to collect the user input (e.g. "x,y,z"), break it apart using split() (['x','y','z']), and make your replacements using those individual pieces.
... View more
01-04-2017
02:14 PM
|
1
|
0
|
5155
|
|
POST
|
On each help page related to arcpy (e.g. arcpy functions, classes, or geoprocessing tools) the Python syntax for the "thing" is near the bottom. In this case, it says: ExportToPNG (map_document, out_png, {data_frame}, {df_export_width}, {df_export_height}, {resolution}, {world_file}, {color_mode}, {background_color}, {transparent_color}, {interlaced}) I don't want to be too cryptic, but you need to do some of the work here.
... View more
01-04-2017
01:56 PM
|
1
|
0
|
2056
|
|
POST
|
There is a resolution parameter: ExportToPNG—Help | ArcGIS Desktop
... View more
01-04-2017
12:50 PM
|
1
|
3
|
2056
|
|
POST
|
If you can trust the user to follow the right format, you can use split, which returns a list of items split by the given delimeter: >>> old_text = 'Red Branch, 600, Violet'
... print old_text.split(', ')
... print old_text.split(', ')[0]
... print old_text.split(', ')[1]
... print old_text.split(', ')[2]
...
['Red Branch', '600', 'Violet']
Red Branch
600
Violet
... View more
01-03-2017
02:29 PM
|
1
|
2
|
5155
|
|
POST
|
Yes, this goes in Raster Calculator, although I think you want the following expression that will round to the nearest 0.5 (Int truncates, it doesn't round): Int("aspect"*2+0.5)/2.0
... View more
01-03-2017
01:11 PM
|
2
|
4
|
2961
|
|
POST
|
Once you've made your feature layer, run CopyFeatures to save it to a feature class (I save to shapefile below, but you can save it to a gdb): >>> my_csv = r'C:\junk\csv.csv'
... lyr = arcpy.MakeXYEventLayer_management(my_csv,'x','y','lyr')
... fc = arcpy.CopyFeatures_management(lyr,r'C:\junk\outshp.shp')
... View more
01-03-2017
11:11 AM
|
1
|
6
|
3381
|
|
POST
|
Can you try printing workspace to make sure it's what you want? I think by using os.path.dirname you're backing up to the ArcCatalog folder, but you actually want it to be the .sde, at least according to the example here.
... View more
01-03-2017
10:49 AM
|
1
|
1
|
2348
|
|
BLOG
|
Maybe need one more line where Existing CRS = None (but data is already in Orange), then Orange, then Define, then Orange.
... View more
12-30-2016
10:18 AM
|
2
|
0
|
919
|
| 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
|