|
POST
|
Hi Stephan, Welcome to Geonet first of all. In the future if you have a small amount of code that you need help with, its easier for you to post it directly in your question (See https://community.esri.com/people/curtvprice/blog/2014/09/25/posting-code-blocks-in-the-new-geonet?sr=search&searchId=194dfe1f-52c7-4d0a-8678-474dd4e4c435&searchIndex=1 for examples on how), since people are not always able/comfortable to open zip files from the internet. Also if you have an error code, please post the error code and error message to give more detail on the problem (in this case it was probably something about unable to write features or invalid path which is relevant information). As to your error, I would use some print statements to determine whether your output for the copy tool is what you think it is, you may be missing something needed for the full file path. Also I would recommend using the os module for creating file paths instead of just concatenating paths and file names. https://docs.python.org/2/library/os.path.html Example of its use from the ListFeatureClasses help. http://pro.arcgis.com/en/pro-app/arcpy/functions/listfeatureclasses.htm Edit: I see Neil answered you more directly, but I would strongly recommend using print statements for debugging to make sure your inputs are correct when such errors occur.
... View more
03-22-2017
09:58 AM
|
0
|
0
|
1172
|
|
POST
|
Seems as though you aren't the only person to come up with this issue. https://community.esri.com/thread/161557 https://community.esri.com/thread/189604-how-do-i-add-a-tin-to-arcmap-using-python
... View more
03-16-2017
09:28 AM
|
0
|
0
|
744
|
|
POST
|
I doubt it would change your legend unless your legend item for that layer was already using a style item that used the layer heading. You could always change your legend item style to use only the layer name, or layer name and label only if you didn't want an heading added to them.
... View more
03-15-2017
12:59 PM
|
0
|
0
|
5853
|
|
POST
|
Sheesh I'm slipping.... I remember looking at that about a month ago and reminding myself to use that if needed sometime.
... View more
03-15-2017
12:54 PM
|
0
|
1
|
5853
|
|
POST
|
I'm fairly certain that a layer label value is not exposed with the arcpy module and therefore cannot be changed with arcpy.
... View more
03-15-2017
12:43 PM
|
0
|
1
|
5853
|
|
POST
|
Also, just found another thread with a similar question which might be of use to you. https://community.esri.com/thread/161119
... View more
03-15-2017
09:58 AM
|
3
|
1
|
2091
|
|
POST
|
It's true in the example they just use a single string with space seperated values. I recommended differently for multiple inputs due to the help for that input showing the parameters as such: in_features [[in_feature_class, height_field, SF_type, tag_value],...] However, seeing as the input for the parameter is a Value Table, I believe you are right it needs to be a space delimited single string. I'm finding the help for that parameter a little misleading and it probably should be updated to show multiple features better.
... View more
03-15-2017
09:54 AM
|
0
|
0
|
2091
|
|
POST
|
Hi Martina, Please see about /blogs/dan_patterson/2016/08/14/script-formatting?sr=search&searchId=9aaf3fd8-05d9-4bb9-b3ee-4e83caf26f5e&searchIndex=3 about posting code in GeoNet, for clarity's sake. Have you tried going to the geoprocessing results in ArcMap and copying the results as a Python Snippet? The snippet should give you a better idea on how you need to format your Input Feature Class parameter for the tool in Python. I'm guessing based on the tool help it would need to be a list of lists, with comma separated values for each Input Feature. [['IST_HQ100_Depth.shp' , 'Field4' , "Mass_Points" , None],['Model_Area.shp', None, 'Soft_Clip' , None]] Also if you are working in Python, make sure you are setting your environmental settings so it knows where to look for your input features, or use fully qualified file paths to the files. Also I never see where you define the variable TIN in your script. Hope this helps some. Ian
... View more
03-15-2017
09:04 AM
|
0
|
4
|
2091
|
|
POST
|
I think you missed the point. You need to create a Polygon Object for each row, not for the entire feature class. Right now you are creating only a single polygon object, hence the single polygon output you are getting of all features together. You need to create a list of Polygon objects as the input for Copy Features so you will have a record for each original feature. This is why in the example, features was the input for Copy Features, not a single Polygon Object, since there were two Polygons created in the example script for each list of coordinates. I believe if you adapted it to something like this it would take care of things, sorry about the gratuitous whitespace. features = []
# Enter for loop for each feature
for row in arcpy.da.SearchCursor(infc, ["OID@", "SHAPE@"]):
# Print the current multipoint's ID
print("Feature {}:".format(row[0]))
polygon = arcpy.Polygon()
array = arcpy.Array()
# Step through each part of the feature
for part in row[1]:
# Step through each vertex in the part
sub_array = arcpy.Array()
for pnt in part:
# Print x,y coordinates of current point
transform(pnt.X,pnt.Y)
#print pnt.X, pnt.Y, Calc_east, Calc_north, Calc_elev
new_pnt = arcpy.Point(Calc_east, Calc_north)
sub_array.add(new_pnt)
sub_array.add(sub_array.getObject(0))
array.add(sub_array)
del sub_array
polygon.add(array)
features.append(polygon)
del array
del polygon
#multi_Part_Polygon = arcpy.Polygon(array, arcpy.SpatialReference(102484), True)
arcpy.CopyFeatures_management(features,"C:\\testing\\test18.shp")
... View more
03-14-2017
01:23 PM
|
1
|
1
|
3043
|
|
POST
|
Hi Erich, For readability of your script on the forum, please read the below post on posting code blocks. https://community.esri.com/people/curtvprice/blog/2014/09/25/posting-code-blocks-in-the-new-geonet?sr=search&searchId=f7ef88cd-621a-4ec3-a340-e7c5343b8ed1&searchIndex=1 I think Darren is right, you are creating a single Polygon object which each of your multipart features is being written to. You need to create a Polygon object for each polygon feature then use that for the input. See the example below where they create a list of Polygon objects that are used as the input for the copy features. import arcpy
# A list of features and coordinate pairs
feature_info = [[[1, 2], [2, 4], [3, 7]],
[[6, 8], [5, 7], [7, 2], [9, 5]]]
# A list that will hold each of the Polygon objects
features = []
for feature in feature_info:
# Create a Polygon object based on the array of points
# Append to the list of Polygon objects
features.append(
arcpy.Polygon(
arcpy.Array([arcpy.Point(*coords) for coords in feature])))
# Persist a copy of the Polyline objects using CopyFeatures
arcpy.CopyFeatures_management(features, "c:/geometry/polygons.shp")
... View more
03-14-2017
11:51 AM
|
0
|
0
|
3043
|
|
POST
|
Probably the easiest this would be to create a constant raster with a value of 0 then with the same cell size as your existing raster layer but the extent of your rectangle. Then you could use any number of raster calculator functions to create a new raster with both rasters as inputs such as the Plus Tool to add them together or use a Over function to copy over the cells from the original where they already exist and apply 0 values to areas where they did not exist before(Unless you have some negative values in your original raster, please look at the raster math toolbox to find the tool to suit your need). Please take into account what you are using for a snap raster environment, since likely your cells will not perfectly overlap and you will want to shift the constant raster to your existing data, instead of the reverse. Constant Raster - https://desktop.arcgis.com/en/arcmap/10.4/tools/spatial-analyst-toolbox/create-constant-raster.htm Over - https://desktop.arcgis.com/en/arcmap/10.4/tools/spatial-analyst-toolbox/over.htm Plus - https://desktop.arcgis.com/en/arcmap/10.4/tools/spatial-analyst-toolbox/plus.htm Snap Raster Environment - https://desktop.arcgis.com/en/arcmap/10.4/tools/environments/snap-raster.htm
... View more
03-13-2017
01:16 PM
|
0
|
0
|
3471
|
|
POST
|
I don't recall him worried about empty strings, just null attribute table values causing issues in the label. Anyone have fault with my method I posted above?
... View more
03-10-2017
11:13 AM
|
1
|
3
|
1715
|
|
POST
|
This should be relatively straight forward, I feel a little bad throwing so many links at you. I know there was another thread on GeoNet for zooming and exporting at multiple scales that is a bit more relevant, but I don't have it bookmarked like some of the others. I'll dig around and see if I can find it. Edit: Not so hard to find apparently, though this one is for a script tool. https://community.esri.com/thread/95438
... View more
03-09-2017
02:42 PM
|
2
|
1
|
1847
|
|
POST
|
LAStools has always been good for point cloud processing and has tools for converting .e57 to las files. However, that tool requires licensing for any commercial purposes. http://www.cs.unc.edu/~isenburg/lastools/ Conversely FME might be a way to go. http://www.safe.com/data-types/lidar-point-clouds/
... View more
03-09-2017
02:39 PM
|
1
|
0
|
6004
|
|
POST
|
Hi Michel, I would look into using cursors to access the data you need for each record in your dataset and reading them to a list(if you only need one value per dataset) or a dictionary if you need more than one. I would then probably iterate through the list/dictionary and create a defintion query to your layer in your map document using the value(s) as needed, zoom to the feature, zoom back out to a set scale(if you are working with points you will definitely want to zoom back out, polygons you might want to zoom out by a certain amount). After you have the extent set how you want, export out to whichever format works for you. Some handy links: Introduction to the Arcpy Mapping Modules. https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fdesktop.arcgis.com%2Fen%2Fdesktop%2Flatest%2Fanalyze%2Farcpy-mapping%2Fintroduction-to-arcpy-mapping.htm Introduction to arcpy.da.SearchCursor: http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&sqi=2&ved=0ahUKEwjokLjEusrSAhWGYyYKHc-kAcAQFggfMAE&url=http%3A%2F%2Fdesktop.arcgis.com%2Fen%2Farcmap%2F10.3%2Fanalyze%2Fpython%2Fdata-access-using-cursors.htm&usg=AFQjCNFKYTo2AUoCRKm8ji89WphWlYIFeQ&bvm=bv.149093890,d.eWE Thread where I posted some code for creating several maps from a single dataset with many records with many values. Please note I used a slightly different method then, but gives you some ideas for flow and syntax. https://community.esri.com/thread/160192 Richard Fairhurst excellent blog post about using cursors and dictionaries for data manipulation. Should help with using cursors and reading in all the data you will need. I would highly recommend only using the cursors for creating the list/dictionaries of data, since doing alot of geoprocessing while in a cursor tends to bog things down. https://community.esri.com/blogs/richard_fairhurst/2014/11/08/turbo-charging-data-manipulation-with-python-cursors-and-dictionaries Arcpy Tool for exporting to PDF: http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-mapping/exporttopdf.htm Alternatively, look into Data Driven Pages. https://community.esri.com/thread/160192 Regards, Ian
... View more
03-09-2017
02:20 PM
|
2
|
3
|
1847
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-22-2017 08:58 AM | |
| 1 | 10-05-2015 05:43 AM | |
| 1 | 05-08-2015 07:03 AM | |
| 1 | 10-20-2015 02:20 PM | |
| 1 | 10-05-2015 05:46 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|