|
POST
|
I changed the Graphic build to this as well resultsLayer2.add(features2); NOT resultsLayer2.addMany(features2);
... View more
04-13-2020
11:19 AM
|
0
|
12
|
4398
|
|
POST
|
Tried this and don't get to the second alert function queryCountiesthatIntersect() {
alert("1");
var query = countyLayerWebMercator.createQuery();
query.geometry = resultsLayer2.graphics[0].geometry;
query.spatialRelationship = "intersects";
alert("2");
return countyLayerWebMercator.queryFeatures(query);
}
... View more
04-13-2020
11:12 AM
|
0
|
13
|
4398
|
|
POST
|
Funny thing is I get this error but the 2nd function still displays data but for some reason ALL of the County data....not the ones that are intersecting the Graphic Layer. So I am assuming I might have to define the Geometry of the Graphic Layer?
... View more
04-13-2020
10:35 AM
|
0
|
0
|
4398
|
|
POST
|
I am quering a FC for a specific field value Returning the Feature and displaying it in a Graphic. This works fine. I am then attempting to do the same by calling another function to Use the Geometry of the Graphic to select all the COunty Features that Intersect it... THis part if failing and I cant see why. Both FC are Web Mercator Aux Sphere The Map is defined as follows ---- I think this defaults to Web Mercator Web Aux? var mapright = new Map({
basemap: "dark-gray",
layers: [resultsLayer3, resultsLayer2, countyLayerWebMercator]
});
var viewright = new MapView({
container: "viewDivright",
map: mapright,
center: [-77.05, 37.53308],
zoom: 7
}); PART ONE query, get geometry create Graphic function queryMultipartPolyongUniqueID3(feature) {
var str = feature;
var query = "";
query = MultiPartPolygonsLayer.createQuery();
query.where = "ADDRESSgeo = '" + str + "'";
return MultiPartPolygonsLayer.queryFeatures(query);
}
// DISPLAY RESULTS IN GRAPHICS LAYER
function displayResultsUniqueID(results) {
resultsLayer2.removeAll();
var features2 = results.features.map(function (graphic) {
graphic.symbol = {
type: "simple-fill",
style: "solid",
color: [240, 248, 255, 0.9],
size: "10px", // pixels
outline: {
// autocasts as new SimpleLineSymbol()
color: [240, 248, 255, 0.9],
width: 1 // points
}
};
return graphic;
});
var numCounties2 = features2.length;
resultsLayer2.addMany(features2);
// CALL THE SECOND FUNCTION
queryCountiesthatIntersect().then(displayResults2);
} THEN Call the second function at the end ---- // CALL THE SECOND FUNCTION queryCountiesthatIntersect().then(displayResults2); 1. If I comment out the call to this 2nd function that code runs without error. 2. If I run it with the call to the second function I get the below error. ERROR dojo.js:218 [esri.core.Accessor] Accessor#set Invalid property value, value needs to be one of 'esri.geometry.Extent', 'esri.geometry.Multipoint', 'esri.geometry.Point', 'esri.geometry.Polyline', 'esri.geometry.Polygon', or a plain object that can autocast (having .type = 'extent', 'multipoint', 'point', 'polyline', 'polygon') QUESTIONS: Am I getting this error because I am trying to use a Graphic Layer from the First Function Above????? Can I use graphic Layer? If so do I need to define it differently? Do I need to use a Feature Layer? function queryCountiesthatIntersect() {
var query = countyLayerWebMercator.createQuery();
query.geometry = resultsLayer2;
query.spatialRelationship = "intersects";
return countyLayerWebMercator.queryFeatures(query);
}
function displayResults2(results) {
resultsLayer3.removeAll();
var features3 = results.features.map(function (graphic) {
graphic.symbol = {
type: "simple-fill",
style: "solid",
color: [240, 248, 255, 0.9],
size: "10px", // pixels
outline: {
// autocasts as new SimpleLineSymbol()
color: [191, 42, 18, 0.9],
width: 1 // points
}
};
return graphic;
});
var numCounties = features3.length;
resultsLayer3.addMany(features3);
}
... View more
04-13-2020
10:33 AM
|
0
|
18
|
6767
|
|
POST
|
that was it ....I went back to ArcGIS Server and tried to run the queries there....I had to place ' ' around the value to get it to work....then I brought that back to Javascript and it works... query.where = "idvalues= ' " + strresults + " ' ";
... View more
04-11-2020
08:48 PM
|
0
|
0
|
1507
|
|
POST
|
Think I figured it out....had to put ' ' around the value query.where = "NWTL_ID = ' " + str + " ' ";
... View more
04-11-2020
08:41 PM
|
0
|
1
|
1507
|
|
POST
|
I know this is going to be a hard one to follow.....but hope someone can... I am now trying to select features from that Feature Class via JS 4.14 api and write them to a Graphic...this is working SORT OF.... For some reason I can select the features from certain fields and not from others....I am very confused. I have 3 combo boxes in the app that push values to queries to query the data. All the values you see in the ComboBoxes exist in the FC itself. I will post and example below I can only get features selected from the combo box with the miles (DISTANCE) values. COMBO BOXES <select id="mySelect" onchange="window.JsController.cboChanged()">
<option value="9a35172e071f4a33b191172a9b4b02ae">feature 1</option>
<option value="6a35172e071f4a33b191172a9b4b02ae">feature 2</option>
<option value="1a35172e071f4a33b191172a9b4b02ae">feature 3</option>
</select>
<select id="mySelect2" onchange="window.JsController.cboChanged2()">
<option value="10">10 miles</option>
<option value="50">50 miles</option>
<option value="20">20 miles</option>
</select>
<select id="mySelect3" onchange="window.JsController.cboChanged3()">
<option value="1520 Split Oak Ln, Henrico, Virginia, 23229">address 1</option>
<option value="113 Buffalo Rd, Clarksville, Virginia(VA), 23927">address 2</option>
<option value="8817 Sherando Dr, Bristow, Virginia(VA), 20136">address 3</option>
</select> I am calling the JS code from .net C# as follows...the on Return features calling the function displayResultsUniqueID for all 3 combobox change events window.JsController = {
// SEARCH BY UNIQUE ID
cboChanged: function () {
resultsLayer2.removeAll();
var x = "";
x = document.getElementById("mySelect").value;
queryMultipartPolyongUniqueID(x).then(displayResultsUniqueID);
},
// SEARCH BY DISTANCE
cboChanged2: function () {
resultsLayer2.removeAll();
var x = "";
x = document.getElementById("mySelect2").value;
queryMultipartPolyongUniqueID2(x).then(displayResultsUniqueID);
},
// SEARCH BY ADDRESS
cboChanged3: function () {
resultsLayer2.removeAll();
var x = "";
x = document.getElementById("mySelect3").value;
queryMultipartPolyongUniqueID3(x).then(displayResultsUniqueID);
}
}; I am then attempting to Query my Feature Class as follows from each of the ComboBox OnChange Event function queryMultipartPolyongUniqueID(feature) {
var str = feature;
var query = "";
query = MultiPartPolygonsLayer.createQuery();
query.where = "UNIQUEIDparameter = " + str;
return MultiPartPolygonsLayer.queryFeatures(query);
}
function queryMultipartPolyongUniqueID2(feature) {
var str = feature;
var query = "";
query = MultiPartPolygonsLayer.createQuery();
query.where = "DISTANCEparameter = " + str;
return MultiPartPolygonsLayer.queryFeatures(query);
}
function queryMultipartPolyongUniqueID3(feature) {
var str = feature;
var query = "";
query = MultiPartPolygonsLayer.createQuery();
query.where = "ADDRESSgeocode = " + str;
return MultiPartPolygonsLayer.queryFeatures(query);
}
I then do the same for all 3 combo boxes They all call the same function to display the results then(displayResultsUniqueID); function displayResultsUniqueID(results) {
resultsLayer2.removeAll();
var features2 = results.features.map(function (graphic) {
graphic.symbol = {
type: "simple-fill",
style: "solid",
color: [240, 248, 255, 0.9],
size: "10px", // pixels
outline: {
// autocasts as new SimpleLineSymbol()
color: [240, 248, 255, 0.9],
width: 1 // points
}
};
return graphic;
});
var numCounties2 = features2.length;
alert(numCounties2 + " Counties found");
document.getElementById("demo").innerHTML = numCounties2 + " features found from query";
resultsLayer2.addMany(features2);
} This is from the Feature Class I am trying to query showing the 3 fields and their types This is an example of the Feature Service Queried from ArcGIS Server to Show that the Values DO in fact exist If I change the values in the UNIQUEIDparameter field to something like 4,5,6 and then change the Comobox to reflect those values the query WORKS. BUT when I use a longer string it fails <select id="mySelect" onchange="window.JsController.cboChanged()">
<option value="4">feature 1</option>
<option value="5">feature 2</option>
<option value="6">feature 3</option>
</select> WHY ARE certain fields queryable and other are not....they are all String fields...And on top of that if I shorted the length of the UNIQUEIDparameter field values to 4,5,6 and then change the combobox values it works for the UNIQUEIDparameter. Longer values do not work.... Ultimately I need to query a GUID field. I can post the solution if need be....but thought someone might have some ideas for me to check
... View more
04-11-2020
04:01 PM
|
0
|
2
|
1572
|
|
POST
|
What keyup event? I need more than one variable set... Where does this go? txtAddressCall.Attributes.Add("onKeyUp", "window.JsController.btnGISPushClick('"+[youranotherTextBox.ClientID]+"');");
I want to create two different variables values from a C# page protected void Page_Load(object sender, EventArgs e)
{
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "JsVariables", "var JSONstring='" + txtInfo.ClientID + "';", true);
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "JsVariables", "var teststring='" + TextBox1.ClientID + "';", true);
} window.JsController = {
btnGISPush_Click: function () {
// Capture String value to populate params DEFINED in the demo.aspx.cs page
// ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "JsVariables", "var JSONstring='" + txtInfo.ClientID + "';", true);
var dictstring = document.getElementById(JSONstring).value;
//var dictstring2 = document.getElementById(mutiaddressinput).value;
alert("1: " + dictstring);
var dictstring22 = document.getElementById(teststring).value;
alert("2: " + dictstring22);
// SNIP I get a return on JSONstring teststring keeps coming up undefined
... View more
04-09-2020
10:02 AM
|
0
|
0
|
3603
|
|
POST
|
I am having a hard time with this..... I have a .NET webform C# project. I want to call a GP Service, pass it parameters and get results back I am currently doing the below in JavaScript and it works great.... but I want to be in a form loop in C# and call it directly from there.... What SDK? API? do I use? I am trying to create a website, so can I even do this with the SDKs? What are all the little references I need to reference to get the code to work? I have never done this from C# before.... Can someone show me how to reference what I need to reference and make this simple call? window.JsController = {
btnGISPush_Click: function () {
var dictstring = document.getElementById(JSONstring).value;
var params = {
request: dictstring
};
window.gpJSON.execute(params).then(function (resultVal) {
finalGPResults = resultVal.results[0].value;
document.getElementById('resultsreturnedfromGPService').value = finalGPResults;
},
function (err) {
console.log(err);
}
);
} // END OF BUTTON CLICK FUNCTION
}; // END OF JS CONTROLLER
... View more
04-08-2020
09:34 AM
|
0
|
5
|
3827
|
|
POST
|
THANK YOU very much Than....I really think the main issue was the button itself and it being within the Form....I totally missed the postback and form reload from the button click CHEERS
... View more
04-06-2020
06:24 AM
|
0
|
0
|
1343
|
|
POST
|
Please see my last couple post....as for debugger....not really sure what I am looking for... I do see this ???
... View more
04-05-2020
01:06 PM
|
0
|
0
|
1343
|
|
POST
|
ok so I striped down all the code to a simple .net solution. Might make what I am trying to do more clear.. Important files: demo.aspx and the JS folder index.js 1. I have a textbox with and example of the string that I am passing to the GP Service 2. I have a button that when clicked calls the JS code and passes a string variable to the GP tool , the same as in the textbox above 3. I am then simply trying to alert the status of the request and eventually the "value" that the GP Service is returning ....so write status to textbox or something updating every second or so....or just an alert would do ....result of the "Value" returned from the GP Service to a textbox or something....even an alert I cannot even get an alert to fire inside the gpJSON.execute Please see attached .zip file with the striped down .net app
... View more
04-05-2020
09:50 AM
|
0
|
0
|
1343
|
|
POST
|
Im really puzzled...if I execute and pass the parameter as such above it works and my python script creates a polygon from the passed parameter....BUT I dont get anything back....well I get the below back but cant grab it If I run right from the service I get this... the big comma delimited "Value" returned below are the IDs of the multi part polygon that is created that I pass back in an output parameter called "result" I want to return the status AND the below returned parameters and write them to a variable... Dont know why I cant get them back....I mean the code above in my last post does not even fire a general alert?
... View more
04-05-2020
06:46 AM
|
0
|
0
|
1343
|
|
POST
|
Now trying this with no success.....not one alert comes up BUT the parameter is passed properly and the python script runs successfully...no return of any kind and no error....uggggg window.JsController = {
btnGISPush_Click: function () {
// Capture String value to populate params
var HistoricUser = document.getElementById(JSONstring).value;
alert("Parameter being passed: " + HistoricUser);
console.log(HistoricUser);
var params = {
request: HistoricUser
};
gpJSON.execute(params, lang.hitch(this, function (jobInfo) {
var jobid = jobInfo.jobId;
alert("jobid: " + jobid);
var resultName = "result";
var requestOptions = {
interval: 500,
statusCallback: function (j) {
console.log("Job Status: ", j.jobStatus);
}
};
console.log("jobid: " + jobInfo.jobid + " resultName: " + resultName);
alert("jobid: " + jobid + " resultName: " + resultName);
gpJSON.checkJobStatus(jobid, requestOptions).then(function () {
var jobInfoValue = jobid.jobStatus;
alert(jobInfoValue);
console.log(jobInfoValue);
//console.log("trying to get you a value");
//alert(requestOptions);
});
gpJSON.getResultData(jobId, "result", lang.hitch(this, function (result) {
var jobid = result;
alert(jobid);
console.log(jobid);
}));
}),
function (err) {
//this is in error case
console.log("I got error with job execution")
console.log(err);
}
);
... View more
04-04-2020
02:19 PM
|
0
|
4
|
3233
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-20-2018 11:09 AM | |
| 1 | 09-10-2018 06:26 AM | |
| 1 | 09-15-2022 11:02 AM | |
| 1 | 05-21-2021 07:35 AM | |
| 1 | 08-09-2022 12:39 PM |
| Online Status |
Offline
|
| Date Last Visited |
09-19-2022
09:23 PM
|