POST
|
polyCount = int(arcpy.GetCount_management(precincts)[0])
counter = 1
seqFld = "SEQUENCE"
queryString = '"' + seqFld + '" = {}'.format(counter)
print str(counter) + " of " + str(polyCount)
arcpy.SelectLayerByAttribute_management("precincts", "NEW_SELECTION", queryString)
for i in range(1, 178):
queryString = '"' + seqFld + '" = {}'.format(counter)
arcpy.SelectLayerByAttribute_management("precincts", "NEW_SELECTION", queryString)
precValue = ([r[0] for r in arcpy.da.SearchCursor("precincts", ["CODE"])])
precNum = precValue[0]
print precNum
queryPrec = "Code = " + str(precNum)
fields = ['Reg_voters', 'Turn_out', 'No19Rep']
arcpy.SelectLayerByAttribute_management("csvGdbase", "NEW_SELECTION", queryPrec)
arcpy.SelectLayerByAttribute_management("csvGdbase", "SUBSET_SELECTION", queryCont1)
arcpy.SelectLayerByAttribute_management("csvGdbase", "SUBSET_SELECTION", queryCand1)
with arcpy.da.SearchCursor("csvGdbase", ("Reg_voters", "Turn_Out", "total_votes")) as cursor:
for row in cursor:
print row[0]
print row[1]
print row[2]
with arcpy.da.UpdateCursor(precincts, fields) as uCursor:
for uRow in uCursor:
uCursor.updateRow(row)
arcpy.SelectLayerByAttribute_management("csvGdbase", "NEW_SELECTION", queryPrec)
arcpy.SelectLayerByAttribute_management("csvGdbase", "SUBSET_SELECTION", queryCont1)
arcpy.SelectLayerByAttribute_management("csvGdbase", "SUBSET_SELECTION", queryCand2)
with arcpy.da.SearchCursor("csvGdbase", ("total_votes")) as cursor2:
for row1 in cursor2:
print row1[0]
with arcpy.da.UpdateCursor(precincts, ['No19Main']) as uCursor1:
for uRow1 in uCursor1:
uCursor1.updateRow(row1) Hopefully, this is enough of the code. The geodatabase 'precincts' is already set up with fields - names and alias. It just needs to be populated with updated information from a csv file. If the field 'No19Rep' has an alias of 'No 19 Repealed', then the script bails out. I changed just this field to debug and found that it runs without any spaces in the alias. Would love to keep the spaces, but if there isn't a way around it, then I will go through and change all of them.
... View more
10-18-2018
12:07 PM
|
0
|
0
|
571
|
POST
|
I am writing a Python script that will run automatically every night during the election period. It will take a .csv file from a folder and updates the data in a precinct feature layer that is read in an Operations Dashboard. Right now, the precinct layer is built with Name and an Alias. The Alias spells out the candidate/contest name with spaces. When I run my python script, it bails at.......for uRow in uCursor: uCursor.updateRow(row)......with an 'invalid sql statement' error. I went in an removed all spaces from the alias, and the script runs fine. Do I need to go back and change the alias in all the fields or is there a workaround to get the UpdateCursor to run? The alias works well with Operations Dashboard in that it then labels the bar chart with the correct name automatically. Any ideas?
... View more
10-18-2018
10:02 AM
|
0
|
2
|
672
|
POST
|
Is this what you need? This is just the portion that uploads the shapefiles. Hopefully, it will help you. print 'Starting Upload of Zip Files to AGOL'
if __name__=="__main__":
proxy_port = None
proxy_url = None
securityinfo = {}
securityinfo['security_type'] = 'Portal'
securityinfo['username'] = "username"
username = "username"
securityinfo['password'] = "password"
password = "password"
securityinfo['org_url'] = "http://www.yourorganization.com"
securityinfo['proxy_url'] = proxy_url
securityinfo['proxy_port'] = proxy_port
securityinfo['referer_url'] = None
securityinfo['token_url'] = None
securityinfo['certificatefile'] = None
securityinfo['keyfile'] = None
securityinfo['client_id'] = None
securityinfo['secret_id'] = None
#Zipped Files
url = "http://www.yourorganization.com"
serviceName = "ROZAData"
folderTitle = "Irrigation"
tags = "Data"
folderId = 'foldId'
baseURL = "http://www.yourorganization.com/sharing/rest"
# summary = "ROZA Data File"
maxRecords = 1000
shAGOL = arcrest.AGOLTokenSecurityHandler(username, password)
if shAGOL.valid == False:
print shAGOL.message
else:
sh = arcrest.AGOLTokenSecurityHandler(username, password)
admin = arcrest.manageorg.Administration(securityHandler=sh)
content = admin.content
users = content.users
user = users.user()
user.currentFolder = "Irrigation"
zippedFlList = {zipDir + "dist_bndy.zip", zipDir + "lat_pt.zip", zipDir + "laterals.zip", zipDir + "delivery.zip",
zipDir + "drain_pt.zip", zipDir + "drains.zip", zipDir + "canalrow.zip", zipDir + "canals.zip"}
for zFile in zippedFlList:
if (zFile == zipDir + "dist_bndy.zip"):
title = "DistrictBoundary"
if (zFile == zipDir + "lat_pt.zip"):
title = "LateralPoints"
if (zFile == zipDir + "laterals.zip"):
title = "Laterals"
if (zFile == zipDir + "delivery.zip"):
title = "Deliveries"
if (zFile == zipDir + "drain_pt.zip"):
title = "DrainPoints"
if (zFile == zipDir + "drains.zip"):
title = "Drains"
if (zFile == zipDir + "canalrow.zip"):
title = "MainCanalRightofWay"
if (zFile == zipDir + "canals.zip"):
title = "MainCanals"
itemParams = arcrest.manageorg.ItemParameter()
itemParams.title = title
itemParams.type = "Shapefile"
itemParams.overwrite = True
itemParams.description = "ROZA Irrigation Data Layers"
itemParams.tags = "tags"
itemParams.snippet = "ROZA Irrigation Data Layers"
itemParams.typeKeywords = "Data"
item = user.addItem(
itemParameters=itemParams,
filePath = zFile,
overwrite = True,
folder = folderId,
relationshipType=None,
originItemId=None,
destinationItemId=None,
serviceProxyParams=None,
metadata=None)
print item.title + " Created"
itemId = item.id
print itemId
publishParams = arcrest.manageorg.PublishShapefileParameter(name=title, layerInfo={"type":"Shapefile"})
result = user.publishItem(fileType="Shapefile", publishParameters=publishParams, itemId=itemId, overwrite = True)
print 'Finished'
... View more
03-09-2018
08:54 AM
|
2
|
0
|
3021
|
POST
|
That's it! I used the MapImageLayer instead, and I got my labels. If that is what it takes for now. Thank you!
... View more
01-09-2018
03:27 PM
|
0
|
0
|
466
|
POST
|
I am new to javascript, but I am trying to put together a fairly simple application with v4.6. I have a contour layer that I am adding with new FeatureLayer(), but I am having a hard time getting it to label with elevation. I have tried using a Map Service hosted on our server, as well as, a hosted Feature Layer on AGOL (where the contours are already labeled in both). No luck with either. I have read that you can't label a 2D map, does this mean that it is virtually impossible to label the contours?? Is there any work around? A label would be so much better than a pop-up. Thanks for the help.
... View more
01-09-2018
02:59 PM
|
0
|
16
|
2448
|
POST
|
An updated version of it, yes. It is where I initially grabbed the code. I'll try looking through it again.
... View more
12-20-2017
01:21 PM
|
0
|
0
|
468
|
POST
|
Yes, you are right. My updated version does have a /0 at the end, but there is still something about the related tables that it does not like.
... View more
12-20-2017
12:40 PM
|
0
|
2
|
468
|
POST
|
This is my first attempt at a Javascript app, so I am very new at this. We are trying to upgrade an old MapObjects site that sees a lot of traffic. Mainly, people click on a parcel and it shows them all the information about that parcel. There are several tables that are linked to the parcel layer. I have tried creating a Map Service (hosted on our server) that has the parcel layer with a relationship class to the tables, and I have also tried creating a feature layer (hosted on AGOL) that is created from the parcels with those same relationship classes. Neither of these have worked. I may not have set these up correctly either. If I point the url to a parcel layer with no related tables, it works. As soon as I change that url to the map service or the feature layer with related tables, nothing shows in the popup. What is the best way to go about getting a popup with related tables? Any help is appreciated. var parcels = new FeatureLayer({
url: "https://services3.arcgis.com/XXXXXXXXXXXXXX/arcgis/rest/services/Parcels/FeatureServer",
id: "taxlots",
outFields: ["*"],
popupTemplate: { // autocasts as new PopupTemplate()
title: "Parcel Number: ",
content: [{
type: "fields",
fieldInfos: [{
fieldName: "ASSESSOR_N",
visible: true,
label: "Assessor Number"
}, {
fieldName: "relationships/0/FIRST_NAME",
visible: true,
label: "First Name"
}, {
fieldName: "relationships/0/LAST_NAME",
visible: true,
label: "Last Name"
}]
}]
},
});
... View more
12-20-2017
11:10 AM
|
0
|
4
|
831
|
POST
|
Did anyone find a solution to this? I am having the same exact problem with 2.6. Everything works great until that Layer List widget is opened and then it is all downhill from there.
... View more
10-26-2017
10:43 AM
|
0
|
0
|
435
|
POST
|
I am not seeing any 400 errors. I will definitely look into the refreshInterval.
... View more
10-24-2017
12:00 PM
|
0
|
0
|
477
|
POST
|
Sorry for the delay answering - long weekend. The one Error that comes up is : TypeError: Cannot read property 'refreshInterval' of null. Do you think that is what is causing the slow down??
... View more
10-24-2017
09:24 AM
|
0
|
2
|
477
|
POST
|
Kurtis, Did you find any solution to this?? We are having the same exact problem, and found it related to the Layer List! -Cindy
... View more
10-20-2017
05:11 PM
|
0
|
0
|
1225
|
POST
|
I have discovered that this only happens once the Layer List widget is open!! After that, rendering is really slow - even if the Layer List is closed again. Is there something with this widget?
... View more
10-20-2017
05:07 PM
|
0
|
4
|
477
|
POST
|
I have a Web Map that I created in ArcGIS Online with data that is hosted on our server. When you pan around and zoom in and out in the map viewer, things draw really fast. I have created an Application with Web AppBuilder Developer on our server with this map and when you pan, things draw fast, but when you zoom in and out, it takes quite a while for the drawing to render. Why is there such a lag in drawing in the Application? Is there something I can do to speed this up? It doesn't matter if they are images or just vectors either. Thanks so much for any help.
... View more
10-19-2017
09:52 AM
|
0
|
5
|
812
|
POST
|
Thank you so much, Robert. I think that I will just wait, so that everything is kept in the same version.
... View more
10-10-2017
08:33 AM
|
1
|
1
|
499
|
Title | Kudos | Posted |
---|---|---|
1 | 05-23-2017 03:14 PM | |
2 | 01-08-2020 09:01 AM | |
1 | 09-09-2016 08:50 AM | |
1 | 10-10-2019 10:45 AM | |
2 | 11-02-2018 11:23 AM |
Online Status |
Offline
|
Date Last Visited |
05-13-2024
10:08 AM
|