POST
|
Some problems I have been having: Layer doesn't display when turned on yet pop-up info works for layer. Layers turned on by themselves when layer is off by default. All pop-ups being disabled. When configuring pop-ups the pop-up title is taken from another layer. "Show Related Records" link not appearing in pop-up when it's enabled. These are some of the things going on since this morning. I can't get 1 and 5 fixed.
... View more
05-13-2016
12:37 PM
|
0
|
2
|
2140
|
POST
|
Yeah, I think that's what I will do. The idea of having everything in one file that I could send to people that they could double click and install was enticing.
... View more
04-29-2016
07:08 AM
|
0
|
1
|
540
|
POST
|
When I said in_memory doesn't work I meant as the out_folder_path with CreateDatabaseConnection_management. We restrict most users to .lyr files which have the database connections included in the file. In the Python add-in documentation: Packaging data and toolboxes in the install directory would be pretty handy in this situation. I could create the file in a directory then delete it after.
... View more
04-29-2016
06:38 AM
|
0
|
3
|
540
|
POST
|
I'm about ready to deploy an add-in but I'm not sure how to handle database connections. I know I can include files used by the add-in (ArcCatalog database connection file?) in the install directory for packaging when the add-in file is created, but how do i code the file location? I can include the path to the file that is used while developing, but won't that change when it's all packaged into the .esriaddin file? Also, "in_memory" doesn't work. Thanks
... View more
04-29-2016
05:43 AM
|
0
|
5
|
3391
|
POST
|
I found my stoopid mistake. The result of this function is a list: qtable = arcpy.mapping.ListTableViews(mxd, "results", df) As such I need a for loop to iterate over the list, even if it's just one item in the list. So changing the MakeQueryTable function to this: table = arcpy.MakeTableView_management(eadFacil, "results", "Name like '%" + query + "%'") and adding the for loop solves my problem.
... View more
04-26-2016
07:59 AM
|
0
|
0
|
814
|
POST
|
the in_table is the object (qtable) created from on line 15 of the onFocus code snippet in the original post. qtable = arcpy.mapping.ListTableViews(mxd, "results", df)
... View more
04-26-2016
05:47 AM
|
0
|
0
|
814
|
POST
|
I suppose I could add the table view and then use DefinitionQuery property instead of MakeQueryTable....
... View more
04-26-2016
05:31 AM
|
0
|
0
|
814
|
POST
|
The table is created with MakeQueryTable_management As per your comment I replaced ListLayers with ListTableViews on line 10 of the code snippet above and received this error message: >>> <geoprocessing Map object object at 0x060262E0> <geoprocessing Data Frame object object at 0x11D7F020> [<TableView object at 0x11b38cf0[0x11d80cc8]>] ***NOTE: Table object is recognized now**** Traceback (most recent call last): File "C:\Users\brad.jones\AppData\Local\ESRI\Desktop10.3\AssemblyCache\{8865179D-7740-4EE8-B020-9C6E94E9174D}\EADpart2_addin.py", line 259, in onFocus with arcpy.da.SearchCursor(qtable, ["Name", "Address"]) as cursor: RuntimeError: 'in_table' is not a table or a featureclass ***NOTE: But not with the Search Cursor****
... View more
04-26-2016
05:19 AM
|
0
|
0
|
814
|
POST
|
I'm working on a Python add-in with a combobox where a user queries a table of facilities by name then zooms to a feature selected (many more steps because it's a nonspatial table with related featureclass). Because there can be multiple facilities with the same name I have the results in a query table added to the TOC. If there is only one result the mxd it zooms to the selected extent. If the result is >1 I want to populate a combo box (same or second one) with the results in the query table so the user can select from that list (facility name and address). The problem is it won't recognize the results query table in the mxd. When I create a search cursor to read the query table and append them to the combobox I get: RuntimeError: 'in_table' is not a table or a featureclass Here is the code from onFocus. def onFocus(self, focused):
# Empty the Combobox items list
self.items = []
# Establish a reference to the current MXD
mxd = arcpy.mapping.MapDocument("Current")
print mxd
# Establish a reference to the first DataFrame object in the current MXD
df = arcpy.mapping.ListDataFrames(mxd)[0]
print df
# Create table object for results query table
qtable = arcpy.mapping.ListTableViews(mxd, "results", df)
print qtable
with arcpy.da.SearchCursor(qtable, ["Name", "Address"]) as cursor:
for row in cursor:
self.items.append(row)
print row
del mxd, df This is my first Python add-in. Thanks EDIT: Here is some more code: def onEnter(self):
# Set current mxd and dataframe.
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "")[0]
# Make Query Table
env.workspace = r"********PATH TO SDE CONNECTION********"
eadFacil = "FEATURECLASS"
print(query)
table = arcpy.MakeQueryTable_management(eadFacil, "results", "", "", "", "Name" + " like '%" + query + "%'")
print(table)
result = arcpy.GetCount_management(table)
count = int(result.getOutput(0))
print(count)
# Conditional statement based on number of results returned.
if count == 1:
with arcpy.da.SearchCursor(table, ["BO", "Factype"], "Name" + " like '%" + query + "%'") as cursor:
for row in cursor:
building = row[0]
print building
code = row[1]
print code
... View more
04-25-2016
01:03 PM
|
0
|
6
|
2922
|
POST
|
Old Data: A FC of building polygons with the name of a facility we inspect. If the building had >1 facility per building (very common) only one was included. New Data: FC of building polygons that contain facilities and a table (non-spatial) of facilities. There is a 1-M relationship class of buildings to facilities (M facilities to 1 building). Facilities table contains all the information we have on the facility in our sql database. We have a custom addin that included a facility search/zoom tool (by name) that searched the old--incomplete--data. Our users would like a new tool for the new data. The Problem: Our users have no database connections. They use .lyr files. So if I create a geoprocessing tool or a Python Addin that querys the facilities table then related FC and zooms to the selected FC building they will need a database connection. Or at least I think so. Any ideas of how to do this without connecting them to the sde? Also on a python approach for selecting the related records?
... View more
04-18-2016
09:30 AM
|
0
|
1
|
2406
|
POST
|
Derek, thanks for the pace of updates on WAB Developer Edition. This is great! Where do we go or who do we contact to submit bugs or enhancements? I have one. I can't sort fields in the table that opens when I select "Show Related Records" (1-M relationship). To quote my boss " the app would be perfect if we could do that." Thanks for making me look talented. Brad
... View more
04-06-2016
11:38 AM
|
2
|
1
|
560
|
POST
|
I'm a total noob when it comes to the JavaScript API. I'm teaching myself. I'm trying to use the UniqueValueRenderer to render one of my feature layers. When I do it with a simple renderer in the code that's commented out it works. When I use UniqueValueRenderer or ClassBreaksRenderer the layer doesn't draw. What am I missing? Thanks require(["esri/map",
"esri/layers/FeatureLayer",
"esri/symbols/SimpleLineSymbol",
"esri/renderers/UniqueValueRenderer",
"esri/InfoTemplate",
"dojo/on",
"dojo/_base/Color",
"dojo/domReady!"],
function(Map,
FeatureLayer,
SimpleLineSymbol,
UniqueValueRenderer,
InfoTemplate,
on,
Color) {
var map = new Map("map", {
basemap: "streets",
center: [-92.331404, 34.746788],
zoom: 13,
logo: false
});
// create the FeatureLayer object
var sewerLines = new FeatureLayer("http://maps.lrwu.com/wa/rest/services/MoreLayers/MapServer/1", {
mode: FeatureLayer.MODE_ONDEMAND,
outFields: ["UPS_MH", "DWN_MH", "PIPLEN", "PIPDIA", "UPS_DWN", "UNITTYPE"],
displayOnPan: false
});
var manholes = new FeatureLayer("http://maps.lrwu.com/wa/rest/services/MoreLayers/MapServer/0", {
mode: FeatureLayer.MODE_ONDEMAND,
outFields: ["MH_NO", "SERVSTAT", "MHDPTH", "INSTDATE", "DROPMH", "OWN", "COMPKEY"],
displayOnPan: false
});
var eadFacilities = new FeatureLayer("http://maps.lrwu.com/wa/rest/services/MoreLayers/MapServer/7", {
mode: FeatureLayer.MODE_ONDEMAND,
outFields: ["BO_UNIQ", "PERMITTEE", "PERMITTYPE", "ACCOUNTNO", "TRUNKLINE"],
displayOnPan: false
});
//Set the symbol and render the sewerLines
//var symbol = new SimpleLineSymbol(
// SimpleLineSymbol.STYLE_SOLID,
// new Color([255,0,0,1]),
// 3);
var renderer = new UniqueValueRenderer(null, "UNITTYPE");
renderer.addValue("GRAVITY", new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([0, 0, 0, 1]), 3));
renderer.addValue("FORCE", new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([ 0, 0, 255, 1]), 3));
renderer.addValue("PRVGRV", new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([0, 128, 0, 1]), 3));
sewerLines.setRenderer(renderer);
// addLayers must use an array to list layers added.
map.addLayers([sewerLines, manholes, eadFacilities]);
});
... View more
03-04-2016
07:41 AM
|
0
|
3
|
2317
|
POST
|
Yeah, I see that now. And the original problem isn't as broad as I thought. The attributes show up sometime. It may have something to do with my IDE. On to AMD.
... View more
01-26-2016
11:18 AM
|
0
|
0
|
369
|
POST
|
I stand corrected. When I choose display all field attributes they do not all display as can be seen in the screen capture. Both PIPELEN and PIPEDIA are both "double" data types.
... View more
01-26-2016
10:38 AM
|
0
|
2
|
369
|
Title | Kudos | Posted |
---|---|---|
2 | 04-06-2016 11:38 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|