POST
|
Here is something I wrote that will build points along the line that you can then feed to the split by point tool. def points_along_line(line_lyr, pnt_layer, pnt_dist):
"""
line_lyr (feature layer) - Single part line
pnt_layer (feature layer) - Path to point feature class
pnt_dist (integer) - Interval distance in map units to add points
"""
search_cursor = arcpy.da.SearchCursor(line_lyr, 'SHAPE@')
insert_cursor = arcpy.da.InsertCursor(pnt_layer, 'SHAPE@')
for row in search_cursor:
for dist in range(0, int(row[0].length), pnt_dist):
point = row[0].positionAlongLine(dist).firstPoint
insert_cursor.insertRow([point])
It was setup to work on an existing point feature class. You could just as easily add a few lines to create it on the fly. if not arcpy.Exists(pnt_layer):
arcpy.CreateFeatureclass_management(
os.path.dirname(pnt_layer), os.path.basename(pnt_layer), 'POINT')
...
return pnt_layer Then add the split line at point tool where you call the function.
points_along_line(line_features, point_features, pnt_dist)
arcpy.SplitLineAtPoint_management(line_features, point_features, out_feature_class)
... View more
07-03-2014
10:49 AM
|
0
|
0
|
1940
|
POST
|
Just an FYI that I had issues with and just got resolved. This requires you to use your admin ArcGIS Online account, NOT your ArcGIS license admin account.
... View more
06-24-2014
05:10 AM
|
0
|
0
|
657
|
POST
|
Make sure it is indented properly. Pre-Logic Script Code: def calctemp(newValue):
if newValue > 0:
tempF = (newValue - 273.15)* 1.8000 + 32.00
return tempF
... View more
06-18-2014
12:24 PM
|
0
|
0
|
431
|
POST
|
Ah, so ArcGIS Pro and ArcGIS 10.3 are entirely independent platforms even at the backend? Requiring separate Python installs? Will the entire arcpy library be ported to ArcGIS Pro for release or will it have its own unique functionality? Is ArcGIS Pro going to be the default Python/geoprocessing environment or will that remain the regular Python 2.x/ArcGIS engine?
... View more
06-10-2014
12:21 PM
|
0
|
0
|
1362
|
POST
|
http://gisinc.com/talk/2014-esri-international-developer-summit-day-2-recap Python 3.4 will be supported with ArcGIS for Professionals Does any know for certain which version of Python will ship with 10.3? Since it comes with ArcGIS for Professionals I thought it would be 3.4 but I haven't found any officials sources. Previous sources seemed to indicate ArcGIS 11 would be moving to 3.x but I'm not sure if this product release was renamed or that release was pushed back.
... View more
06-10-2014
10:25 AM
|
3
|
34
|
24489
|
POST
|
You have to save it as a layer file, create a layer object from the file, then add it. Example import arcpy
topology_path = 'path1'
layerfile_path = 'path2'
mxd = arcpy.mapping.MapDocument('current')
df = arcpy.mapping.ListDataFrames(mxd)[0]
layer = arcpy.mapping.Layer(layerfile_path)
arcpy.mapping.AddLayer(df, layer)
Edit: disregard, this method does not work natively. It only works if you have already saved the topology as a layer file.
... View more
05-15-2014
11:14 AM
|
0
|
0
|
458
|
POST
|
Multiprocessing is currently poorly supported using gp functions. Some work fine, others don't. In each process try explicitly setting both the workspace and scratchworkspace environmental settings to make sure they are unique. I've run into issues with two processing trying to write to the same scratchworkspace using the same file names at the same time with predictable results. The part where it crashes randomly on different dates seems to imply some kind of collision of this nature that is just a timing problem with the different threads.
... View more
05-12-2014
07:56 AM
|
1
|
0
|
1088
|
POST
|
I don't know of an explicit method of testing if it is a group layer or not, but you can test if it supports datasetname which I believe only would apply to group layers or basemap layers. layers = arcpy.mapping.ListLayers(mxd)
for lyr in layers:
if lyr.supports('datasetname'):
print('probably an fc layer')
else:
print('probably some other kind of layer') Edit: Ah I think I see your issue now. Try This.
layers = arcpy.mapping.ListLayers(mxd)
for lyr in layers:
if lyr.isGroupLayer:
group_lyr = lyr.name
print('This is a group layer')
elif lyr.longName.split(os.sep)[0] == group_lyr:
print('lyr is in group layer')
Edit Edit: James has a better method.
... View more
05-01-2014
06:12 AM
|
0
|
0
|
1552
|
POST
|
I would try refreshing your ddp and saving as a new mxd. Also try setting your currentPageID to 1 or 2 or some other value to make sure you can change it.
... View more
04-24-2014
10:47 AM
|
0
|
0
|
606
|
POST
|
First, please read this and follow the posting guidelines. http://forums.arcgis.com/threads/48475-Please-read-How-to-post-Python-code Also, do you get the expected results from this? arcpy.AddMessage(newpage) And what version of ArcGIS are you using?
... View more
04-24-2014
09:39 AM
|
0
|
0
|
606
|
POST
|
This is the code that exports the entire table? Nothing looks glaringly wrong. What version of ArcGIS are you using? The first thing I would try is removing the maketableview completely. Use the query parameter for the tabletotable function instead to see if you get any different results. I would also change your query to something like this. Also verify that your query is valid and returns the expected results using ArcMap. sqlWhere = "{0} = '{1}' AND {2} = '{3}'".format(
arcpy.AddFieldDelimiters(dbtPivot, 'ZIP_CODE'), strZipCode,
arcpy.AddFieldDelimiters(dbtPivot, 'CRID_ID'), strCridId) I just have a few other minor suggestions. You shouldn't need the r1= and r2= parts. Also try setting your workspace to your output GDB. And, os.path.join is a better way of joining paths, yours seem like they should be fine and you would be getting some different errors if that was the issue. But it is something to keep in mind.
... View more
04-24-2014
09:30 AM
|
0
|
0
|
562
|
POST
|
Can you copy in your entire code you executed? If you have set your workspace to SDE use a staging area to save your table view.
... View more
04-24-2014
07:32 AM
|
0
|
0
|
562
|
POST
|
It could also be you need delimiters on your field, though it should be unnecessary. AllCrimes = "CopyCopySample2011_2013.shp"
CrimeTypeSet = set([r[0] for r in arcpy.da.SearchCursor(AllCrimes, ["CrimeType"])])
for CrimeType in CrimeTypeSet:
out_FC = "H:\\PythonOutput\\" + str(CrimeType)
query = """{0} = '{1}'""".format(arcpy.AddFieldDelimiters(AllCrimes, "CrimeType"), CrimeType)
arcpy.Select_analysis(AllCrimes, out_FC, query)
... View more
04-23-2014
10:09 AM
|
0
|
0
|
265
|
POST
|
Have you tried this tool? http://resources.arcgis.com/gallery/file/geoprocessing/details?entryID=37AEB018-1422-2418-A036-CA6D9920F808 And I imagine the problem with your query is the quotes. Try this using string substitution instead. "CrimeType = '{0}'".format(CrimeType)
... View more
04-23-2014
09:46 AM
|
0
|
0
|
265
|
POST
|
You can try searching each band. And no it shouldn't matter if it is in a GDB or not, but I can't speak to every raster format possible. I'm sure some formats don't support this. Give this a try, assuming you are dealing with bands 1,2,3. bands = ['Band_1', 'Band_2', 'Band_3']
for band in bands:
desc = arcpy.Describe(os.path.join(raster, band))
desc.noDataValue
... View more
04-23-2014
09:29 AM
|
0
|
0
|
543
|
Title | Kudos | Posted |
---|---|---|
1 | 10-31-2012 08:39 AM | |
1 | 07-16-2012 01:52 PM | |
1 | 03-15-2012 10:57 AM | |
1 | 05-12-2014 07:56 AM | |
1 | 03-19-2012 05:29 AM |
Online Status |
Offline
|
Date Last Visited |
10-05-2021
04:40 PM
|