|
POST
|
How did you create your version? Was it using a script or through ArcMap? Also - how old is your version?
... View more
09-20-2018
01:15 PM
|
0
|
1
|
6986
|
|
POST
|
No, they are not multipart. I used this blog to update point locations using field calculator successfully: https://community.esri.com/groups/technical-support/blog/2011/12/06/how-to-update-the-location-of-a-point-feature-and-its-xy-fields
... View more
08-21-2018
08:25 AM
|
0
|
0
|
1824
|
|
POST
|
Hi Xander, The vast majority of my lines are not multipart, which is good. When I run it using a NULL z value the line disappears. When I set a z value it gives me the following error: Codeblock:
... View more
08-21-2018
07:48 AM
|
0
|
2
|
1824
|
|
POST
|
Can you go to the "Settings" tab for Noxious Weeds and make sure the following is checked?
... View more
08-20-2018
05:54 PM
|
1
|
1
|
2596
|
|
POST
|
How do I go about moving the endpoint of a polyline using field calculator? I have the x,y end point coordinates in the "X" and "Y" fields. def XYsetVALUE(shape, X_value, Y_value): point = shape.getPart(1) point.X = X_value point.Y = Y_value return point SHAPE = XYsetVALUE ( !SHAPE!, !X!, !Y!)
... View more
08-20-2018
05:41 PM
|
0
|
6
|
2084
|
|
BLOG
|
Points moved successfully. I'd like to move endpoints of lines in addition (outside a geometric network) - is there a way to do this ? This is giving me the error.
... View more
08-20-2018
05:22 PM
|
0
|
0
|
12602
|
|
POST
|
I ended up just using this (albeit long) workaround: Make Overhead a Layer Add Layer to Map (probably could remove this step) FeatureClassToFeatureClass (with expression) Make New Feature Class a Layer SelectLayerByLocation using new Layer - I'm also going to have to delete the new feature class at some point. import arcpy
arcpy.env.overwriteOutput = True
grab = arcpy.GetParameterAsText(0)
prep_list = grab.split(";")
mxd_c = arcpy.mapping.MapDocument(r"T:\GIS\Projects\GIS\Online\MapDocuments\FeederMapCover.mxd")
lyrs_c = arcpy.mapping.ListLayers(mxd_c)
df = arcpy.mapping.ListDataFrames(mxd_c)[0]
print "got feeder list"
arcpy.AddMessage("...starting map book...")
# Make and Add the FeederMapIndexLAYER feature layer to the map
FeederMap = "T:\GIS\Projects\GIS\Online\SpatialData\FeederMaps.gdb\FeederMapIndex"
Overhead = "Database Connections\ElectricModel - azumwalt.sde\ElectricModel.DBO.UEC\ElectricModel.DBO.Overhead"
arcpy.MakeFeatureLayer_management(FeederMap, "FeederMapIndexLAYER")
arcpy.MakeFeatureLayer_management(Overhead, "OverheadLAYER")
layer = arcpy.mapping.Layer("FeederMapIndexLAYER")
layerOH = arcpy.mapping.Layer("OverheadLAYER")
arcpy.mapping.AddLayer(df,layer,"AUTO_ARRANGE")
arcpy.mapping.AddLayer(df,layerOH,"BOTTOM")
expression = "esUplineFeeder = 'HB2'"
arcpy.FeatureClassToFeatureClass_conversion(Overhead, "T:\GIS\Projects\GIS\Online\SpatialData\FeederMaps.gdb","OverheadDeleteMe",expression)
arcpy.MakeFeatureLayer_management("T:\GIS\Projects\GIS\Online\SpatialData\FeederMaps.gdb\OverheadDeleteMe","OverheadDeleteMe", )
overheadDeleteMe = arcpy.mapping.Layer("OverheadDeleteMe")
arcpy.mapping.AddLayer(df,overheadDeleteMe,"BOTTOM")
print "Feature Layer Added to Map"
for lyr in arcpy.mapping.ListLayers(mxd_c):
if lyr.name == "Overhead":
lyr.definitionQuery = "esUplineFeeder = 'HB2'"
arcpy.CalculateField_management("FeederMapIndexLAYER", "InMap", expression=0)
arcpy.SelectLayerByLocation_management('FeederMapIndexLAYER', 'INTERSECT', "OverheadDeleteMe")
arcpy.CalculateField_management("FeederMapIndexLAYER", "InMap", expression=1)
mxd_c.saveACopy("Z:\FeederMaps\MXDs\SHORTTEST_.mxd") Not sure this is really a "correct answer" but more of a workaround. Also - I'm not using Pro yet to do this as I want to create a tool and upload it using WebAppBuilder and I believe with Pro you have to have Portal and we are not quite there yet. (Correct me if I'm wrong).
... View more
08-08-2018
03:46 PM
|
1
|
0
|
1372
|
|
POST
|
I'm at a loss. I can't get these two lines to work properly outside of ArcMap. The arcpy.SelectLayerByLocation_management tool does not recognize any definition queries set either in the code or in the map beforehand. Does anyone else have this issue? Is this a bug? arcpy.SelectLayerByLocation_management('FeederMapIndexLAYER', 'INTERSECT', 'OverheadLAYER')
arcpy.CalculateField_management("FeederMapIndexLAYER", "InMap", expression=1)
... View more
08-08-2018
01:37 PM
|
0
|
1
|
1372
|
|
POST
|
Hi Xander, I updated the code so the feature layer is created before I iterated through the feeders - thank you! Now when I open up the first mxd (TEST1) - having only run the code up until this point. The definition queries are present. When I manually type in the code into ArcMap (see screenshot) it works! Yay! BUT.... When I run the code until the second mxd (TEST2) with seemingly the same code that was manually entered in ArcMap and open the map... It is obvious a selection was made before the CalculateField_managemenet tool was run (although nothing is selected when I open the map), and instead of just the overhead with the def. query being used during SelectLayerByLocation, ALL of the overhead was used. So every index that intersected an overhead line (1032/2032) is now InMap = 1. There should only be 17. I'm not sure why what I'm running in ArcMap is not doing the same thing in my code. Am I missing something obvious? Updated Code: import arcpy
arcpy.env.overwriteOutput = True
grab = arcpy.GetParameterAsText(0)
prep_list = grab.split(";")
mxd_c = arcpy.mapping.MapDocument(r"T:\GIS\Projects\GIS\Online\MapDocuments\FeederMapCover.mxd")
lyrs_c = arcpy.mapping.ListLayers(mxd_c)
df = arcpy.mapping.ListDataFrames(mxd_c)[0]
feederList = ["HB2", "HB3"]
print "got feeder list"
arcpy.AddMessage("...starting map book...")
# Make and Add the FeederMapIndexLAYER feature layer to the map
arcpy.env.workspace = r"T:\GIS\Projects\GIS\Online\SpatialData\FeederMaps.gdb"
FeederMap = "T:\GIS\Projects\GIS\Online\SpatialData\FeederMaps.gdb\FeederMapIndex"
arcpy.MakeFeatureLayer_management(FeederMap, "FeederMapIndexLAYER")
print "Feature Layer Created"
layer = arcpy.mapping.Layer("FeederMapIndexLAYER")
arcpy.mapping.AddLayer(df,layer,"AUTO_ARRANGE")
print "Feature Layer Added to Map"
for feeder in feederList:
arcpy.env.overwriteOutput = True
for lyr in arcpy.mapping.ListLayers(mxd_c):
if lyr.name == "Overhead":
lyr.definitionQuery = "esUplineFeeder = '" + feeder + "'"
if lyr.name == "Underground":
lyr.definitionQuery = "esUplineFeeder = '" + feeder + "'"
mxd_c.saveACopy("Z:\FeederMaps\MXDs\TEST1_" + feeder + ".mxd")
arcpy.CalculateField_management("FeederMapIndexLAYER", "InMap", expression=0)
arcpy.SelectLayerByLocation_management('FeederMapIndexLAYER', 'INTERSECT', 'Overhead')
arcpy.CalculateField_management("FeederMapIndexLAYER", "InMap", expression=1)
mxd_c.saveACopy("Z:\FeederMaps\MXDs\TEST2_" + feeder + ".mxd")
... View more
08-07-2018
02:41 PM
|
0
|
0
|
1372
|
|
POST
|
Hello again, So I am saving mxd's at regular intervals now but when it comes to intersecting the FeederMapIndexLayer with "Overhead" it's not recognizing the definition query - it just intersects it with ALL of the overhead lines. When I open the mxd the definition query is present.... any thoughts? import arcpy
arcpy.env.overwriteOutput = True
grab = arcpy.GetParameterAsText(0)
prep_list = grab.split(";")
mxd_c = arcpy.mapping.MapDocument(r"T:\GIS\Projects\GIS\Online\MapDocuments\FeederMapCover.mxd")
lyrs_c = arcpy.mapping.ListLayers(mxd_c)
feederList = ["HB2", "HB3"]
print "got feeder list"
arcpy.AddMessage("...starting map book...")
for feeder in feederList:
arcpy.env.overwriteOutput = True
for lyr in arcpy.mapping.ListLayers(mxd_c):
if lyr.name == "Overhead":
lyr.definitionQuery = "esUplineFeeder = '" + feeder + "'"
if lyr.name == "Underground":
lyr.definitionQuery = "esUplineFeeder = '" + feeder + "'"
print "Definition Queries Set" + feeder
# Make and Add the FeederMapIndexLAYER feature layer to the map
arcpy.env.workspace = r"T:\GIS\Projects\GIS\Online\SpatialData\FeederMaps.gdb"
FeederMap = "T:\GIS\Projects\GIS\Online\SpatialData\FeederMaps.gdb\FeederMapIndex"
arcpy.MakeFeatureLayer_management(FeederMap, "FeederMapIndexLAYER")
print "Feature Layer Created"
addLayer = arcpy.mapping.Layer('FeederMapIndexLAYER')
print "Feature Layer Added to Map"
# Field Calculator InMap = 0
arcpy.CalculateField_management("FeederMapIndexLAYER", "InMap", expression= 0 )
print "Index Field Calculator Worked"
# Select FeederMapIndexLayer polygons that intersect Overhead Lines and Calculate FeederMapIndex = 1
Selection = arcpy.SelectLayerByLocation_management('FeederMapIndexLAYER', 'INTERSECT', 'Overhead')
print "Index Selection Completed"
arcpy.CalculateField_management("FeederMapIndexLAYER", "InMap", expression= 1 )
print "Index Field Calculator Worked"
mxd_c.saveACopy("Z:\FeederMaps\MXDs\TEST1_" + feeder + ".mxd")
... View more
08-07-2018
09:17 AM
|
0
|
2
|
3067
|
|
POST
|
Thanks for all your help guys! I am getting the notice "Cannot find reference "saveACopy" in mapping.py." I'm using pycharm and am not sure how to correct this. My Project Interpreter is referencing 10.6: If this needs to be in a new thread let me know. I just want to be able to save my mxd's to troubleshoot
... View more
08-06-2018
02:11 PM
|
0
|
1
|
3067
|
|
POST
|
The current map document is not open. I just added the rest of the code so you can see all of it.
... View more
08-06-2018
01:14 PM
|
0
|
4
|
3067
|
|
POST
|
Layer definition query and symbology not updating using arcpy - what am I missing? import arcpy, os
arcpy.env.overwriteOutput = True
grab = arcpy.GetParameterAsText(0)
prep_list = grab.split(";")
mxd_c = arcpy.mapping.MapDocument(r"T:\GIS\Projects\GIS\Online\MapDocuments\FeederMapCover.mxd")
lyrs_c = arcpy.mapping.ListLayers(mxd_c)
feederList = ["HB2", "HB3"]
print "got feeder list"
arcpy.AddMessage("...starting map book...")
for feeder in feederList:
arcpy.env.overwriteOutput = True
for lyr in arcpy.mapping.ListLayers(mxd_c):
if lyr.name == "Overhead":
lyr.definitionQuery = "esUplineFeeder = '" + feeder + "'"
if lyr.name == "Primary Underground Conductor":
lyr.definitionQuery = "esUplineFeeder = '" + feeder + "'"
print "Definition Queries Set" + feeder
# Find Overview Data Frame and Zoom to the Map Index
df = arcpy.mapping.ListDataFrames(mxd_c, "Layers")[0]
zoomLayer = arcpy.mapping.ListLayers(mxd_c, "Overhead", df)[0]
df.extent = zoomLayer.getSelectedExtent(False)
df.scale = df.scale * 1.5
print "Zoomed Successfully"
# Make and Add the FeederMapIndexLAYER feature layer to the map and refresh the view
arcpy.env.workspace = r"T:\GIS\Projects\GIS\Online\SpatialData\FeederMaps.gdb"
FeederMap = "T:\GIS\Projects\GIS\Online\SpatialData\FeederMaps.gdb\FeederMapIndex"
arcpy.MakeFeatureLayer_management(FeederMap, "FeederMapIndexLAYER")
print "Feature Layer Created"
addLayer = arcpy.mapping.Layer('FeederMapIndexLAYER')
print "Feature Layer Added to Map"
arcpy.mapping.AddLayer(df, addLayer)
arcpy.RefreshTOC()
arcpy.RefreshActiveView()
# Field Calculator InMap = 0
arcpy.CalculateField_management("FeederMapIndexLAYER", "InMap", expression= 0 )
print "Index Field Calculator Worked"
# Select FeederMapIndexLayer polygons that intersect Overhead Lines and Calculate FeederMapIndex = 1
Selection = arcpy.SelectLayerByLocation_management('FeederMapIndexLAYER', 'INTERSECT', 'Overhead')
print "Index Selection Completed"
arcpy.CalculateField_management("FeederMapIndexLAYER", "InMap", expression= 1 )
print "Index Field Calculator Worked"
#Set FeederMapIndex Layer Definition Query and Refresh Map
for lyr in arcpy.mapping.ListLayers(mxd_c):
if lyr.name == "FeederMapIndexLAYER":
lyr.definitionQuery = "InMap = 1"
arcpy.RefreshTOC()
arcpy.RefreshActiveView()
print "Index Definition Query Worked"
#Export the Map to a PDF
arcpy.ApplySymbologyFromLayer_management('FeederMapIndexLAYER', 'C:/Users/azumwalt.UECOOP/Desktop/FeederMapIndex.lyr')
arcpy.RefreshTOC()
arcpy.RefreshActiveView()
outputPath = r"Z:\FeederMaps\PDFs\Map" + feeder + "Cover.pdf"
arcpy.mapping.ExportToPDF(mxd_c, outputPath)
print"Map Book Printed" + feeder
print "complete"
... View more
08-06-2018
11:28 AM
|
0
|
14
|
5923
|
| Title | Kudos | Posted |
|---|---|---|
| 2 | 02-19-2019 03:06 PM | |
| 1 | 10-03-2017 03:35 PM | |
| 1 | 08-20-2018 05:54 PM | |
| 1 | 08-08-2018 03:46 PM | |
| 1 | 12-10-2018 01:50 PM |
| Online Status |
Offline
|
| Date Last Visited |
02-11-2024
04:29 PM
|