POST
|
Amazing Joel, just amazing. Thank you once again for your time.
... View more
12-05-2023
12:55 PM
|
0
|
0
|
50
|
POST
|
Think I was putting the cart before the horse here. We are using a search tool that returns a graphic that is generalized for say an office polygon. This polygon isn't correct as it's been generalized and doesn't show all the shapes of the office correctly. I don't think pursuing this route as we've been discussing works because the Search Widget returns a graphic and not the feature layer. Thanks for all the help.
... View more
12-05-2023
11:40 AM
|
0
|
2
|
353
|
POST
|
Joel. We took this along with some code you helped us with before and doesn't seem to like what I did. Perhaps I'm missing something here. esriConfig.request.interceptors.push({
urls: /\/query/,
before: function(params){
if (/LIKE '[^%]/g.test(params.requestOptions.query?.where)) {
console.log("Like request");
('like request intercepted', params.requestOptions);
params.requestOptions.query.where = params.requestOptions.query.where.replace(/ LIKE \'/g, ' LIKE \'%');
}
if (params.requestOptions.query.quantizationParameters) {
delete params.requestOptions.query.quantizationParameters;
}
},
// Moves Null (KNOWNAS) Values to the bottom of list
after: function(response) {
console.log("In after function");
var notNulls = [];
var nulls = [];
response.data.features.forEach(function(feature) {
if (feature.attributes.KNOWNAS === null)
nulls.push(feature);
else
notNulls.push(feature);
});
response.data.features = notNulls.concat(nulls);
}
});
... View more
12-05-2023
10:52 AM
|
0
|
4
|
358
|
POST
|
https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html#quantizationParameters Thank you.
... View more
12-05-2023
10:23 AM
|
0
|
6
|
360
|
POST
|
Joel, question how we could address this same issues with an internal ArcGIS Server 10.9.1 hosted featurelayer. Thank you for any input you may have. ESRI states: Known Limitations Only supported with ArcGIS Online hosted services or ArcGIS Enterprise 10.6.1 services.
... View more
12-05-2023
07:58 AM
|
0
|
8
|
372
|
POST
|
SOLUTION: $.ajax(settings).done(function (response) {
//console.log("Number of Closed Stops: " + response.adjustments.length);
loadData(response);
//---------------------------------------------------------------------------
async function loadData(response) {
var xValue = 0;
var yValue = 0;
const queryPromises = response.adjustments.map((response) => {
const apiStopNumber = response.details.stopIds;
const routeAffected = response.details.routesAffected;
const notes = response.notes;
const reason = response.reason;
var pictureSymbol = {
type: "picture-marker",
url:"img/closedStop.jpg",
height: 20,
width: 20
};
let query = ClosedBusStops.createQuery();
query.where = "Id = " + apiStopNumber;
query.outFields = ["Xcoord, Ycoord"];
query.returnGeometry = false;
ClosedBusStops.queryFeatures(query)
.then(function(queryResponse) {
if (queryResponse.features.length !== 0) {
xValue = queryResponse.features[0].attributes.Xcoord;
yValue = queryResponse.features[0].attributes.Ycoord;
const busStop = new Point({
type: "point",
longitude: xValue,
latitude: yValue,
wkid: 4326
});
popupClosedBusStops = {
title: "Bus Stop: " + apiStopNumber,
content:"<b>Route(s) Impacted: </b>" + routeAffected + "<br/>" +
"<b>Notes: </b>" + notes + "<br/>" +
"<b>Reason: </b>" + reason
};
const busStopGraphic = new Graphic ({
geometry: busStop,
symbol: pictureSymbol,
popupTemplate: popupClosedBusStops
});
view.graphics.add(busStopGraphic);
}
else{
//console.log("Inactive Stop")
};
});
});
}; // End of async function loadData
}); // End of Ajax Call
});
... View more
12-15-2022
03:41 PM
|
0
|
0
|
841
|
POST
|
Still hoping someone can chime in on how to get the variables in the issue.png file I show above. The values in the Promise I'm not sure how to access. Thank you.
... View more
12-14-2022
04:33 PM
|
0
|
0
|
853
|
POST
|
Please see the Issue.png file. Perhaps I'm going about this wrong. My issue is accessing the lat/lon within the results I get back. I can get say the Bus Stop number using results[0].value[1]. However, it's when I try to get values from within the ResultsPromise that I can't seem to figure out. The Issue.png shows the lat/lon but I can't put together how to get that data, i.e. results[0].[0].PromiseResults.features[0].attributes.Xcoord and subsequently results[0].[0].PromiseResults.features[0].attributes.Ycoord.
... View more
12-06-2022
07:12 AM
|
0
|
0
|
869
|
POST
|
I tried to revive this thread below but to no luck. Rene has helped me quite a bit but I'm stuck getting values out of a promise statement that puts values into an array. Previous Post: https://community.esri.com/t5/arcgis-api-for-javascript-questions/executing-a-series-of-queries-inside-a-loop/td-p/749954 My code hits the swiftly API to get a list of closed bus stops. This list of stops does not include a lat / lon value so what I do is then query the closedStop Feature class using the bus stop ID from the API in order t join these two results together. I then have an array "RESULTS" but can't get into the promise. I can see the values (see attached image array.png). Just not sure how to get those out of the array. Input is greatly appreciated. BTNelement.addEventListener('click', function(evt){
view.graphics.removeAll(); // Clears all graphics before placing new updated ones onto the view
var settings = {
"url": 'https://api.goswift.ly/',
"method": "GET",
"timeout": 0,
"headers": {
"Authorization": "",
"Content-Type": "application/json"
}
};
$.ajax(settings).done(function (response) {
console.log("Number of Closed Stops: " + response.adjustments.length);
loadData(response);
async function loadData(response) {
var i = 0;
const queryPromises = response.adjustments.map((data) => {
// parse data for query
const query = new Query();
var queryValue = "Id = " + data.details.stopIds;
query.where = queryValue;
query.outFields = ["*"];
query.returnGeometry = false;
apiStopNumber = data.details.stopIds;
routeAffected = data.details.routesAffected;
notes = data.notes;
reason = data.reason;
i++;
return [ClosedBusStops.queryFeatures(query), routeAffected, notes, reason, apiStopNumber];
});
const resultsArray = await Promise.allSettled(queryPromises);
// you now have an array of arrays for results, you can flatten them
const results = resultsArray.flat();
// now you can create the graphics from the results
//console.log(results);
doStuff(results);
};
});
});
function doStuff(results){
console.log(results);
};
... View more
11-22-2022
08:03 AM
|
0
|
3
|
939
|
POST
|
Rene, I hope you have chance to see this as I have a similar question as this. I understand that I can't call a query inside of a for loop. Here is what I am trying to do. I reach out to an API that returns information on Bus Stops that are currently closed. I want to display these Bus Stops on a map but the information from the API doesn't include lat/lon. So what I do is take the response from the API and iterate through them getting the Bus Stop number and then running a query on our Bus Stop Feature Class that can return the lat/lon that I in turn create a graphics layer from. Problem of course is the query doesn't work as expected. Wondering how I can incorporate your answer above into my scenario. layerList.on("trigger-action", (event) => { const id = event.action.id; if (id === "refresh-ClosedBusStops") { var settings = { "url": 'api to get closed bus stops', "method": "GET", "timeout": 0, "headers": { "Authorization": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "Content-Type": "application/json" } }; $.ajax(settings).done(function (response) { var Xcoord = 0; var Ycoord = 0; for(i = 0; i < response.adjustments.length; i+=1) { busID = response.adjustments[i].details.stopIds; routeAffected = response.adjustments[i].details.routesAffected; notes = response.adjustments[i].notes; reason = response.adjustments[i].reason; const query = new Query(); var queryValue = "Id = " + response.adjustments[i].details.stopIds; query.where = queryValue; query.outFields = [ "Xcoord", "Ycoord" ]; query.returnGeometry = true; ClosedBusStops.queryFeatures(query).then(function(results) { Xcoord = results.features[0].attributes.Xcoord; Ycoord = results.features[0].attributes.Ycoord; createClosedBusStop(busID, routeAffected, notes, reason, Xcoord, Ycoord); }); }; }); } }); function createClosedBusStop(busID, routeAffected, notes, reason, Xcoord, Ycoord) { const busStop = new Point({ type: "point", longitude: Xcoord, latitude: Ycoord, wkid: 4326 }); var markerSymbol = { type: "simple-marker", style: "square", color: "RED", size: "10px" }; popupClosedBusStops = { title: "Bus Stop: " + busID, content:"<b>Route(s) Impacted: </b>" + routeAffected + "<br/>" + "<b>Notes: </b>" + notes + "<br/>" + "<b>Reason: </b>" + reason }; const busStopGraphic = new Graphic ({ geometry: busStop, symbol: markerSymbol, popupTemplate: popupClosedBusStops }); view.graphics.add(busStopGraphic); };
... View more
11-08-2022
01:35 PM
|
0
|
0
|
858
|
POST
|
ESRI states at 4.24 releasing July 22' should fix the issue of the Layer List, "Should".#BUG-000147907
... View more
06-16-2022
03:53 PM
|
0
|
1
|
1414
|
POST
|
Jake, I know this is quite old but figured I would give this a shot in asking a question. Can you put a legend under each checkbox as they are checked. I don't want a different tab to show the legend I was users to see the legend for that particular layer as they turn the layer on and off underneath it. Thanks and hopefully you get this reply.
... View more
10-04-2021
01:09 PM
|
0
|
0
|
731
|
POST
|
Thank you so much. I knew it had to be a simple solution. Thank you again for taking the time to get this working. Very much appreciated.
... View more
09-28-2021
07:38 AM
|
1
|
1
|
955
|
POST
|
I'm taking the location returned from using the Search widget, passing that to create buffers around said point, then taking just a singular buffer and trying to simply query a featureClass for those PolyLines within the Buffer area. So what I do is take the results of the search to grab the geometry of the point, pass that point and create multiple buffer rings, of which I only use 1 at this time and pass that distance to a locateBusRoutes function where I use the geometry of the 1/4 mile buffer to try and locate Bus Routes that are within this 1/4 mile (HERE IS WHERE I'M HAVING ISSUES), then it calls a function to populate a list of Bus Routes that fall within this area. I'm in the process of converting this from 3.X API to 4.20 API and not as intuitive for me to figure out. Any help with figuring out the issues I'm having with the Query would be great. https://gisdev.rtcsnv.com/ADACert_4/ This is the application as I have it now. I know that setting the layerView.watch("Updating") isn't the way to go as it will update numerous times and this clears out my results. Your help is greatly appreciated. Test with our address: 600 S Grand Central Pkwy, Las Vegas, NV, 89106, USA searchWidget.on("select-result", function showLocation(evt) {
view.goTo({
scale: 9027
});
point = evt.result.feature.geometry;
createBuffers(point);
});
function createBuffers(point) {
clearGraphics();
pointLayer.add(
new Graphic({
geometry: point,
symbol: pointSym
})
);
distances = [1320, 1760, 3960];
bufferGeom = []; // Houses the buffer geometry for 1320', 1760', and 3960'
for (i=0; i<distances.length;i+=1){
const buffer = geometryEngine.geodesicBuffer(
point,
distances[i],
"feet"
);
bufferLayer.add(
new Graphic({
geometry: buffer,
symbol: polySym
})
);
bufferGeom[i] = buffer;
}
// Locates Bus Routes within 1/4 Miles 1320 Feet
locateBusRoutes(bufferGeom[0]);
};
// Locates Bus Routes within 1/4 Miles 1320 Feet
function locateBusRoutes(geom) {
// Acitivates the Legend Accordian Tab
var container = dijit.byId("container");
container.selectChild("routePane", true);
// create a query and set its geometry parameter to the
// buffer circle on the view
const query = {
geometry: geom,
outFields: ["NAME", "ROUTE_NEW"]
};
view.when(function () {
// Perform Query to select routes within 1/4 mile buffer area
view.whenLayerView(busRoutes)
.then(function(layerView) {
layerView.watch("updating", async function(results) {
// do something with the layerView
layerView.queryFeatures(query).then(function(results) {
populateText(results);
})
})
});
});
};
// Function to populate the results as well as highlight the selected routes within 3/4 mile of point
function populateText(results) {
var NEWresults = [],
listOfRoutes = [];
for (i=0; i<results.features.length; i+=1){
listOfRoutes.push(results.features[i].attributes.ROUTE_NEW);
NEWresults.push('<tr><td>' + results.features[i].attributes.NAME + '</tr></td>')
}
var i = 0,
newList = "";
if (listOfRoutes.length !== 0) {
while (i < listOfRoutes.length) {
if (i === 0 && listOfRoutes.length > 1) {
newList = "'" + listOfRoutes[i] + "', ";
}
else if (i < listOfRoutes.length -1){
newList = newList + "'" + listOfRoutes[i] + "', ";
}
else {
newList = newList + "'" + listOfRoutes[i] + "'";
}
i++;
};
busRoutes.definitionExpression = ("ROUTE_NEW NOT IN(" + newList + ")");
selectedbusRoutes.definitionExpression = ("ROUTE_NEW IN (" + newList + ")");
selectedbusRoutes.visible = true;
}
// displays the buffer image showing buffer distances on bottom right
document.getElementById("bufferImage").style.visibility = "visible";
//display number of routes in extent
document.getElementById("inextent").innerHTML = results.features.length;
//displays the user entered address
document.getElementById("address").innerHTML = searchWidget.results[0].results[0].name;
//display list of points in extent
document.getElementById("results").innerHTML = "<table><tbody>" + NEWresults.join("") + "</tbody></table>";
}
... View more
09-27-2021
11:06 AM
|
1
|
3
|
985
|
POST
|
AGOL allows users access to the Related Table Fields when setting up a pop-up however, when you want to label features you don't have access to the Related Table Fields. For instance I have created a Campus Map based off of ESRI's and want to not only label a room by it's Locations Value but also with the Employee information such as Name and Extension for that office. We have a 1 to 1 relationship so there can only be one person per office area. Any help on how to address this or if it will be an enhancement in the future that would be greatly appreciated. Below is the related table fields available in the popup that I cannot access in the Manage Labels.
... View more
03-12-2019
12:39 PM
|
0
|
1
|
457
|
Title | Kudos | Posted |
---|---|---|
1 | 09-28-2021 07:38 AM | |
1 | 09-27-2021 11:06 AM |
Online Status |
Offline
|
Date Last Visited |
Tuesday
|