POST
|
I am receiving the following error when trying to use XY Table to Point in a Python Script: Traceback (most recent call last):
File "C:\Users\kierc\projects\SubTelCableMap\01 Update Current Position.py", line 22, in <module>
arcpy.XYTableToPoint_management(in_table=Ship_Positions_csv, out_feature_class=ShipLatestPosition, x_field="AIS.LONGITUDE", y_field="AIS.LATITUDE", z_field="", coordinate_system="GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]];-400 -400 1000000000;-100000 10000;-100000 10000;8.98315284119521E-09;0.001;0.001;IsHighPrecision")
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 3992, in XYTableToPoint
raise e
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 3989, in XYTableToPoint
retval = convertArcObjectToPythonObject(gp.XYTableToPoint_management(*gp_fixargs((in_table, out_feature_class, x_field, y_field, z_field, coordinate_system), True)))
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 511, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: Traceback (most recent call last):
File "c:\program files\arcgis\pro\Resources\ArcToolbox\Scripts\XYTableToPoint.py", line 183, in <module>
xy_table_to_points(in_table, output_fc, x_field, y_field, z_field, coordinate_system)
File "c:\program files\arcgis\pro\Resources\ArcToolbox\Scripts\XYTableToPoint.py", line 158, in xy_table_to_points
coord_values.append(row[scur.fields.index(val)])
ValueError: tuple.index(x): x not in tuple
Failed to execute (XYTableToPoint). Unfortunately, I'm having trouble understanding just what this error means. This script previously ran without trouble on a previous computer. I have kept all filenames and file paths the same. Even running a normal XY Table to Point tool within ArcGIS Pro fails to complete with the following error: Traceback (most recent call last):
File "c:\program files\arcgis\pro\Resources\ArcToolbox\Scripts\XYTableToPoint.py", line 183, in <module>
xy_table_to_points(in_table, output_fc, x_field, y_field, z_field, coordinate_system)
File "c:\program files\arcgis\pro\Resources\ArcToolbox\Scripts\XYTableToPoint.py", line 158, in xy_table_to_points
coord_values.append(row[scur.fields.index(val)])
ValueError: tuple.index(x): x not in tuple
Failed to execute (XYTableToPoint). Looking for any guidance here. The code for the Python script is as follows: # -*- coding: utf-8 -*-
"""Generated by ArcGIS ModelBuilder on: 2019-12-14 00:22:34
All ModelBuilder functionality may not be exported. Edits may be required for equivalency with the original model.
"""
import arcpy
# To allow overwriting the outputs change the overwrite option to true.
arcpy.env.overwriteOutput = True
# Local variables:
Ship_Positions_csv = r"C:\Users\kierc\projects\api\Ship_Positions.csv"
ShipLatestPosition = r"C:\Users\kierc\Documents\ArcGIS\Projects\SubTelCableMap\SubTelCableMap.gdb\ShipLatestPosition"
CurrentCableShipPositionTmp = r"C:\Users\kierc\Documents\ArcGIS\Projects\SubTelCableMap\SubTelCableMap.gdb\CurrentCableShipPositionTmp"
Updated_Target_Dataset = CurrentCableShipPositionTmp
CurrentCableShipPosition = r"C:\Users\kierc\Documents\ArcGIS\Projects\SubTelCableMap\SubTelCableMap.gdb\CurrentCableShipPosition"
Updated_Input_With_Rows_Removed = CurrentCableShipPosition
# Process: XY Table To Point
tempEnvironment0 = arcpy.env.outputCoordinateSystem
tempEnvironment0 = arcpy.env.outputCoordinateSystem
arcpy.XYTableToPoint_management(in_table=Ship_Positions_csv, out_feature_class=ShipLatestPosition, x_field="AIS.LONGITUDE", y_field="AIS.LATITUDE", z_field="", coordinate_system="GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]];-400 -400 1000000000;-100000 10000;-100000 10000;8.98315284119521E-09;0.001;0.001;IsHighPrecision")
arcpy.env.outputCoordinateSystem = tempEnvironment0
# Process: Copy Features
arcpy.CopyFeatures_management(in_features=ShipLatestPosition, out_feature_class=CurrentCableShipPositionTmp, config_keyword="", spatial_grid_1="", spatial_grid_2="", spatial_grid_3="")
# Process: Delete Rows
arcpy.DeleteRows_management(in_rows=CurrentCableShipPosition)
# Process: Append
arcpy.Append_management(inputs=r"C:\Users\kierc\Documents\ArcGIS\Projects\SubTelCableMap\SubTelCableMap.gdb\CurrentCableShipPositionTmp", target=Updated_Input_With_Rows_Removed, schema_type="TEST", field_mapping="", subtype="", expression="")
This was originally made with Model Builder in Pro 2.4 and cleaned up/tweaked slightly by me after exporting to a editable Python file. Edit: For some reason, manually renaming the AIS.LATITUDE/AIS.LONGITUDE fields in my CSV file to simply LATITUDE/LONGITUDE allows the XY Table to Point tool to run successfully in ArcGIS Pro. I'm not sure why this would suddenly not work and I'd rather not having to add an additional step of renaming data fields.
... View more
03-06-2020
04:33 PM
|
1
|
9
|
4629
|
POST
|
I am looking for some guidance from some more experienced folks on how to optimize our online map: SubTel Cable Map In particular, the Cable Ship Position History layer is causing some headache. Our goal is to track 45-50 ships 4 times a day with a 30 day history. However, we're only 2 weeks in and the layer is causing the load times to grind to a halt. I had to set the layer to be hidden until the user zooms in to a certain level in order to reduce map clutter, but as they zoom in an trigger the layer to display, it grinds everything to a halt for a long period of time. Ideally, I would like to not have to reduce the number of data points we capture so I'm looking for some other ways I can try to optimize or display this information. Any other performance/visualization optimizations that you might are also greatly appreciated. I am currently using Web App Builder Dev Edition 2.12, and the map is hosted through our ArcGIS Online portal. Please let me know if any additional information is needed. I am happy to answer but not quite sure what else might be relevant! Edit: I had originally tried to set it up so that the ship history layer was off until users clicked to enable it in the left hand Info Summary widget but this had the unfortunate side effect of not zooming to clicked entries in the ship history layer.
... View more
02-13-2020
08:34 AM
|
0
|
0
|
303
|
POST
|
That was exactly it, thank you for catching this. I streamlined how a lot of my tables and references work so I missed this one. Thanks!
... View more
01-15-2020
12:21 PM
|
1
|
0
|
351
|
POST
|
So I originally had this solved through this thread: Custom Attribute Expression in ArcGIS Online to Show Related Table Information but since then I have learned a lot more about ArcGIS and have changed the way things are structured in my web map. I'm having trouble getting the Arcade expression updated to do the same thing. The following code produces the pop up information I want in ArcGIS Pro, but does not work once the map is published to the web: var cityname = $feature.City; // read out the city
var sql = "tblLanding_EXPORT.City" + " = '" + cityname + "'"; // create query
var table = FeatureSetByName($map,"LandingsWithCables_EXPORT"); // get access to table
var related_records = Filter(table, sql); // filter the table for relevant records
var cnt = Count(related_records); // determine the number of records found
var result = "";
if (cnt == 0) {
// no records found
result = "No cable systems found";
} else {
// we have related records, let's create the text to return
result = cnt + " cable system(s) found:";
for (var record in related_records) {
var txt = TextFormatting.NewLine + " - " + record.SystemName; // use the correct field name from the table
result += txt;
}
}
return result; The web map can be found here: https://arcg.is/1vSTTC0 I think it's just a matter of getting the right variable/field/table names but for the life of me I can't figure out why it's not working when the map is put online. Any insight would be greatly appreciated.
... View more
01-15-2020
10:52 AM
|
0
|
2
|
460
|
POST
|
Understood. I'm the only user on my computer and it is an administrator - the user stays logged in.
... View more
01-07-2020
07:26 AM
|
0
|
1
|
571
|
POST
|
Not sure what you mean by that - do you mean Windows user?
... View more
01-07-2020
07:13 AM
|
0
|
3
|
571
|
POST
|
Hi Joe, Thanks for responding. We had been using a Named User but have converted to a Single Use License. Each organization has a Creator, so I've been able to log in to different accounts to manage each organization's map items. Is there a way to change things in the code to account for this?
... View more
01-07-2020
07:08 AM
|
0
|
5
|
571
|
POST
|
I am receiving the following error when running a Python script to update a map for one of our Operations Dashboard: C:\Users\kierc\projects\XXXXX XXXXXXX Extension Survey\Batch Files for Script Scheduling>"C:\ArcGIS_Pro\Conda\Cloned_Envs\arcgispro-py3-subtel\python.exe" "C:\Users\kierc\projects\api\UpdateXXXXXMap.py"
Creating SD file
Traceback (most recent call last):
File "C:\Users\kierc\projects\api\UpdateXXXXXMap.py", line 33, in <module>
arcpy.mp.CreateWebLayerSDDraft(mp, sddraft, sd_fs_name, 'MY_HOSTED_SERVICES', 'FEATURE_ACCESS', True, True)
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\mp.py", line 105, in CreateWebLayerSDDraft
return _convertArcObjectToPythonObject(arcgisscripting._mapping.CreateWebLayerSDDraft(*_gp_fixargs([map_or_layers, out_sddraft, service_name, server_type, service_type, folder_name, overwrite_existing_service, copy_data_to_server, enable_editing, allow_exporting, enable_sync, summary, tags, description, credits, use_limitations], True)))
RuntimeError I have X'd out the actual name of the files as there is some potentially sensitive information associated with the names, but the character counts and spacing are preserved. Additionally, this is only an issue if I am logged out in ArcGIS Pro. However, logging in to ArcGIS Pro is not a full solution as I will need to be updating maps soon for multiple organizations. The following is the Python script I am using: import arcpy
import os, sys
from arcgis.gis import GIS
### Start setting variables
# Set the path to the project
prjPath = r'C:\Users\kierc\Documents\ArcGIS\Projects\XXXXXXXXXXXExt\XXXXXXXXXXXExt.aprx'
# Update the following variables to match:
# Feature service/SD name in arcgis.com, user/password of the owner account
sd_fs_name = "XXXXX_XXXXXX_Extention_Inshore_Survey_WFL1"
portal = "http://www.arcgis.com" # Can also reference a local portal
user = "XXXXXXXXXXX"
password = "XXXXXXXXXXXXX"
# Set sharing options
shrOrg = False
shrEveryone = False
shrGroups = ""
### End setting variables
# Local paths to create temporary content
relPath = r'C:\Users\kierc\projects\api\arcgistempcurrent'
sddraft = os.path.join(relPath, "CurrentUpdate.sddraft")
sd = os.path.join(relPath, "CurrentUpdate.sd")
# Create a new SDDraft and stage to SD
print("Creating SD file")
arcpy.env.overwriteOutput = True
prj = arcpy.mp.ArcGISProject(prjPath)
mp = prj.listMaps()[0]
arcpy.mp.CreateWebLayerSDDraft(mp, sddraft, sd_fs_name, 'MY_HOSTED_SERVICES', 'FEATURE_ACCESS', True, True)
arcpy.StageService_server(sddraft, sd)
print("Connecting to {}".format(portal))
gis = GIS(portal, user, password)
# Find the SD, update it, publish /w overwrite and set sharing and metadata
print("Search for original SD on portal…")
sdItem = gis.content.search("{} AND owner:{}".format(sd_fs_name, user), item_type="Service Definition")[0]
print("Found SD: {}, ID: {} n Uploading and overwriting…".format(sdItem.title, sdItem.id))
sdItem.update(data=sd)
print("Overwriting existing feature service…")
fs = sdItem.publish(overwrite=True)
if shrOrg or shrEveryone or shrGroups:
print("Setting sharing options…")
fs.share(org=shrOrg, everyone=shrEveryone, groups=shrGroups)
print("Finished updating: {} – ID: {}".format(fs.title, fs.id)) Once again, specific filenames have been X'd out with number of characters and any spacing preserved. This script successfully updates the map as intended when logged in to ArcGIS Pro.
... View more
01-06-2020
10:57 AM
|
0
|
7
|
691
|
POST
|
Here is my use case: I have an operations Dashboard set up to display a bunch of data to a client outside of our company. We have viewer licenses for them. They need to be able to view all the data in the associated map layers in order for the Dashboard to be functional. However, we do not want them to be able to view all the layers and survey results in the Contents tab. We don't mind them seeing their data, but we're trying to keep the backend processes opaque. Currently, I have custom groups and a user role set up such that when they click the "My Groups" tab under "Content" it only shows the dashboard. This is great, and eventually what we want to restrict their view to. However, clicking "My Organization" still displays all the individual layers/features used to populate the dashboard. This is what I would like to remove, but I don't see a way around it as if the feature is not shared with them it doesn't appear in their Dashboard view. Hopefully I've made this clear, but please ask any clarifying questions if I haven't explained something well enough.
... View more
12-05-2019
11:03 AM
|
0
|
3
|
1094
|
POST
|
Hi Stephanie, I'm not quite sure what you mean. Could you screenshot where you're talking about?
... View more
07-30-2019
09:53 AM
|
0
|
0
|
833
|
POST
|
Ah, perfect. Got mine added successfully now, thanks!
... View more
07-23-2019
09:59 AM
|
0
|
8
|
5057
|
POST
|
Is it possible to add Google Analytics to my web app? As we've made custom changes to some of the widgets, we deploy on our own web server so I'm hoping it's just a matter of adding the tracking code to the right file.
... View more
07-23-2019
09:46 AM
|
1
|
10
|
6397
|
POST
|
Thank you so much for your reply! I actually figured this out myself late last night when I remembered "Inspect Element" exists and was going to edit my post to reflect that after I got into the office this morning. I'm not a web developer or anything so I wasn't even thinking about it. Anyway, "Inspect Element" has really helped me out and enabled me to figure out how to change some other design elements we were looking to change. I really appreciate you taking the time to help me out! Updated map can be found here for anyone interested: https://stfanalytics.com/submarine-cables-of-the-world/
... View more
07-19-2019
06:47 AM
|
0
|
2
|
833
|
POST
|
I'm trying to change the color of the panels that pop up when using certain widgets on my web app. We have cable systems in the highest capacity tier colored white so they stand out the most on our map. However, as the background of the Legend and the left-hand layer list in the Jewelry Box theme are white, this color is lost. See image below for what I'm trying to edit. I just need to know which file I can find the right attribute to change.
... View more
07-18-2019
09:18 AM
|
0
|
4
|
957
|
POST
|
Got it working! The "record" variable was undeclared. This code now works: var cityname = $feature["STF_Cable_DBO__tblLanding_City"]; // read out the city
var sql = "Cable_Landings_Export_City" + " = '" + cityname + "'"; // create query
var table = FeatureSetByName($map, "subcablemapbackup_gdb - LandingPlusCableTable"); // get access to table
var related_records = Filter(table, sql); // filter the table for relevant records
var record = "All_Cables_Table_Export_SystemN";
var cnt = Count(related_records); // determine the number of records found
var result = "";
if (cnt == 0) {
// no records found
result = "No cable systems found";
} else {
// we have related records, let's create the text to return
result = cnt + "cable system(s) found:";
for (record in related_records) {
var txt = TextFormatting.NewLine + " - " + record.All_Cables_Table_Export_SystemN; // use the correct field name from the table
result += txt;
}
}
return result; Thank you so much for your help!
... View more
07-10-2019
09:52 AM
|
0
|
1
|
581
|
Title | Kudos | Posted |
---|---|---|
2 | 02-22-2023 12:19 PM | |
1 | 07-23-2019 09:46 AM | |
1 | 03-06-2020 04:33 PM | |
2 | 04-20-2021 10:02 AM | |
2 | 04-23-2021 11:59 AM |
Online Status |
Offline
|
Date Last Visited |
04-26-2023
07:35 PM
|