|
POST
|
Thank you Robert I am able to run "http://localhost:59297/api/value and http://localhost/FindNextVALUENumber/api/value in my Goodle browser and it works fine. I also added alwaysUseProxy and updated proxyUrl with the whole path. esriConfig.defaults.io.alwaysUseProxy = false; esriConfig.defaults.io.proxyUrl = "http://localhost/proxy/proxy.ashx"; This is the error message I am getting: XMLHttpRequest cannot load http://localhost/proxy/proxy.ashx?http://localhost/FindNextValueNumber/api/value. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:59297' is therefore not allowed access. init.js:89 n {message: "Unable to load http://localhost/proxy/proxy.ashx?h…localhost/FindNextVALUENumber/api/value status: 0", response: Object, status: 0, responseText: "", xhr: XMLHttpRequest…}w @ init.js:89(anonymous function) @ init.js:88c @ init.js:103d @ init.js:103resolve.callback @ init.js:105c @ init.js:104d @ init.js:103reject.errback @ init.js:105c @ init.js:104d @ init.js:103reject.errback @ init.js:105c @ init.js:104d @ init.js:103reject.errback @ init.js:105(anonymous function) @ init.js:92h @ init.js:107k @ init.js:107w.reject @ init.js:109a @ init.js:108h @ init.js:107k @ init.js:107w.reject @ init.js:109a @ init.js:108h @ init.js:107k @ init.js:107w.reject @ init.js:109a @ init.js:108h @ init.js:107k @ init.js:107w.reject @ init.js:109a @ init.js:108h @ init.js:107k @ init.js:107w.reject @ init.js:109n @ init.js:138f @ init.js:143
... View more
12-08-2016
11:36 AM
|
0
|
1
|
4202
|
|
POST
|
Hello everyone, I am getting the following error message "Unable to load /proxy/?http://localhost/FindNextVALUENumber/api/value status: 404" when running this sample: https://developers.arcgis.com/javascript/3/jssamples/data_requestJson.html When I pass these URLs, the first one works fine but the second one fails url = "http://localhost:59297/api/value"; <ç========WORKS FINE – it is the Visual Studio 2012 proejct Or url = "http://localhost/FindNextVALUENumber/api/value"; <ç==== FAILS – runs from IIS The second URL is the IIS Application pointing to the same folder. I am using the proxy server from this sample: https://github.com/Esri/resource-proxy I tested both url and they work fine with the proxy: http://localhost/proxy/proxy.ashx?http://localhost:59297/api/value http://localhost/proxy/proxy.ashx? http://localhost/FindNextVALUENumber/api/value Here is the proxy.config file <ProxyConfig allowedReferers="*" mustMatch="true"> <serverUrls> <serverUrl url="http://localhost:61004" matchAll="true"/> <serverUrl url="http://localhost:59297" matchAll="true"/> <serverUrl url="http://localhost" matchAll="true"/> </serverUrls> </ProxyConfig> My code: esriConfig.defaults.io.proxyUrl = "/proxy/"; var url = "http://localhost:59297/api/value"; url = "http://localhost/FindNextVALUENumber/api/value"; dom.byId("url").value = url; dom.byId("content").value = ""; //handle the Go button's click event on(dom.byId("submitRequest"), "click", getContent); var serviceDescriptionStr = ""; function getContent() { var result = ""; var contentDiv = dom.byId("content"); contentDiv.value = ""; domClass.remove(contentDiv, "failure"); dom.byId("status").innerHTML = "Downloading..."; var requestHandle = esriRequest({ "url": url, handleAs: "json" }); requestHandle.then( function (response) { console.log("Data: ", response); dojoJson.toJsonIndentStr = " "; console.log("Success: ", response); }, function (error) { console.log("Error: ", error.message); alert(error.message); }); }
... View more
12-07-2016
12:25 PM
|
0
|
15
|
9684
|
|
POST
|
Hello everyone, I was able to call an asp.net vb.net Rest web service using this sample as template https://developers.arcgis.com/javascript/3/jssamples/data_requestJson.html and it works fine. Now when I copy/paste the same code into the edit widget (Widget.js) code, it jumps from line: var requestHandle = esriRequest to line this.editor.attributeInspector.refresh(); and it never executes this code: requestHandle.then( I know that esriRequest is asynchronous, but I do not know how to change the code here to handle the return in the widget. Here is the source code: _worksAfterCreate: function (settings) { ... ... this.editor.templatePicker.on("selection-change", lang.hitch(this, function () { var selected = this.editor.templatePicker.getSelected(); if (selected) { var featureLayer = selected.featureLayer; on.once(featureLayer, "before-apply-edits", lang.hitch(this, function (evt) { if (evt.adds && evt.adds.length > 0) { // // Query WasdIndex Layer for Atlas and TTRRSS // this.query = new Query(); var countOfFeatures = 0; var polygon = evt.adds[0].geometry; var centroid = polygon.getCentroid(); this.query.geometry = polygon; this.query.returnGeometry = true; this.query.outFields = ['*']; this.query.spatialRelationship = Query.SPATIAL_REL_INTERSECTS; this.queryTask.execute(this.query, function (results) { // // Populate ATLAS field // if (results.features && results.features.length > 0) { dojo.forEach(results.features, function (feature) { countOfFeatures++; evt.adds[0].attributes.ATLAS = feature.attributes.ATLAS; } )}; alert("Number of points in polygon " + countOfFeatures); }, function (showErr) { console.log('error in query execution'); }); // // Populate Comment for testing purposes // if (evt.adds[0].attributes.hasOwnProperty('COMMENTS')) { evt.adds[0].attributes.COMMENTS = 'TEST COMMENTS'; } // // Populate AASISID // if (evt.adds[0].attributes.hasOwnProperty('AASISID')) { esriConfig.defaults.io.proxyUrl = "/proxy/"; var url = "http://localhost:59297/api/aasis"; var requestHandle = esriRequest({ "url": url, "handleAs": "json", "callbackParamName": "jsoncallback" }); requestHandle.then( <<<<=== THIS IS WHERE I HAVE THE PROBLEM function (response) { console.log("Success: ", response); }, function (error) { console.log("Error: ", error.message); }); } this.editor.attributeInspector.refresh(); } })); } }));
... View more
12-07-2016
07:55 AM
|
0
|
1
|
987
|
|
POST
|
Hi, What is the best way to save in the field "evt.adds[0].attributes.COMMENTS" the value "response" returned? if(evt.adds[0].attributes.hasOwnProperty('COMMENTS')){ evt.adds[0].attributes.COMMENTS = ????? ; <<== value "response" from function requestSucceeded } ======================================================================= function getContent() { var result = ""; var contentDiv = dom.byId("content"); contentDiv.value = ""; domClass.remove(contentDiv, "failure"); dom.byId("status").innerHTML = "Downloading..."; var requestHandle = esriRequest({ "url": dom.byId("url").value, "handleAs": "json", "callbackParamName": "jsoncallback" }); requestHandle.then(requestSucceeded, requestFailed); } function requestSucceeded(response, io) { dom.byId("status").innerHTML = ""; dojoJson.toJsonIndentStr = " "; dom.byId("content").value = dojoJson.toJson(response, true); } function requestFailed(error, io) { domClass.add(dom.byId("content"), "failure"); dom.byId("status").innerHTML = ""; dojoJson.toJsonIndentStr = " "; dom.byId("content").value = dojoJson.toJson(error, true); }
... View more
12-05-2016
11:53 AM
|
0
|
0
|
1593
|
|
POST
|
Hello everyone, I am testing a rest web service created in ASP.Net. The rest service http://localhost:61004/api/value returns one value: "value1" I am testing also how to call this Restful service from esri javascript 1.38. This is the sample called "requests JSON using esriRequest". https://developers.arcgis.com/javascript/3/jssamples/data_requestJson.html I just copied it and set up the proxy and changed the default url esriConfig.defaults.io.proxyUrl = "/proxy/"; dom.byId("url").value = "http://localhost:61004/api/aasis"; and it works!!! My question now, is how do I get the content of "response" in a local variable to process it. My goal is to save this value in a field, but I do not know how to retrieve it. function requestSucceeded(response, io) { dom.byId("status").innerHTML = ""; dojoJson.toJsonIndentStr = " "; dom.byId("content").value = dojoJson.toJson(response, true); <<=============== } Thanks
... View more
12-05-2016
10:44 AM
|
0
|
3
|
2008
|
|
POST
|
Hello everyone, I am writing my first esriRequest, what do I need to add in the "content: {" section if I am calling the default "HelloWorld" method? I am trying to call a asmx web service
... View more
12-02-2016
04:47 AM
|
0
|
1
|
3192
|
|
POST
|
Found this answer: arcpy - Python ArcGIS 10.0 Expanding select layer by location from point (walking selection) - Geographic Information Sy…
... View more
11-30-2016
05:09 AM
|
1
|
0
|
1374
|
|
POST
|
Hello everyone, I need to read a point layer and find all the points from this same layer that are located at 100 feet. The goal is to find all the points in less than 100 feet and check if they were created in less than a year (365 days). How can I do that in Model Builder or Python?
... View more
11-29-2016
08:36 AM
|
0
|
3
|
1867
|
|
POST
|
Hello everyone, Are there any limitations when using an ArcGIS 10.2 client pointing to a ArcSDE 10.4 Ms SQL Server Geodatase? Can a ArcGIS 10.2 client see a ArcGIS 10.4 SDE Ms Sql Geodatabase? Is there any difference copying layers from a SDE Oracle 10.0 to SDE Ms SQL 10.4 using a client in 10.2 and 10.4? Any issues running python scripts to copy layers from SDE Oracle 10.0 to SDE Ms SQL 10.4 in a 10.2 client or 10.4 client? Any known incompatibilities? Thanks
... View more
11-28-2016
07:33 AM
|
0
|
1
|
1247
|
|
POST
|
Retrieve data from a web server | Guide | ArcGIS API for JavaScript 3.18
... View more
11-23-2016
12:21 PM
|
0
|
0
|
613
|
|
POST
|
Hello everyone. I am looking for samples that show how to call a .net web service from javascript arcgis . Thanks
... View more
11-23-2016
12:20 PM
|
0
|
1
|
1047
|
|
POST
|
Just to let you know that the code works in the _worksAfterCreate: event.
... View more
11-22-2016
12:19 PM
|
0
|
0
|
3794
|
|
POST
|
Hello everyone, I am also using the Edit Widget and I need to autopopulate fields in my code. The application creates a new polygon layer with 2 variations: one blue and another green. To start I just added to the source code ..\widgets\Edit\Widget.js and 2 alerts on the events: _worksAfterCreate: Alert("_worksAfterCreate") _worksBeforeCreate: Alert("_worksAfterCreate") Both alerts display before the Edit Widget window show all its components. Before the drawing tools part to select a polygons are visible inside Edit Widget window. Also I just added the code from this post to update one field but it does not work This is my question: After selecting a shape to draw a new polygon with the Edit Widget it pops up a new window to enter attributes (attribute inspector) . I have to click on the button close in the attribute inspector to save all the values entered on the attributes, but the event _worksAfterCreated is not called from the Attribute Inspector anymore. _worksAfterCreate: function(settings) { // add close button to atiInspector this._addButtonToInspector(); // disable delete button in the toolbar if(this._configEditor.toolbarVisible) { this._disableDeleteBtnInToolbar(); } // resize editPopup this.editPopup.resize(300, 251); // update templatePicker for responsive. this.editor.templatePicker.update(true); // // reset default selectionSymbol that change by Editor dijit. // array.forEach(this.editor.settings.layerInfos, function(layerInfo) { // layerInfo.featureLayer.setSelectionSymbol(); // }, this); //Customized Code for the AutoPopulated fields alert("_worksAfterCreate "); this.editor.templatePicker.on("selection-change", lang.hitch(this, function() { var selected = this.editor.templatePicker.getSelected(); if (selected) { var featureLayer = selected.featureLayer; on.once(featureLayer, "before-apply-edits", lang.hitch(this, function(evt){ if(evt.adds && evt.adds.length > 0){ if(evt.adds[0].attributes.hasOwnProperty('ID')){ evt.adds[0].attributes.ID = 1); } this.editor.attributeInspector.refresh(); } })); } }));
... View more
11-21-2016
12:39 PM
|
0
|
1
|
3794
|
|
POST
|
Hello everyone, After downloading an Web App Builder application. how do I import this application to a VS 2012 javascript project? Thanks
... View more
11-21-2016
11:31 AM
|
0
|
0
|
621
|
|
POST
|
Thanks Robert. Found this sample: http://gis.stackexchange.com/questions/40502/how-to-count-point-features-in-polygon-using-arcgis-api-for-javascript
... View more
11-21-2016
10:12 AM
|
0
|
0
|
693
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 3 weeks ago | |
| 1 | 05-01-2026 12:34 PM | |
| 1 | 12-02-2022 08:17 AM | |
| 1 | 12-26-2025 05:02 AM | |
| 1 | 08-05-2025 04:28 AM |
| Online Status |
Offline
|
| Date Last Visited |
a week ago
|