|
POST
|
Thanks James, I thought that might be possible, but wasn't sure how to do it. I already have a list field for the biologists to select their name from on the main form. On the public view table I set the same field to auto-populate with 'public' when a public survey is submitted. I am thinking I can use that same field in the xlsform calculation field to look for 'public', then set relevant QA fields to be visible when editing the public survey. If that works, I think it would solve some challenges trying to get the dashboard configured that way I want. Franklin
... View more
10-29-2019
10:59 AM
|
0
|
0
|
1379
|
|
POST
|
James, Yes, you are correct. I have the original hosted feature layer, a bioligists view for editing, and a public view. Ideally, I would like the biologists to be able to view and edit the surveys, both public and scientific through the dashboard. I have a dashboard set up with a web app that shows the surveys, a list that can be filtered by biologist, or by public submissions and an embedded content pane that holds the survey to be edited. Right now, I have two survey forms, one for public (much simpler) and one scientific, but both populate the same feature service. I need to have a way for the scientists to QAQC the publicly submitted surveys, but this is a bit tricky since the form will need to have additional questions (fields) such as name of scientist who validated the data, and a checkbox of some sort that affirms the survey was validated. I am thinking that I will need to create a 3rd (QAQC) survey to handle this, but I don't want to add another embedded content pane in the Dashboard, that's too crowded! It would be nice if there was a way to have the applicable survey (biologists or QAQC) populate the same embedded pane, depending on the list selection. I know I can create two lists, one for public surveys, and another for the biologists, but for simplicity would rather of course be able to make it work with a single list for all surveys. Sorry if this is not in the purview of this board, but I figured is sort of pertains the Survey123 and this is my first attempt and using Survey123 connect, and well as the dashboard! Thanks for any suggestions, and it's nice to know at least I am on the right track.
... View more
10-25-2019
05:24 AM
|
0
|
2
|
1379
|
|
POST
|
I have created two surveys for submitting data related to coral reefs. One is for biologists submissions which is more detailed, and the other is a citizen science survey. Both of the surveys are connected to the same hosted feature layer. The biologists need to be able to edit the data and perform QAQC on the publicly submitted data, so I also created a public view layer to add data, and a fieldworker view layer for the biologists with editing permissions. My question is, in order for this to work, the main hosted layer must be shared publicly, but must also have editing enabled. Is this a good idea (since esri give me a warning that it is not), and if not, how do I get around it? In the documentation for Survey 123 it explicitly states "The surveys and hosted feature service must be shared publicly, which in turn, permits anonymous submissions". I already created a group for the biologists, and they must login to be able to edit the data using the Survey form, so is that the correct (best) way to handle this? Just want to know if I am going in the right direction, or is there a better way to do this? Thanks!
... View more
10-23-2019
06:02 AM
|
0
|
4
|
1483
|
|
POST
|
Here is the solution I came up with and it seems to be working (at least on all of the results I have checked so far): let d = new Date(stats2.KillDate);
d.setDate(d.getDate() + 1);
console.log("converted date ", d);
let yy = d.getFullYear().toString();
let mm = (d.getMonth()+1).toString();
if(mm.length === 1) {
mm = '0' + mm;
}
let dd = d.getDate().toString();
if(dd.length === 1) {
dd = '0' + dd;
}
let kd = yy + '-' + mm + '-' + dd; I am always open to better solutions
... View more
10-15-2019
07:34 AM
|
0
|
0
|
999
|
|
POST
|
I have a table stored in a SQL database with a date field that is formatted as such: yyyy-mm-dd. Since I cannot query the table directly from the client site, a view table was created and housed in an esri gdb, then published to ArcGIS REST. For some reason (I didn't create the view table), the date field format in the view table is d/m/yyyy. Now I am querying the data using the REST service url from the query widget.js file using queryTask. What is being returned is an integer for the date, which is fine except the integer being return converts to 1939-12-31, when the correct date (in the database) is 1940-01-01. After playing around with this, I have determined that the javascript date function seems to like the d/m/yyyy format, because that format gets translated correctly, and the yyyy-mm-dd format is one day behind ( I get two different integers). This tells me that when queryTask looks at the view table date field (which has the correctly formatted date), it must actually be seeing the SQL database table field with the format it doesn't like. My question is how do I solve this? I tried this: d = new Date(stats2.KillDate);
let yy = d.getFullYear().toString();
let mm = (d.getMonth()+1).toString();
let dd = (d.getDate()+1.toString();
This works ok most of the time, but it's not 100%. In the case of 1940-01-01, I get 1939-12-32 One last bit of info: 1940-01-01 (stored as date field in SQL database) returns the date integer -946771200000 (converts incorrectly) 1/1/1940 (stored as date field in esri gdb table) would return the better date integer -946753200000 (converts correctly) This can't be the first time this has come up and I am sure there is probable some looong solution (using js switch/case?), but if anyone knows a better way of handling this please advise. Thanks!!
... View more
10-15-2019
07:14 AM
|
0
|
1
|
1041
|
|
POST
|
Ok, this is what finally worked: .esriLegendLayer:nth-child(2) > tbody > tr > td:first-child {
display: none;
} I would still like to know if there is a way to apply the correct color to the 'unique' color symbol above the color ramp based on the type of search (Top Final Score) if anyone can help. Thanks!
... View more
09-24-2019
01:00 PM
|
0
|
0
|
869
|
|
POST
|
Ok, I need lots of help on this one. The legend is not rendering the correct color for one of the symbols and I either need to be able to correct the error, of removed the symbol completely. Cannot seem to do either. The legend is showing results from a query that can be and average score, max score, count, or count/area. The legend symbol is a color ramp with a 'unique' color symbol just above that apparently will only show an average, or the color from the center of the color ramp. This works fine for all of the queries accept for the max score, and I need it to show the color representing the top(max) part of the ramp. The symbol color for the 'Top Final Score' should be red to reflect a score greater than 206. I think I can get the results layer info to apply the correct color to the symbol, but I don't know how/where the color is applied. If this isn't possible, the second choice would be to remove the symbol altogether, which I am able to do by placing this code in the Legend 'start' function: document.querySelector('.esriLegendLayer', this.domNode).getElementsByTagName('td')[0].style.display = "none"; This has the desired effect of removing the symbol, but leaving the label 'Top Final Score'. The problem is that on 'refresh', the symbol appears again. I tried placing the same code in the 'refreshLegend' function, but that function isn't called when the legend is refreshed! If I know where the function is that gets called on 'refresh' and think I am good. I also tried the css route, but so far have not been able to access the <td> element that houses the symbol, since there is no class name or id. I tried the following in the css file: //this removes both the symbol and the label
.esriLegendLayer:nth-of-type(2) tr:first-child td:first-child {
display: none;
}
///also tried///
//this does nothing
.esriLegendLayer:first-of-type tr:first-child td:first-child {
display: none;
} plus about 20-30 other variations. What's weird is that there are two elements with the .esriLegendLayer class name, the first of which contains the <td> element I want to remove, but I have only had luck with the nth-of-type(2) selector. ??? Here is the HTML structure: <table cellpadding="0" cellspacing="0" width="95%" class="esriLegendLayer">
<tbody>
<tr>
<td width="35" align="center"> //only need to hide this column
<div style="width:30px;height:30px;">
<svg overflow="hidden" width="30" height="30" style="touch-action: none;">
<defs></defs><path fill="rgb(253, 174, 97)" fill-opacity="0.95"
stroke="rgb(224, 224, 224)" stroke-opacity="0.9019607843137255" stroke-
width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-
miterlimit="4" path="M -10,-10 L 10,0 L 10,10 L -10,10 L -10,-10 Z" d="M-
10-10L 10 0L 10 10L-10 10L-10-10Z" fill-rule="evenodd" stroke-
dasharray="none" dojoGfxStrokeStyle="solid"
transform="matrix(1.00000000,0.00000000,0.00000000,1.00000000,15.00000000,15.00000000)">
</path>
</svg>
</div>
</td>
<td>
<table width="95%">
<tbody>
<tr>
<td align="left">Avg Final Score</td> //this element stays
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table> Thanks for any suggestions.
... View more
09-24-2019
12:23 PM
|
0
|
1
|
904
|
|
POST
|
Robert, Thanks, I am going to try that. I was able to get it working by getting a count of the results from the first query and then using a counter to count the loops, and when they matched, I executed the showResults function. I am going to try your way as well because it's probably the 'correct' method and I'm not sure it there are any pitfalls to the method I used. Thanks!
... View more
09-19-2019
10:00 AM
|
0
|
0
|
2545
|
|
POST
|
I have a query widget that queries a view table on ArcGIS REST. In the widget.js file, I am building a whereclause with the widget parameters and using QueryTask to query the database. I need to run two instances of QueryTask, the second takes a lot of time because it has to use statistical results from each row from the 1st query by looping through (67 times) to build an array of rows. [ [...], [...], [...] ]. I then need to format the results of the results array and create a layer. All of this works, except that I am having an async issue. I can't start processing the result array to create the layer until it is done populating. I am going to post a general outline of what I have now and what I have tried, but I won't post all of the code because it is hundreds of lines: //build whereclause here
...building whereclause...
var queryTask = new QueryTask(tableUrl);
var buckQuery = new Query();
//statistical definitions here (not shown)
buckQuery.returnGeometry = false;
buckQuery.outFields = ["*"];
buckQuery.outStatistics = [statSum, statAvg, statMax, statCount];
buckQuery.orderByFields = ["COUNTY_NAME"];
buckQuery.where = whereclause;
queryTask.execute(buckQuery).then(function(response) {
var QueryResults = response.features;
let resultArr = [];
for((var i = 0; i < QueryResults.length; i++) {
let rowSum = null;
...more code
rowSum = [c, stats.FINALSCORESUM, stats.FINALSCOREAVG, stats.COUNTY_COUNT,
countArea, stats.MAXFINALSCORE];
var queryTask2 = new QueryTask(tableUrl);
var buckQuery2 = new Query();
buckQuery2.returnGeometry = false;
buckQuery2.outFields = ["COUNTY_NAME", "METHOD", "KillDate", "FULLNAME"];
buckQuery2.where = whereclause2 + " AND FINALSCORE = " + stats.MAXFINALSCORE
+ " AND COUNTY_NAME = '" + stats.COUNTY_NAME + "'";
queryTask.execute(buckQuery2).then(function(response) {
var QueryResults2 = response.features;
let stats2 = QueryResults2[0].attributes;
... more code
rowSum.push(stats2.METHOD.toString(), kd, stats2.FULLNAME);
resultArr.push(rowSum);
});
}
});
if(resultArr !== null || resultArr !== undefined) {
//here is where I need to do everything else
//resultArr is undefined
}
This produces an array as described above, but now I need to use that array to create new Formatted Results for the info window and result layer. All of this works fine (I set a timeout to 6 seconds for testing purposes!), I just can't figure out how to keep the javascript from running ahead, and wait on the result array to finish populating. I tried a few things: First I tried using a Promise/resolve function like this: //build whereclause here
...building whereclause...
var queryTask = new QueryTask(tableUrl);
var buckQuery = new Query();
//statistical definitions here (not shown)
buckQuery.returnGeometry = false;
buckQuery.outFields = ["*"];
buckQuery.outStatistics = [statSum, statAvg, statMax, statCount];
buckQuery.orderByFields = ["COUNTY_NAME"];
buckQuery.where = whereclause;
return new Promise(function(resolve, reject) {
queryTask.execute(buckQuery).then(function(response) {
var QueryResults = response.features;
let resultArr = [];
for((var i = 0; i < QueryResults.length; i++) {
let rowSum = null;
...more code
rowSum = [c, stats.FINALSCORESUM, stats.FINALSCOREAVG, stats.COUNTY_COUNT,
countArea, stats.MAXFINALSCORE];
var queryTask2 = new QueryTask(tableUrl);
var buckQuery2 = new Query();
buckQuery2.returnGeometry = false;
buckQuery2.outFields = ["COUNTY_NAME", "METHOD", "KillDate", "FULLNAME"];
buckQuery2.where = whereclause2 + " AND FINALSCORE = " + stats.MAXFINALSCORE
+ " AND COUNTY_NAME = '" + stats.COUNTY_NAME + "'";
queryTask.execute(buckQuery2).then(function(response) {
var QueryResults2 = response.features;
let stats2 = QueryResults2[0].attributes;
... more code
rowSum.push(stats2.METHOD.toString(), kd, stats2.FULLNAME);
resultArr.push(rowSum);
});
}
});
}).then(function(resultArr) {
showResults(resultArr);
});
function showResults(resultArr) {
...
} but this didn't solve the issue. The showResults function executes without waiting and once again I get undefined for the result array. I also tried using a simple callback: function getQueryResultsAndBuildArray (whereclause, callback)
//this is the same function as above so I won't paste it
...code goes here
callback(resultArr);
}
function showResults(resultArr) {
....
}
getQueryResultsAndBuildArray (whereclause, showResults);
Got the exact same result, undefined when executing the showResults function. Just looking for some input on what I am doing wrong and maybe a better way to approach. Thanks!!
... View more
09-19-2019
07:59 AM
|
0
|
3
|
2758
|
|
POST
|
Ok, this should be very easy, but I cannot figure this out. I just want to display a full size image in a new browser window by clicking a smaller version in a popup window. I don't know why I can't get this to work, but I am getting the images from and ajax call to a web service. The smaller image displays in the popup, but when clicked a new browser opens and nothing is there. See the Temp1 var in line 19. function getBearImage(imageFile, count) {
console.log("getting bear image");
var obj = {
type: "POST",
url: '/BlackBearImages/BBIWebService.asmx/GetImageFile',
data: {
"filename": imageFile
},
contentType: "application/x-www-form-urlencoded", //use for POST type
//contentType: "application/json; charset=utf-8",
error: function (x, y, z, data) {
alert(x.responseText + " " + x.status);
}
};
$.ajax(obj).done(function(data) {
console.log("ajax result ", data);
var cp1, cp2;
var image = data.getElementsByTagName("base64Binary")[0].innerHTML;
let temp1 = "<a href='data:image/jpeg;charset=utf-8;base64," + image + "' target='_blank'><img src='data:image/jpeg;charset=utf-8;base64," + image + "'alt='no image'></img></a>"; //I cannot seem to get the href right.
//let temp1 = "<img src='data:image/jpeg;charset=utf-8;base64," + image + "'alt='no image' onClick='displayInNewTab()'>"
//console.log("bear image ", image);
if(count == 0) {
cp1= new ContentPane({
title: "Image",
content: temp1
});
tc.addChild(cp1);
console.log("image pane ", cp1);
}
if(count == 1) {
cp2= new ContentPane({
title: "Image",
content: temp1
});
tc.addChild(cp2);
}
console.log("text pane ", cpText)
});
} The new browser window opens, but there is no image. As always, thanks for all of your suggestions. Ok, I am answering my own question. Evidently it isn't possible to open base64 URIs in a new Chrome window any more for security reasons. I did find a workaround for anyone who is having the same issue by embedding the image in an iFrame: $.ajax(obj).done(function(data) {
var cp1, cp2;
var image = data.getElementsByTagName("base64Binary")[0].innerHTML;
var base64URL = "data:image/jpeg;charset=utf-8;base64," + image;
function newWindow(base64URL) {
var win = window.open;
win.document.write('<iframe src="' + base64URL + '"style="width:100%; height:100%;" allowfullscreen></iframe>');
}
let temp1 = "<img id='bearImg' src='data:image/jpeg;charset=utf-8;base64," + image + "'alt='no image' style='width:230px; height:215px;'>"
$("img").on("click", function() {
var win = window.open("", "_blank");
win.document.write('<iframe src="' + base64URL + '"style="width:100%; height:100%;" allowfullscreen></iframe>');
});
if(count == 0) {
cp1= new ContentPane({
title: "Image",
content: temp1
});
tc.addChild(cp1);
console.log("image pane ", cp1);
}
if(count == 1) {
cp2= new ContentPane({
title: "Image",
content: temp1
});
tc.addChild(cp2);
}
console.log("text pane ", cpText)
});
... View more
08-05-2019
12:48 PM
|
0
|
0
|
1802
|
|
POST
|
Micheal, Thanks for the suggestion. A lot of people are saying the same thing from what I have already gleaned from the research I have done to this point. I will pass this along to the folks that manage the database and we'll see what happens. I think it would prevent a lot of unnecessary coding and the images would load faster, but it's not up to me 😞 Gene
... View more
06-03-2019
08:20 AM
|
0
|
0
|
1900
|
|
POST
|
I published a database table that contains a 'blob' field and want to retrieve the images for display in an info window. We are currently using php to retrieve the images from the sql database, and then using XMLHttpRequest to connect to the php file an retrieve the image. I am looking for a javascript only method of doing this, however, because we are migrating our data to new servers and do not wish to use php any more (out of my hands). I have read that esri REST does not support 'blob' files, but have also found a sample code in the ArcGIS API reference for doing just that here: https://developers.arcgis.com/javascript/3/jsapi/esri.request-amd.html The problem is, this doesn't look like what I want to do. This sample appears to be accessing an actual image, not a 'blob' file. I tried using esriRequest: var siteID = graphic.attributes.Id;
console.log("sightings ID ", siteID);
var imageUrl = "https://ocean.floridamarine.org/arcgis/rest/services/.../MapServer/1/" + siteID;
var params = {
url: imageUrl,
handleAs: "blob"
}
console.log("request params ", params);
var imageRequest = esriRequest(params);
imageRequest.then(requestSucceeded, requestFailed);
function requestSucceeded(response, io) {
console.log("request succeeded ", response);
var reader = new FileReader();
reader.addEventListener("loadend", function () {
if (response.type == "image/png") {
console.log("image response ", response);
var temp1 = "<a href=' " + reader.result + "&Count=1' target='_blank'><img src=' " + reader.result + "&Count=1' style='width:230px; height:215px;'></img></a>";
};
});
if (response.type == "image/png") {
//if working with image data
reader.readAsDataURL(response);
console.log("image response ", response);
} else {
reader.readAsText(response);
}
};
function requestFailed(error, io) {
temp = temp + "<br/><div style='text-align:center;'><strong>No Image Available</strong></div>";
console.log(error);
} The response is 'text/html' instead of 'image/png' like I think it should be. I also tried using QueryTask (which doesn't appear to have a method for doing this), and 'fetch' which actually looks like the most promising method (I get back a loooong binary code, but no image). When I insert the url for the image into a browser window, it doesn't take me to the actual image, just to the image info minus the actual 'blob' field, so I am missing something. Thanks for any advice, or suggestions!!
... View more
06-03-2019
07:46 AM
|
0
|
2
|
2372
|
|
POST
|
Robert, That worked. I couldn't get the multipoint layer to work, so I just looped through the points and ran the spatial query on each one. I corrected the above code block to reflect what is working. Thanks!
... View more
05-08-2019
10:30 AM
|
0
|
0
|
1165
|
|
POST
|
Awesome, I thought it was something of that nature. I will look into combining the points to one multipoint, it sounds like that may be the best solution. thanks again!
... View more
05-07-2019
09:00 AM
|
0
|
0
|
1165
|
|
POST
|
I have a web app that is pulling in two layers from ArcGIS REST, a point layer and a polygon layer. I already used queryTask to filter out features from the point layer and return a max value based on a statistical calc, and then set a layer definition so that only those points with the max value will render in the map. Now I want to use those points to do a spatial query that filters out all but the features from the polygon layer that intersect a point in the point layer. I am doing something wrong with the geometry because I get a type error: "Cannot read property 'wkid' of undefined" when trying to run the spatial query: //run spatial query on polygon layer using geometry from point layer then pushes
//resulting feature id to array
function getSubRegions(geometry, srArray) {
var subRegUrl =
"https://ocean.floridamarine.org/arcgis/rest/services/.../MapServer/2";
var queryTask = new QueryTask(subRegUrl);
var subRegQuery = new Query();
subRegQuery.where = "1=1";
subRegQuery.outFields = ["*"];
subRegQuery.geometry = geometry;
subRegQuery.spatialRelationship = Query.SPATIAL_REL_INTERSECTS;
subRegQuery.returnGeometry = true;
//console.log("subregion query ", subRegQuery);
queryTask.execute(subRegQuery).then(function(result) {
if(result.features[0] != undefined) {
var subRegID = result.features[0].attributes.OBJECTID;
if(srArray.indexOf(subRegID) === -1) {
srArray.push(subRegID);
}
}
});
}
//gets point layer and loops through to select intersecting polygons. Resolves polygon
//feature ids
function getSitesGeo(currentBatch, sitesUrl) {
var queryTask = new QueryTask(sitesUrl);
var batchQuery = new Query();
batchQuery.where = "Batch = " + currentBatch;
batchQuery.outFields = ["*"];
batchQuery.returnGeometry = true;
return new Promise((resolve, reject) => {
queryTask.execute(batchQuery).then(function(result) {
//console.log("sites results ", result);
let srArray = [];
let features = result.features;
features.forEach(function(feature) {
var geometry = feature.geometry;
if(isNaN(parseFloat(geometry.x)) === false) {
getSubRegions(geometry, srArray);
}
});
resolve(srArray);
});
});
}
//filters points by max field value, uses resulting points as geometry for spatial //query on polygon layer. Returns values for definition query.
function getBatchNumnber() {
var sitesUrl =
"https://ocean.floridamarine.org/arcgis/rest/services/.../MapServer/0";
var queryTask = new QueryTask(sitesUrl);
var batchQuery = new Query();
var statDef = new StatisticDefinition();
statDef.statisticType = "max";
statDef.onStatisticField = "Batch";
statDef.outStatisticsFieldName = "CurrentBatch";
batchQuery.where = "1=1";
batchQuery.outFields = ["*"];
batchQuery.outStatistics = [statDef];
batchQuery.returnGeometry = true;
queryTask.execute(batchQuery).then((result) => {
var currentBatch = result.features[0].attributes.MAX_Batch;
window.currentBatch = currentBatch;
getSitesGeo(currentBatch, sitesUrl)
.then(result => {
window.subRegIds = result;
})
});
}
//create def query in Local Layer widget.js
lLayer = new ArcGISDynamicMapServiceLayer(layer.url, lOptions);
if (layer.hasOwnProperty('definitionQueries')) {
var definitionQueries;
if(window.currentBatch) {
definitionQueries = {
0: "Batch = " + window.currentBatch,
1: "OBJECTID IN (" + window.subRegIds.join(',') + ')',
2: "OBJECTID IN (" + window.subRegIds.join(',') + ')'
}
} Everything is working fine except for the points geometry type error. I am not sure if I have the geometry configured wrong (it is in an array), or if I am miss-understanding how the spatial query is supposed to work I think this is something fairly simple that I am doing wrong, just need a little help seeing it. Thanks!!
... View more
05-07-2019
08:34 AM
|
0
|
3
|
1327
|
| Title | Kudos | Posted |
|---|---|---|
| 8 | 10-28-2025 10:15 AM | |
| 2 | 10-14-2025 06:36 AM | |
| 1 | 09-16-2022 09:31 AM | |
| 1 | 06-13-2024 05:45 AM | |
| 1 | 06-26-2025 06:28 AM |
| Online Status |
Offline
|
| Date Last Visited |
12-22-2025
05:46 AM
|