POST
|
Hi @RyanCoodey , I know this is an old thread but I ran into the same issue and found a solution on this page https://support.esri.com/en/technical-article/000025937 . I was missing.... panel.setPosition(panel.position);
panel.panelManager.normalizePanel(panel); The full code of what worked for me is: var pm = PanelManager.getInstance();
var panelID = pm.activePanel.id;
var activePanel = pm.getPanelById(panelID);
activePanel.position.width = 669;
activePanel.setPosition(activePanel.position);
activePanel.panelManager.normalizePanel(activePanel);
... View more
11-01-2022
01:41 PM
|
0
|
0
|
273
|
POST
|
Hi @Vakhtang_Zubiashvili , I would highly recommend that you reach out to ESRI support on this one. Especially since it is dealing with CORS and Proxies, which can both come with some security considerations. Best of luck!
... View more
05-31-2022
06:03 AM
|
0
|
0
|
3399
|
POST
|
Thank you so much @Kara_Shindle ! This is extremely helpful
... View more
01-25-2022
05:04 AM
|
0
|
0
|
2092
|
POST
|
Hi, I know this doesn't directly answer your question regarding how to implement Oauth2 (am not familiar enough with it to speak on the subject). But in regards to bypassing log in prompts for secured services you might look into storing credentials within a registered service (if that is something you can do in your situation). Then use the rest end point for the registered service in your JavaScript code. You would be using ESRI as a proxy more or less, and you can still manage the sharing access of the registered service through your portal or AGOL. The coolest part is that you can even manage the traffic for the registered service, so that it will only allow requests from specified URLs. Connect to secure services—Portal for ArcGIS | Documentation for ArcGIS Enterprise How To: Add secure ArcGIS Server services as items in ArcGIS Online (esri.com)
... View more
01-21-2022
03:19 PM
|
0
|
0
|
422
|
POST
|
Thank you @Kara_Shindle this is really helpful! I really appreciate you sharing your experience with model builder and the insight that it is a lateral move. We just finished a long process of upgrading our scripts to python 3 (just the syntax differences, we did not change any logic to boost performance at the time, although hindsight is 20/20) and I believe that did speed things up a bit for us. Offloading some of the processes like date conversions to SQL and utilizing attribute rules are two ideas i had not considered. I will definitely see where I can implement those tactics. I am unfamiliar with multiprocessing, do you happen to have any example code that you would feel comfortable sharing or perhaps any articles on the subject that were helpful to you?
... View more
01-21-2022
02:45 PM
|
0
|
2
|
2151
|
POST
|
I really like the workflow of breaking things out into daily, weekly, monthly triggers. Thank you JeffK!
... View more
01-21-2022
02:29 PM
|
0
|
0
|
2153
|
POST
|
Hi Josh, Thanks for the fast reply! That is a great workflow that I had not considered. I will certainly need to investigate which scripts this will work for. I know that there are several that utilize non-published FCs exclusively and some scripts that utilize both published services and non-published FCs. I imagine that I will still need to use the direct SDE connection for those. Consolidating the others though (and removing the Lock code) should improve things greatly.
... View more
01-21-2022
10:23 AM
|
0
|
0
|
2183
|
POST
|
Hi all! My Question: Any advice on running multiple python scripts each evening to automate geoprocessing tools? My Problem: I am trying to improve my organizations python scripts. We have multiple SDEs and multiple scripts connecting to these SDEs all running nightly via a batch file and windows task scheduler. We have arrived at a point where we do not have any more time in the evening to add more scripts. Each script establishes a lock with one or more SDEs, so only one script can run at a time. This seems really inefficient to me, but i am not sure how to do things otherwise. We would receive errors almost every night relating to 'lock' issues before we added the portion in the script that disconnects other users and denies connections to the databases (until the script ends). We have arcPro, and i have heard that you can create models in there and have them run nightly as well, but i am uncertain if this would be more efficient or just a lateral move. The complexity of each script varies but they all follow a general outline which is: 1. import modules 2. create log 3. disconnect users from sde to establish lock 4. run geoprocessing logic 5. allow connections again. here is some sample code: import arcpy
import logging
import datetime
import time
import sys
import os
# create log
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
formatter = logging.Formatter("%(asctime)s:%(levelname)s:%(message)s")
file_handler = logging.FileHandler("C:....<location of log file>logFile.log")
file_handler.setFormatter(formatter)
logger.addHandler(file_handler)
arcpy.env.overwriteOutput = True
# Current Day
Day = time.strftime("%m-%d-%Y", time.localtime())
# Current Time
Time = time.strftime("%I:%M:%S %p", time.localtime())
# Local variables:
sde_1 = r"C:..<path to sde>...FIRST_SDE.sde"
sde_2 = r"C:..<path to sde>...SECOND_SDE.sde"
input_fc = r"C:..<path to sde>...FIRST_SDE.sde\FeatureClassInput"
output_fc = r"C:..<path to sde>...FIRST_SDE.sde\FeatureClassOutput"
logger.info("\n"*4)
try:
# Get a list of connected users to sde_1 and sde_2
userList_sde_1 = arcpy.ListUsers(sde_1)
userList_sde_2 = arcpy.ListUsers(sde_2)
# Pull names of current connections
userNames_sde_1 = [uL.Name for uL in userList_sde_1]
logger.info("These users are connected to sde_1.sde: " +
str(userNames_sde_1))
# Pull names of current connections
userNames_sde_2 = [uL.Name for uL in userList_sde_2]
logger.info("These users are connected to sde_2.sde: " +
str(userNames_sde_2))
# No longer accept connections to the databases
arcpy.AcceptConnections(sde_1, False)
logger.info("sde_1.sde is no longer accepting connections")
arcpy.AcceptConnections(sde_2, False)
logger.info("sde_2.sde is no longer accepting connections")
# Disconnect all users from the databases
arcpy.DisconnectUser(sde_1, "ALL")
print("disconnecting sde_1 users")
logger.info("Disconnecting sde_1 users" + str(userNames_sde_1))
arcpy.DisconnectUser(sde_2, "ALL")
print("disconnecting sde_2 users")
logger.info("Disconnecting sde_2 users" + str(userNames_sde_2))
except:
logger.exception(
"There is an error with disconnecting users from databases")
try:
# Start Time
logger.info('Process Started at ' + str(Day) + " " + str(Time))
# arcpy buffer tool
arcpy.Buffer_analysis(input_fc, output_fc, "50 METERS")
logger.info("Select Parcels \n")
#other geoprocessing tools go here
#....
#....
#....
#....
#....
#....
except:
logger.exception("There is an error with the arcpy portion of the script")
#Check to see if it was a lock issue....
userList_sde_1_afterDisconnect = arcpy.ListUsers(sde_1)
userList_sde_2_afterDisconnect = arcpy.ListUsers(sde_2)
# Check connections again for sde_1
userNames_sde_1 = [uL.Name for uL in userList_sde_1_afterDisconnect]
logger.info(
"These users are connected to sde_1 despite disconnect code: " + str(userNames_sde_1))
# Check connections again for sde_2
userNames_sde_2 = [uL.Name for uL in userList_sde_2_afterDisconnect]
logger.info(
"These users are connected to sde_2 despite disconnect code: " + str(userNames_sde_2))
try:
# Accept new connections to the database
arcpy.AcceptConnections(sde_1, True)
logger.info("sde_1 is accepting connections")
arcpy.AcceptConnections(sde_2, True)
logger.info("sde_2 is accepting connections")
except:
logger.exception(
"There is an error with allowing the databases to accept connections again")
logger.info("End of Script")
file_handler.close()
... View more
01-21-2022
09:21 AM
|
0
|
9
|
2222
|
POST
|
Looking into this, i saw the following in the api docs. "The WMSLayer initially executes a WMS GetCapabilities request, which might require CORS or a proxy page." (source:https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-WMSLayer.html ) Since you are unable to enable/disable CORS you may need to look into a proxy. https://developers.arcgis.com/javascript/latest/proxies/ I have had some success with this proxy in the past with handling CORS issues https://github.com/Esri/resource-proxy HOWEVER, esri has since added the following disclaimer "We don't recommend using this resource proxy. It is not being maintained and there's been no active development for many years. There are many better solutions." But at the very least, the GIT README can shed some light on how a proxy can be integrated depending on your environment. I hope that helps!
... View more
12-20-2021
07:56 AM
|
1
|
3
|
3947
|
POST
|
Hi, In the WAB Developer edition, in the samplewidgets folder, there is a sample for jquery. I copied the example into my custom widget and it resulted in a 'multiple define' error in Edge developer tools. Removing jquery from 'define' in my widget resolved the 'multiple define' error, and as far as I can tell, jquery still works in my widget. Is jquery already being loaded in at the app level somewhere? The app is using the 'dashboard theme' and besides the widget there is no other customization. I have not explicitly included jquery anywhere else in the app. Thank you define([
// dojo required modules
"dojo/_base/declare",
'dojo/_base/lang',
"dojo/_base/array",
"dojo/store/Memory",
// jimu required modules
"jimu/BaseWidget",
'jimu/loaderplugins/jquery-loader!https://code.jquery.com/jquery-git1.min.js',
'jimu/dijit/Message',
// dgrid required modules
"dgrid/OnDemandGrid",
"dgrid/Selection",
"dgrid/editor",
// esri required modules
'esri/tasks/query',
'esri/tasks/QueryTask',
"esri/layers/FeatureLayer",
'esri/graphic',
'esri/Color',
'esri/symbols/SimpleMarkerSymbol',
'esri/symbols/SimpleLineSymbol',
// dijit required modules
"dijit/form/Select",
'dijit/_WidgetsInTemplateMixin',
"dijit/layout/ContentPane"
],
function (
// dojo required modules
declare,
lang,
arrayUtils,
Memory,
// jimu required modules
BaseWidget,
$,
Message,
// dgrid required modules
Grid,
Selection,
editor,
// esri required modules
Query,
QueryTask,
FeatureLayer,
Graphic,
Color,
SimpleMarkerSymbol,
SimpleLineSymbol,
// dijit required modules
Select,
_WidgetsInTemplateMixin
) {
var clazz = declare([BaseWidget, _WidgetsInTemplateMixin], {
... View more
12-16-2021
11:55 AM
|
0
|
0
|
237
|
POST
|
I simplified the code for testing and was able to download a PDF (finally). These are the changes I made: 1. added dojo/domReady, 2. changed new jsPDF() to new jsPDF.jsPDF() 3. updated the URL of the third party library to https://unpkg.com/jspdf@latest/dist/jspdf.umd.min.js so that it uses the latest version. One other thing to note, is that in my original post i called doc.fromHTML() in accordance with the code sample i referenced. But when i take a look at the console log --> console.log("this is the doc: ", doc) I do not see fromHTML(). So maybe that was just from a past version of the library? I am not sure, I could be reading the console.log wrong. This is the Javascript code, hopefully it help point someone in the right direction. ///////////////////////////////////////////////////////////////////////////
define([
'dojo/_base/declare',
'jimu/BaseWidget',
'https://unpkg.com/jspdf@latest/dist/jspdf.umd.min.js',
//'./widgets/Testing_PDF_Stuff/libs/jsPDF-master/dist/jspdf.umd.min.js',
'jimu/loaderplugins/jquery-loader!https://code.jquery.com/jquery-3.4.1.js,https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.js',
'dojo/domReady!'
],
function(
declare,
BaseWidget,
jsPDF,
$,
domReady)
{
return declare([BaseWidget], {
baseClass: 'jimu-widget-Testing_PDF_Stuff',
postCreate: function() {
this.inherited(arguments);
console.log('postCreate');
},
startup: function() {
this.inherited(arguments);
$('#cmd').click(function () {
const doc = new jsPDF.jsPDF();
doc.text("Hello world!", 10, 10);
doc.save("a4.pdf");
});
}
});
});
... View more
03-25-2021
01:11 PM
|
0
|
0
|
3781
|
POST
|
Hi, I am trying to use a third party library (jsPDF) in my custom widget and I am getting the error jsPDF is not a constructor at Object.startup I am using the code here Edit fiddle - JSFiddle - Code Playground. I would greatly appreciate it if anyone can help me understand why the code is not working. Javascript ///////////////////////////////////////////////////////////////////////////
define([
'dojo/_base/declare',
'jimu/BaseWidget',
'https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.3.1/jspdf.umd.min.js',
//'./widgets/JointUseWidget/libs/jsPDF-master/dist/jspdf.node.min.js',
'jimu/loaderplugins/jquery-loader!https://code.jquery.com/jquery-3.4.1.js,https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.js'
],
function(
declare,
BaseWidget,
jsPDF,
$)
{
return declare([BaseWidget], {
baseClass: 'jimu-widget-Testing_PDF_Stuff',
postCreate: function() {
this.inherited(arguments);
console.log('postCreate');
},
startup: function() {
this.inherited(arguments);
var doc = new jsPDF();
var specialElementHandlers = {
'#editor': function (element, renderer) {
return true;
}
};
$('#cmd').click(function () {
doc.fromHTML($('#content').html(), 15, 15, {
'width': 170,
'elementHandlers': specialElementHandlers
});
doc.save('sample-file.pdf');
});
},
});
}); HTML <div>
<div id="content">
<h3>Hello, this is a H3 tag</h3>
<p>a pararaph</p>
</div>
<div id="editor"></div>
<button id="cmd">Generate PDF</button>
</div>
... View more
03-25-2021
11:45 AM
|
0
|
1
|
3839
|
POST
|
I am pretty new to custom widgets but i believe that you will want to look in the string.js file in the 'nls' folder. Around line 27 you should see relatedItemTitle: "Related Table/Layer". Hope that is what you are looking for!
... View more
08-26-2020
05:05 PM
|
0
|
0
|
379
|
POST
|
Hi, I have not found any post relating to this, so I figured I would post a question about this topic. Is it possible to populate repeats from existing points in the collector app? For context, I have a a feature class that has poles with pole numbers. I am attempting to create a survey that allows users to create attachment requests for multiple poles under the same permit number. This is the CSV that I have created I am trying to use the following URL to populate the pole number and pole location within the Repeat group. arcgis-survey123://?itemID=<the survey id>&field:polenumber={wmElementName}¢er={wmYCoordinate},{wmXCoordinate} But it will not populate in the repeat. In a perfect world, I would like for the individual to hop into the Collector app, select multiple poles, click the URL link, have that open up in Survey123 with a repeat for the number of poles that were selected (so if they selected 4 poles, 4 repeats would be created) and populate the repeats with the geometry of each pole and the pole numbers of each selected pole. Any help with this would be greatly appreciated. Below is an example of what I would want to auto populate in Survey123 when the URL in Collector is clicked. Repeat 1...first pole location and pole number Repeat 2...second pole location and pole number ...etc. Thanks! Brackston
... View more
03-09-2020
12:47 PM
|
0
|
7
|
2069
|
Title | Kudos | Posted |
---|---|---|
1 | 12-20-2021 07:56 AM |
Online Status |
Offline
|
Date Last Visited |
02-04-2024
06:50 AM
|