POST
|
How can I publish an XY event layer and have changes which are made to the table made to the XY event layer published service as well ? I've made changes to the table, but they were not reflected in the published service. What is the solution so that I am able to see any changes made to the table, that they will be made to the XY event layer as well? I am able to view the data via XY Event layer, which I initially thought was an in-memory layer, but it is, however, an instance of the view/or data set that I am using. The ideal scenario would be: 1.) Make event layer of XY from SDE table 2.) Publish service definition 3.) All changes will be reflected in published event layer. I am using ArcGIS Server 10.4.1
... View more
01-18-2017
02:12 PM
|
0
|
0
|
1251
|
POST
|
I have two values, one date and one time, I would like to only calculate my new field if the value for the field is NULL. How do I do so using ArcPy? My current code reads as. calcExpression = "!ORIGDTDATE!+\" \"+ !ORIGDTTIME!"
arcpy.CalculateField_management(self.line_ticket_feature_class,"emergency_overdue",calcExpression,"PYTHON_9.3")
arcpy.CalculateField_management(self.poly_ticket_feature_class,"emergency_overdue",calcExpression,"PYTHON_9.3")
... View more
11-28-2016
10:18 AM
|
0
|
1
|
929
|
POST
|
I would like to write a function which allows a user to enter coordinates a via a widget for a WebApplication Builder application. The user should be able to enter coordinates and the point appears on the map and posts to a feature service if the coordinates intersect with a line feature/map service. Is there a widget that already harnesses this functionality, if not, how can this be done?
... View more
11-15-2016
04:31 PM
|
0
|
2
|
1030
|
POST
|
I was able to sort this out; I mistakingly had used a variable incorrectly. Here is my corrected code. Define the funtion def DistrictFunction(distfc, totalexpression, totalscline, statsfield, fields,TotalLong): print "DistrictFunction called" print "distfc: " + distfc print "totalexpression: " + totalexpression print "totalscline: " + totalscline print statsfield print fields print TotalLong unique_name = arcpy.CreateUniqueName("featureLyr") arcpy.MakeFeatureLayer_management(linefc, unique_name, totalexpression) arcpy.Statistics_analysis(unique_name, totalscline , statsfield, "DISTRICT") arcpy.JoinField_management(distfc, "NAME", totalscline, "DISTRICT", fields) with arcpy.da.UpdateCursor(distfc, ["FREQUENCY"]) as cursor: for row in cursor: if row[0] == None: row[0] = 0 cursor.updateRow(row) #Calculate and Join Totals per District Polys arcpy.MakeFeatureLayer_management(polyfc, unique_name, totalexpression) arcpy.Statistics_analysis(unique_name, totalscpoly , statsfield, "DISTRICT") arcpy.JoinField_management(distfc, "NAME", totalscpoly, "DISTRICT", fields) with arcpy.da.UpdateCursor(distfc, ["FREQUENCY_1"]) as cursor: for row in cursor: if row[0] == None: row[0] = 0 cursor.updateRow(row) arcpy.CalculateField_management(distfc, TotalLong, totalCalc) arcpy.DeleteField_management(distfc, ["FREQUENCY", "FREQUENCY_1"]) def SummaryStats(): try: DistrictFunction(distfc, totalexpression, totalscline, statsfield, fields, TotalLong) DistrictFunction(distfc, totalexpression, totalscpoly, statsfield, fields, TotalLong) DistrictFunction(distfc, overDueExpression, overDueLine, statsfield, fields, OverDueTotal) DistrictFunction(distfc, overDueExpression, OverDuePoly, statsfield, fields, OverDueTotal) DistrictFunction(distfc, inProgressExpression, inProgressLine, statsfield, fields, inProgresstotal) DistrictFunction(distfc, inProgressExpression, inProgressPoly, statsfield, fields, inProgresstotal) DistrictFunction(distfc, unKnownExpression, unKnownLine, statsfield, fields, unKnownTotal) DistrictFunction(distfc, unKnownExpression, unKnownPoly, statsfield, fields, unKnownTotal) DistrictFunction(distfc, upComingExpression, upComingLine, statsfield, fields, upComingTotal) DistrictFunction(distfc, upComingExpression, upComingPoly, statsfield, fields, upComingTotal) except Exception as e: logger.info(e.message, exc_info=True) raise e SummaryStats()
... View more
10-24-2016
12:07 PM
|
1
|
0
|
2090
|
POST
|
James, I should have specified 21 times with different parameters each time.
... View more
10-24-2016
10:45 AM
|
0
|
1
|
2090
|
POST
|
So Kristen, When you say that I am not executing the functions, how should my code be modified so that I can execute the 3rd call of DistrictFunction in my SummaryStats function?
... View more
10-24-2016
10:18 AM
|
0
|
1
|
2090
|
POST
|
I have this block of code that I would like repeated 21 times. It creates a feature layer, executes summary statistics, joins a field, executes update cursor twice, for a line and polygon feature class. Lastly, it calculates a field and deletes two fields. Can somebody please explain to me the logic of the Python method/function? How does the program know which variable should be called within an ArcPy function? The block of code below has within the first function what I would like executed 21 times. However, when the SummaryStats(DistrictConfig) is executed, I do not receive my expected output. What is being done incorrectly? import arcpy
import DistrictConfig
import logging
import logging.handlers
import ConfigParser
LOGGER_NAME = 'korterra_district'
arcpy.env.workspace = r"C:\KorTerraTables\tables_db.gdb"
arcpy.env.overwriteOutput = True
from datetime import datetime
startTime = datetime.now()
logger = logging.getLogger(LOGGER_NAME)
distfc = DistrictConfig.distfc
linefc = DistrictConfig.linefc
polyfc = DistrictConfig.polyfc
totalexpression = DistrictConfig.TotalExpression
totalscline = DistrictConfig.TotalSCLine
totalscpoly = DistrictConfig.TotalSCPoly
statsfield = DistrictConfig.StatsField
fields = DistrictConfig.fields
totalCalc = DistrictConfig.TotalCalc
unique_name = arcpy.CreateUniqueName("featureLyr")
transPoly = DistrictConfig.Overdue_Expression_SC_Tran
overDueLine = DistrictConfig.OverdueTableSC_TransLine
overDueExpression = DistrictConfig.Overdue_Expression
statusCaseFields = DistrictConfig.CaseFields
TotalLong ="TOTAL_LONG"
OverDueTotal = "OVERDUE"
def DistrictFunction(DistrictConfig, distfc, totalexpression, totalscline, statsfield, fields,TotalLong):
print "Calculating Total Line Tickets per District"
arcpy.MakeFeatureLayer_management(linefc, unique_name, totalexpression)
arcpy.Statistics_analysis(unique_name, totalscline , statsfield, "DISTRICT")
arcpy.JoinField_management(distfc, "NAME", totalscline, "DISTRICT", fields)
with arcpy.da.UpdateCursor(distfc, ["FREQUENCY"]) as cursor:
for row in cursor:
if row[0] == None:
row[0] = 0
cursor.updateRow(row)
#Calculate and Join Totals per District Polys
arcpy.MakeFeatureLayer_management(polyfc, unique_name, totalexpression)
arcpy.Statistics_analysis(unique_name, totalscpoly , statsfield, "DISTRICT")
arcpy.JoinField_management(distfc, "NAME", totalscpoly, "DISTRICT", fields)
with arcpy.da.UpdateCursor(distfc, ["FREQUENCY_1"]) as cursor:
for row in cursor:
if row[0] == None:
row[0] = 0
cursor.updateRow(row)
arcpy.CalculateField_management(distfc, TotalLong, totalCalc)
arcpy.DeleteField_management(distfc, ["FREQUENCY", "FREQUENCY_1"])
def SummaryStats(DistrictConfig):
try:
## DistrictFunction(DistrictConfig, distfc, totalexpression, totalscline, statsfield, fields, TotalLong )
## DistrictFunction(DistrictConfig, distfc, totalexpression, totalscpoly, statsfield, fields, TotalLong)
DistrictFunction(DistrictConfig, distfc, overDueExpression, overDueLine, statsfield, fields, OverDueTotal)
except Exception as e:
logger.info(e.message, exc_info=True)
raise e
... View more
10-24-2016
09:41 AM
|
0
|
8
|
4812
|
POST
|
I am not receiving any errors. However, I will change this in the script.
... View more
10-21-2016
02:03 PM
|
0
|
0
|
257
|
POST
|
I have a Python application where the same ArcPy functions are called 20+ times. I have begun constructing a method for this application to make the code more readable and Pythonic. However I have gotten stuck and need a bit of assistance in moving forward with what I have. The objective of this application is to create a feature layer, summary stats table, and join to another feature class. I am working with a polygon and line feature layer and a polygon feature class that I am executing the join on. The unique parameters for each ArcPy function are where clauses, output summary statistics tables, statistics fields, polygon layer to join to, and fields to keep from the join. My example is below, what needs to be added/modified to this so that I can successfully add the my other parameters to my SummaryStats function to execute the method for all other parameters, i.e. whereclauses, feature classes etc. import arcpy
import DistrictConfig
import logging
import logging.handlers
import ConfigParser
LOGGER_NAME = 'korterra_district'
arcpy.env.workspace = "C:\KorTerraTables\tables_db.gdb"
arcpy.env.overwriteOutput = True
from datetime import datetime
startTime = datetime.now()
logger = logging.getLogger(LOGGER_NAME)
distfc = DistrictConfig.distfc
linefc = DistrictConfig.linefc
polyfc = DistrictConfig.polyfc
totalexpression = DistrictConfig.TotalExpression
totalscline = DistrictConfig.TotalSCLine
totalscpoly = DistrictConfig.TotalSCPoly
statsfield = DistrictConfig.StatsField
fields = DistrictConfig.fields
totalCalc = DistrictConfig.TotalCalc
class GeodatabaseConnection():
""" Defines a connection to a geodatabase """
def __init__(DistrictConfig):
def DistrictFunction(DistrictConfig, distfc, linefc, totalexpression, totalscline, statsfield, fields, totalCalc):
print "Calculating Total Line Tickets per District"
arcpy.MakeFeatureLayer_management(linefc, "line_layer_test_total", totalexpression)
arcpy.Statistics_analysis("line_layer_test_total", totalscline , statsfield, "DISTRICT")
arcpy.JoinField_management(distfc, "NAME", totalscline, "DISTRICT", fields)
with arcpy.da.UpdateCursor(distfc, ["FREQUENCY"]) as cursor:
for row in cursor:
if row[0] == None:
row[0] = 0
cursor.updateRow(row)
#Calculate and Join Totals per District Polys
arcpy.MakeFeatureLayer_management(polyfc, "poly_layer_test_total", totalexpression)
arcpy.Statistics_analysis("poly_layer_test_total", totalscpoly , statsfield, "DISTRICT")
arcpy.JoinField_management(distfc, "NAME", totalscpoly, "DISTRICT", fields)
with arcpy.da.UpdateCursor(distfc, ["FREQUENCY_1"]) as cursor:
for row in cursor:
if row[0] == None:
row[0] = 0
cursor.updateRow(row)
arcpy.CalculateField_management(distfc, "TOTAL_LONG", TotalCalc)
arcpy.DeleteField_management(distfc, ["FREQUENCY", "FREQUENCY_1"])
def SummaryStats(DistrictConfig):
try:
DistrictFunction(DistrictConfig, distfc, linefc, totalexpression, totalscline, statsfield, fields, totalCalc)
except Exception as e:
logger.info(e.message, exc_info=True)
raise e
... View more
10-21-2016
09:08 AM
|
0
|
2
|
828
|
POST
|
I am working with a table in a WebAppBuilder application, when the table is open in IE 11 the pixel size appears to be incorrect. In Google Chrome. Where can the pixel size be changed?
... View more
10-18-2016
02:07 PM
|
0
|
0
|
498
|
POST
|
I have a table in an Oracle ArcSDE database where I have joined a feature layer and a table view, the resulting data set is a feature layer with fields from both datasets. In my script I use a version of the database to make the feature layer from the feature class and execute the join. The join could not be executed due to a locked schema, so I took this route. I would like to simply reconcile and post the joined feature layer to my SDE.DEFAULT version. My code below shows my script so far. It does not return any errors; however the "line_dev_layer" and 'aVersion' are not reconciled and posted back to "SDE.DEFAULT". When I execute the script in ArcGIS for Desktop the TableView and the Feature Layer join successfully. Additionally, the reconcile returns as successful too. What could be the cause of this? No errors are returned when I run this script standalone or in the Python window in ArcGIS for Desktop.
linefc = 'C:\GIS Projects\Korterra Script\TEST_PORTAL_SCG.sde\SEU_GIS_GAS.Korterra\SEU_GIS_GAS.line_tickets_DEV'
mobiletable = r'C:\GIS Projects\Korterra Script\TEST_PORTAL_SCG.sde\SEU_GIS_GAS.MobileIDs_District'
db = 'C:\\GIS Projects\\Korterra Script\\TEST_PORTAL_SCG.sde'
copiedFC = 'line_tickets_dev_joined'
fds = 'C:\GIS Projects\Korterra Script\TEST_PORTAL_SCG.sde\SEU_GIS_GAS.Korterra'
Parent = "SDE.DEFAULT"
##print "Creating Version"
##arcpy.CreateVersion_management (r'C:\GIS Projects\Korterra Script\TEST_PORTAL_SCG.sde', Parent, 'KorTerraVersionTest', "PUBLIC")
print "Creating Feature Layer"
arcpy.MakeFeatureLayer_management(linefc, "line_dev_layer")
print "Changing FC Version"
arcpy.ChangeVersion_management("line_dev_layer", 'TRANSACTIONAL', 'SEU_GIS_GAS.KorTerraVersionTest', '')
print "Creating Table View"
arcpy.MakeTableView_management(mobiletable, "MobileView")
print "Changing Table Version"
arcpy.ChangeVersion_management("MobileView", 'TRANSACTIONAL', 'SEU_GIS_GAS.KorTerraVersionTest', '')
print "Joining Fields"
arcpy.AddJoin_management("line_dev_layer", "MOBILEID", "MobileView", "Mobile")
##arcpy.FeatureClassToFeatureClass_conversion("line_dev_layer", fds, copiedFC)
arcpy.ChangeVersion_management('line_dev_layer', "TRANSACTIONAL", "SDE.DEFAULT", '')
print "Reconciling Versions"
arcpy.ReconcileVersions_management(db,"", "SDE.DEFAULT", 'SEU_GIS_GAS.KorTerraVersionTest', with_post = "POST", with_delete = "KEEP_VERSION" )
print "Done"
... View more
09-29-2016
01:50 PM
|
0
|
2
|
1168
|
POST
|
Taken from gis.stackexchange.com I have a process which requires me to update the data of an application every week. The application's data is in an .SDE database while the updated data is in a file geodatabase. The updated data could contain new features or have features removed. The dataset has a relationship class which is why I do not want to delete the feature class. How should this example be adjusted to completely overwrite or update all rows from my FGDB to my .SDE database? import arcpy
fields = "HOUSENO; DIR; STREET; DPAFEEDER; LSDATE; REMARKS; ACCOUNT_NO, SYMBOLROTATION"
fgdbRows = arcpy.SearchCursor(r'Q:\GWP_LifeSupport.gdb\LifeSupport', '''DPAFEEDER IS NOT NULL''', "", fields, "")
for aRow in fgdbRows:
print (aRow.HOUSENO, aRow.DIR, aRow.STREET, aRow.UNIT, aRow.DPAFEEDER, aRow.LSDATE, aRow.REMARKS, aRow.ACCOUNT_NO, aRow.SYMBOLROTATION)
sdeLs = arcpy.UpdateCursor(r'Database Connections\gisDev01.sde\SDEDEV.SDE.LifeSupport')
for row in sdeLs:
sdeLs.updateRow(aRow)
... View more
08-10-2016
03:25 PM
|
0
|
1
|
1192
|
POST
|
I have an application where I need to use a rooftop geocoding service. The use case is a user geocodes an address and a spatial intersection is executed which returns the values of a parcel, since the geocoding service that I am using now is sidewalk or street level, the attributes are not returned. Is there a rooftop geocoding service available by Esri to execute this process?
... View more
08-08-2016
08:36 AM
|
1
|
13
|
2991
|
POST
|
Robert, I don't quite understand. I am executing the search against a layer that is a part of the map. I am familiar with the search widget, however, not the eSearch widget.
... View more
07-26-2016
07:37 AM
|
0
|
1
|
395
|
POST
|
I have an application with a query task that I configured with AGOL WebAppBuilder. I have a simple CONTAINS query that selects all features that contain a certain value of an attribute. How can I adjust the JS so that the features which are NOT selected are not shown when I the query is executed? Is this possible/practical using WebAppBuilder
... View more
07-21-2016
02:26 PM
|
0
|
4
|
1552
|
Title | Kudos | Posted |
---|---|---|
1 | 03-16-2017 02:33 PM | |
1 | 01-18-2022 07:40 AM | |
1 | 04-28-2021 09:29 AM | |
2 | 02-25-2020 02:46 PM | |
1 | 10-24-2016 12:07 PM |
Online Status |
Offline
|
Date Last Visited |
01-18-2022
03:08 PM
|