|
POST
|
This discussion is full of poop... Anyway, since you've ventured out of printing in Python to crafting an HTML email (which is an adventure in its self), you should start looking up ways to solve your problem with HTML. For example, the col width table attribute might be something to try for setting the width of the columns in your table. Instead, I suspect you might actually want to just set the table width to 100%. Ultimately though, you'll be limited by the screen size of the email client rendering the html message.
... View more
12-16-2016
03:22 PM
|
0
|
0
|
8231
|
|
POST
|
First, I want to point out there's a nice syntax highlighting feature in GeoNet for posting code blocks. Posting code with Syntax Highlighting on GeoNet Are you getting an error when running your code or are you just looking for advice on how to add the counter you mentioned? If it isn't doing what you want, please describe what is wrong.
... View more
12-01-2016
12:32 PM
|
1
|
0
|
3818
|
|
POST
|
I didn't mean that you actually needed to have topology rules created, just describe to us how the two are supposed to exist. You probably only need to snap them if it would help some custom process to clean it up. The Point Distance tool won't care if there's a transmission line snapped to the pole.
... View more
12-01-2016
09:34 AM
|
0
|
0
|
1361
|
|
POST
|
The Point Distance tool is doing exactly what it is supposed to. I think you're trying to make it do something it's not meant to. That's why I asked if you have some specific rules about how your poles are connected. Please describe the topological interaction between poles and transmission lines. In other words: how would a computer know that it needs to measure the distance to one pole but not another?
... View more
12-01-2016
08:53 AM
|
1
|
0
|
1361
|
|
POST
|
I'm thinking I need an if statement (if metadata exists, write that, else write "None"). That's where I would start.
... View more
12-01-2016
08:32 AM
|
3
|
1
|
5517
|
|
POST
|
If there is a specific rule about how you want to measure the distance to a feature other than "if it's nearby", then you might need to do some extra logic to filter out the unnecessary measurements.
... View more
11-30-2016
04:14 PM
|
1
|
0
|
4832
|
|
POST
|
ObjectID is not random; it's a unique, sequential number automatically assigned by a ArcGIS to create a primary key field. the FID in the tool's output is referring to the ObjectID field. If you want have it show one of your key fields instead, you'll have to do a table join on ObjectID. I got tired of doing this so I made a script that will generate a near table that automatically includes a key field of my choice. *Disclaimer: I made some adjustments to the code just now to make it more generic and have not tested* import arcpy
import os
try:
# Set local variables
working_gdb = r"C:\temp\TEMP.gdb"
## IN and NEAR features can be the same
in_fc = "FirstFeatureClass"
in_fc_key = "MyKeyFieldName" ## Assumes Long Integer data type
in_fc_path = os.path.join(working_gdb, in_fc)
near_fc = "SecondFeatureClass"
near_fc_key = "MyKeyFieldName" ## Assumes Long Integer data type
near_fc_path = os.path.join(working_gdb, near_fc)
search_radius = "25 Feet"
# Create near table and make as TableView
neartable_inmem = os.path.join("in_memory", "neartable_inmem")
arcpy.GenerateNearTable_analysis(
in_fc_path, ## in_features
near_fc_path, ## near_features
neartable_inmem, ## out_table
search_radius, ## search_radius
"NO_LOCATION", ## location
"NO_ANGLE", ## angle
"ALL", ## closest
"0", ## closest_count
"PLANAR" ## method
)
if arcpy.GetMessages(1):
print arcpy.GetMessages(1) ## Write arcpy warning
arcpy.MakeTableView_management(neartable_inmem, "neartable_view")
print "Near table created"
# Add key fields to near table
in_key = "IN_{}".format(near_fc_key)
arcpy.AddField_management(
"neartable_view", ## in_table
in_key, ## field_name
"LONG", ## field_type
)
if arcpy.GetMessages(1):
print arcpy.GetMessages(1) ## Write arcpy warning
near_key = "NEAR_{}".format(near_fc_key)
arcpy.AddField_management(
"neartable_view", ## in_table
near_key, ## field_name
"LONG", ## field_type
)
if arcpy.GetMessages(1):
print arcpy.GetMessages(1) ## Write arcpy warning
print "New key fields added"
# Join and calc in_key field
arcpy.AddJoin_management(
"neartable_view", ## in_layer_or_view
"IN_FID", ## in_field
in_fc_path, ## join_table
"OBJECTID", ## join_field
"KEEP_COMMON" ## join_type
)
if arcpy.GetMessages(1):
print arcpy.GetMessages(1) ## Write arcpy warning
arcpy.CalculateField_management(
"neartable_view", ## in_table
in_key, ## field
"!{}!".format(in_fc_key), ## expression
"PYTHON_9.3" ## expression_type
)
if arcpy.GetMessages(1):
print arcpy.GetMessages(1) ## Write arcpy warning
arcpy.RemoveJoin_management("neartable_view")
if arcpy.GetMessages(1):
print arcpy.GetMessages(1) ## Write arcpy warning
print "{} field populated".format(in_key)
# Join and calc near_key
arcpy.AddJoin_management(
"neartable_view", ## in_layer_or_view
"NEAR_FID", ## in_field
near_fc_path, ## join_table
"OBJECTID", ## join_field
"KEEP_COMMON" ## join_type
)
if arcpy.GetMessages(1):
print arcpy.GetMessages(1) ## Write arcpy warning
arcpy.CalculateField_management(
"neartable_view", ## in_table
near_key, ## field
"!{}!".format(near_fc_key), ## expression
"PYTHON_9.3" ## expression_type
)
if arcpy.GetMessages(1):
print arcpy.GetMessages(1) ## Write arcpy warning
arcpy.RemoveJoin_management("neartable_view")
if arcpy.GetMessages(1):
print arcpy.GetMessages(1) ## Write arcpy warning
print "{} field populated".format(near_key)
# Export final near table
out_near_table_path = os.path.join(
working_gdb,
"{}_nearKey".format(arcpy.ValidateTableName(in_fc, working_gdb))
)
arcpy.CopyRows_management(
"neartable_view", ## in_rows
out_near_table_path ## out_table
)
if arcpy.GetMessages(1):
print arcpy.GetMessages(1) ## Write arcpy warning
print "Near table output at {}".format(out_near_table_path)
except Exception as err:
print err
## If there was an ArcPy error, write all of the messages returned by the last tool
if arcpy.GetMessages(2):
print arcpy.GetMessages()
finally:
# Cleanup
arcpy.Delete_management("in_memory")
... View more
11-30-2016
04:11 PM
|
0
|
0
|
4832
|
|
POST
|
When using the Point Distance tool, are you specifying the search_radius parameter? If you don't, it gives you the distance to all other points; which seems like it's not what you're after. It sounds like maybe you only want to look at other poles that are connected by a segment of transmission line. What are the rules by which you name your poles and how do your transmission line features connect them?
... View more
11-30-2016
11:27 AM
|
1
|
1
|
4832
|
|
POST
|
You have an except block but you just pass. Maybe you are getting an error but you are simply ignoring it. Try printing the error instead of just using pass. except Exception as err:
print err
... View more
11-30-2016
11:11 AM
|
1
|
4
|
5518
|
|
POST
|
Looks like this is what I needed. Thanks again, Robert.
... View more
11-30-2016
07:18 AM
|
1
|
0
|
1925
|
|
POST
|
I think Robert has got me on the right track here. It's not that I'm seeing the incorrect image in the app, it's that when I download it to host locally I noticed it has a bunch of old thumbnail images that I'm no longer using. However, I have noticed that clearing the browser's cache does resolve other issues like you described.
... View more
11-29-2016
12:20 PM
|
0
|
0
|
1925
|
|
POST
|
All loading and basemap gallery thumbnail images I've used since the creation of my app are saved when I download it. Is there a reason for this, is there a way to prevent it, and what is the best way to clean out the old/unused ones?
... View more
11-29-2016
09:57 AM
|
0
|
4
|
2417
|
|
POST
|
I had this problem too!. Although I never knew the cause, I found that just importing datetime (your first example) worked for me. Good to know the second option is viable too. Thanks CDow-esristaff!
... View more
11-23-2016
11:57 AM
|
2
|
1
|
11181
|
|
BLOG
|
I never knew about the PDFDocument class. That's pretty handy!
... View more
11-21-2016
03:32 PM
|
2
|
0
|
1637
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | a month ago | |
| 1 | 10-23-2025 03:53 PM | |
| 1 | 04-28-2026 07:25 AM | |
| 1 | 03-19-2026 08:59 AM | |
| 1 | 02-12-2026 01:37 PM |