|
POST
|
I have scrip that does a multiple ring buffer and it takes 2-3 minutes to run but i use the Buffer wizard in Arcmap it takes maybe a second. Is there a different better/faster way of doing a multiple ring buffer? There isn't much to the the arcpy multiple ring buffer. arcpy.MultipleRingBuffer_analysis(SP, "1_2",[1,2],"Miles","ToBufDist","ALL" )
... View more
05-19-2016
10:01 AM
|
0
|
5
|
5660
|
|
POST
|
the r.OwnerName is a typo, it should have just been r.name = s.strip("$"), my bad. How do make an exception for the None Type with my current code? Can the $ be striped from a arcpy.MakeQueryTable_management? Thanks.
... View more
05-11-2016
08:34 AM
|
0
|
1
|
1292
|
|
POST
|
I am trying to strip "$" from attributes in the Name field or all the fields in a feature class table prior to exporting out the table. Could you strip the "$" from attributes in the Name field or all the fields in arcpy.MakeQueryTable_management prior to exporting if so how? I am not sure which would be the fastest? I have the following but i am getting an error on line 8. Error: line 8, in <module> r.OwnerName = s.strip("$") AttributeError: 'NoneType' object has no attribute 'strip' import arcpy
fc = "C:/Temp/Default.gdb/yogurt"
rows = arcpy.UpdateCursor(fc)
for r in rows:
s = r.Name
r.Name = s.strip("$")
rows.updateRow(r) Thanks.
... View more
05-10-2016
03:08 PM
|
0
|
4
|
3448
|
|
POST
|
Yes when changing to a geodatabase and exporting it exports the area and shape fields. I was using a macro but i got tired of having to open the export and run the macro.
... View more
05-03-2016
02:16 PM
|
0
|
0
|
1608
|
|
POST
|
Joshua thanks for the great info. I have made adjustments to move the feature layer to a gdb. The code you provided did remove the OID fields but i am now suck with Shape_Length and Shape_Area fields, what would be the correct syntax to remove the OID, Shape_Length and Shape_Area fields? I tired the following but got an error on line 7. if desc.hasShape_Length: AttributeError: DescribeData: Method hasShape_Length does not exist fc = "C:/Temp/Default.gdb/Blah"
desc = arcpy.Describe(fc)
flds = [fld.name for fld in desc.fields]
if desc.hasOID:
flds.remove(desc.OIDFieldName)
if desc.hasShape_Length:
flds.remove(desc.Shape_LengthFieldName)
if desc.hasShape_Area:
flds.remove(desc.Shape_AreaFieldName)
arcpy.MakeQueryTable_management(fc, "tmp_view", "NO_KEY_FIELD", "", flds)
#Result 'tmp_view'
arcpy.TableToExcel_conversion("tmp_view", r"C:/Temp/fc_dump.xls")
#Result 'C:/tmp/fc_dump.xls'
arcpy.Delete_management("tmp_view") Dan, This script generates a mailing list for notifications and the office software uses Excel file to generate mailing stickers. once I generate the list i have to open up excel and delete the OID, Shape_Length and Shape_Area fields. Thanks.
... View more
05-02-2016
09:14 AM
|
0
|
7
|
3364
|
|
POST
|
Ya i could leave it, doesn't hurt but just wondered if it was possible and if it was how to do it.
... View more
04-29-2016
11:18 AM
|
0
|
0
|
3364
|
|
POST
|
I am trying to delete the "OID" column prior to exporting the layers attribute to excel, but i am not sure if it's possible during the export or after. The code i posted runs but the "OID" does not get deleted. Thanks.
... View more
04-29-2016
09:43 AM
|
0
|
1
|
3364
|
|
POST
|
I have a script that creates a excel file but i need it to delete the "OID" field prior to exporting to excel, is this possible or does it have to be done after the export? I have tried the following, it runs fine and i don't get error. # Process: Make Feature Layer (2)
arcpy.MakeFeatureLayer_management("In_memory\Blah", "In_memory\Blah3")
#fields = arcpy.ListFields("In_memory\Blah3", "OID")
#if len(fields) != 1:
# arcpy.DeleteField_management("OID")
fields = [f.name for f in arcpy.ListFields("In_memory\Blah3")]
for i,f in enumerate(fields):
if f == 'OID':
del fields
# Process: Table Select
arcpy.TableToExcel_conversion("In_memory\Blah3",Listing_xls)
... View more
04-29-2016
09:14 AM
|
0
|
16
|
10189
|
|
POST
|
Interesting, i will have to play around with it. I did also find Spatial Adjustment Edgematching. Edgematch two feature classes. All though it would be nice if there was a geoprocessing tool that would allow you to do this in one process.
... View more
04-20-2016
10:48 AM
|
0
|
0
|
855
|
|
POST
|
I have a two polygon feature classes, I need feature class 1 to align exactly and snap to feature class 2. I can use the align to shape tool or the reshape tool but it seems as it doesn't always work correctly and i don't wan to pan,zoom and move every single node. Is there a geoprocessing tool that move feature class 1 to align and snap to feature class 2. If nodes need to be added to the align them that is fine, i would prefer that nodes be added to make sure it is align as perfect as possible. Thanks.
... View more
04-18-2016
10:57 AM
|
0
|
2
|
2895
|
|
POST
|
My fellow mappers split taxparcel and part of the splitting process they have to include a pdf or jpg of the split with the new split/adjusted parcel, example attached (Split(2).png) . I am trying automate the process to make it easier for them as it currently take multiple steps to create this split print out. They currently have driven data pages set up but they don't need the layout of the driven pages they need just a basic exported map like the one i have attached with a few items, like the north arrow and scale bar and possibly initials of the mapper , as example attached (Split(2).png) . I have currently looked through arcpy.mapping.ListLayoutElements but i am not sure if arcpy can create new features like the north arrow, scale bar and text. If so how? The current code creates a pdf of the selected parcel. I noticed that if i add "df" to the {data_frame} in arcpy.mapping. ListLayoutElem ents it exports the like the following attached Split_df.png. If a file, export map and chose pdf, it looks alot better then using arcpy.mapping.ExportToPDF, why is this? if i removed the "df". it will defult to PAGE_LAYOUT. code import arcpy, os
import arcpy.mapping
from arcpy import env
# Set workspace
arcpy.env.workspace = "C:/Temp"
arcpy.env.overwriteOutput = 'True'
env.qualifiedFieldNames = False
directory="C:/Temp/Split.pdf"
if os.path.exists(directory):
try:
os.remove(directory)
except:
print "Exception: ",str(sys.exc_info())
else:
print 'File not found at ',directory
#deletes the geodatabase prior if it exists
try:
if arcpy.Exists("C:/temp/NewFeatures.shp"):
arcpy.Delete_management("C:/temp/NewFeatures.shp")
except:
pass
mxd = arcpy.mapping.MapDocument("current")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
lyr = arcpy.mapping.ListLayers(mxd, "DSD.DBO.TaxParcels")[0]
if int(arcpy.GetCount_management("TaxParcels").getOutput(0)) > 0:
arcpy.FeatureClassToFeatureClass_conversion("TaxParcels", "C:/temp", "NewFeatures.shp")
#Adding Labels
layer = arcpy.mapping.ListLayers(mxd, "NewFeatures")[0]
if layer.supports("LABELCLASSES"):
for lblclass in layer.labelClasses:
lblclass.className = "DXF_TEXT"
lblclass.expression = '"%s" & [DXF_TEXT] & VBNewLine & "AC" & " " & Round([ACRES],2)& "%s"' % ("<BOL><CLR red='140'><FNT size='12'>" , "</FNT></CLR></BOL>") #WORKS!
lblclass.showClassLabels = True
layer.showLabels = True
df.extent = lyr.getSelectedExtent()
df.scale = 10000
arcpy.RefreshActiveView()
arcpy.mapping.ExportToPDF(mxd,"C:/Temp/Split.pdf",df)
... View more
04-04-2016
10:40 AM
|
0
|
1
|
3606
|
|
POST
|
1. 10.2.2 2. In Arcmap python window 3. i did catch that indent and fixed before i ran the code. 4. row1 in cursor1:, same as you have it. The names are spelled correctly. Although the polygon "SiteAddres" filed address are upper case for example, "2120 RANCH RD". Where the polygons layers "SiteAddres" are proper case for example, "2120 Ranch Rd".
... View more
03-23-2016
01:16 PM
|
0
|
0
|
1440
|
|
POST
|
Never mind i had the wrong layer in arcmap. The code does work but i am trying to do all of them at one time. the code only does one at a time. I am thinking i need to do a spatial join first.
... View more
03-23-2016
11:49 AM
|
0
|
1
|
1440
|
|
POST
|
I get the following. Runtime error Traceback (most recent call last): File "<string>", line 5, in <module> RuntimeError: The operation was attempted on an empty geometry. Thanks for the reply.
... View more
03-23-2016
11:31 AM
|
0
|
4
|
1440
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-27-2022 11:37 AM | |
| 1 | 10-31-2023 10:16 AM | |
| 1 | 02-16-2023 01:50 PM | |
| 1 | 08-11-2021 11:13 AM | |
| 1 | 01-06-2021 10:45 AM |
| Online Status |
Offline
|
| Date Last Visited |
09-10-2024
10:42 AM
|