POST
|
It looks like the response header is missing, which makes sense. Adding a header to the request won't help, the header needs to be added by the server as part of the response or the browser will reject the response. Victor's advice seems to be on the right track to me. In terms of how to add the necessary header I'm pretty clueless, it depends on the server you're using. I would also note that esriConfig.defaults.io.corsEnabledServers will prevent the request from being sent by the browser if you're using esriRequest, but I don't think it will change anything if you're using XMLHttpRequest.
... View more
11-08-2017
06:24 AM
|
0
|
0
|
18030
|
POST
|
I don't know why the error thinks your origin is 'null'. How are you running the web application? Is it hosted on a web server, or are you running it from its file path? Also, can you inspect the request in your browser's dev tools and check for the "Access-Control-Allow-Origin" header on the response? Take a look at the response and see it looks correct. If there's no header, you might have to keep playing around with the server to get it to add the proper response headers.
... View more
11-06-2017
01:25 PM
|
0
|
2
|
18030
|
POST
|
Well, you're using a HEAD http verb, which esriRequest doesn't support. Just in general I find it easier to use some nicer JavaScript wrapper than working with XMLHttpRequests directly. You could try to change your code to this and see what happens: var http = new XMLHttpRequest();
var contentResult = "";
http.onload = function(evt) {
if(http.status === 200){
contentResult ='<a target="_blank" href="' + reportPath + '"><IMG SRC="' + pdfIcon + '"width=25% height=25%/></a>';
clearInterval(dots);
window.map.infoWindow.resize(256,256);
window.map.infoWindow.setContent(contentResult);
window.map.infoWindow.setTitle(displayCountry + " Forecast Analysis Report");
}
else{
window.gp_report.execute(taskParams,gpreportResultAvailable,gpreportFailure);
}
}
http.open('HEAD', reportPath, true);
... View more
11-06-2017
12:42 PM
|
0
|
4
|
18030
|
POST
|
I would recommend using esri/request for HTTP requests if that's possible. It's been a while since I've manually sent an XMLHttpRequest but I think you need to set the onload property to a function that will be called when the response is received. In the sample you posted, the status will never be 200. edit - disregard this, looks like the third argument specifies whether the request should be async or not. In terms of the header, setting it in the browser shouldn't make a difference. The question is whether the server is responding with the correct headers. So my feeling is that you did the right thing by configuring your server to append the missing header, but it's possible that something went wrong with this process. The easiest way to check is to look at the browser's dev tools and open the network tab. Manually inspect the failing request and see if the response is missing the header. If so, this is still an issue that needs to be solved on the backend by configuring your server to reply with the proper headers.
... View more
11-06-2017
11:46 AM
|
0
|
6
|
18030
|
POST
|
setRequestPreCallback should also work in 4.XX I believe.
... View more
11-06-2017
05:52 AM
|
0
|
3
|
3167
|
POST
|
Adding this CSS rule works for me: .esri-popup .esri-popup__position-container {
z-index: 3;
} Off the top of my head I don't think this will break anything but you should keep an eye out in case it does.
... View more
11-02-2017
01:21 PM
|
1
|
1
|
609
|
POST
|
Does this URL work? ArcGIS Portal Directory There's no HTML interface, but you should be able to POST user info to that URL with the parameters listed here: ArcGIS REST API I found some old code that seems to work: esriRequest("https://www.arcgis.com/sharing/generateToken",{
method: "post",
query:{
f:"json",
username: '<name>',
password: '<password>',
// I guess this would be sampleserver8 for you
referer: '<http://analysis7.arcgis.com/>'
}
}).then(response => {
return r.data.token;
});
... View more
11-02-2017
09:23 AM
|
1
|
0
|
2903
|
POST
|
When you say generateToken doesn't work, what do you mean exactly? I'm not completely sure how you're supposed to handle this for logging into ArcGIS Online but my expectation is that you could generate a token from a URL like: Generate Token. Also I've actually never done this manually (but I don't see any reason that you couldn't). I've always used some combination of OAuthInfo and the Identity Manager, which are documented in the JS SDK.
... View more
11-02-2017
08:36 AM
|
1
|
2
|
2903
|
POST
|
You may be able to add drag and drop to move layers around using a third party library. This looks promising: GitHub - Shopify/draggable: The JavaScript Drag & Drop library your grandparents warned you about. I played around with this for a little bit and here's what I ended up with: https://codepen.io/solowt/pen/yPeeeL?editors=1000#0 This isn't working completely. There is some logical problem with how the layers are reordered. I'm not sure where the issue is but if you really want this feature it should be doable with some work. One thing I noticed is that I needed to push each swap event onto an array and then apply the changes after the user stopped dragging the layer element. The logical problem may be involved with how the new index is determined. I'll take a further look if I get a chance.
... View more
11-02-2017
08:05 AM
|
2
|
0
|
826
|
POST
|
You can use a round image, like this: https://codepen.io/solowt/pen/EbVRMJ?editors=1000#0 S ome images may seem round, but actually have a white (or some other color) background. But you can have images with no background and a centered circle.
... View more
11-01-2017
06:42 PM
|
0
|
0
|
420
|
POST
|
I believe this is getting changed in 4.6 so that the view will wait until it's ready and then goTo as opposed to throwing that error. I'm not 100% sure you can goTo a layer off the top of my head, but you might try featureLayer.then(fl => view.goTo(fl.fullExtent)); assuming your layer has an extent set on it.
... View more
11-01-2017
10:57 AM
|
1
|
0
|
1869
|
POST
|
Hey Michael, Try using outSR instead of outSpatialReference in your calls to project(). outSpatialReference was added in 4.4, but you're using 4.3 in that sample.
... View more
11-01-2017
10:54 AM
|
0
|
0
|
881
|
POST
|
Raluca Nicola wrote: You don't need to send dummy variables on the renderer, you can set them in the outFields and that will return them in the query on the layer view (FYI @Thomas_Solow). That's a good point. For most users this does seem like the right approach. But if you set outFields on the Query, the layer will send one request to the scene service for each attribute in outFields, and this question did specify wanting to avoid querying the service. SceneLayerView.queryFeatures seems to stick to what's in the client already as long as you don't specify outFields. The goal of forcing the scene layer to fetch attributes with dummy variables (or however you do it) is to keep subsequent queries for specific features in the client while still including all the attributes the user is interested in. Eliminating those later requests in exchange for requesting the attributes up-front may be of questionable value, but there are probably some situations where it's a good idea. Imagine you know in advance that you want access to a certain field on every feature that gets rendered, say for a feature table, or in order to mark each feature in a custom way.
... View more
10-25-2017
08:13 AM
|
0
|
2
|
1157
|
POST
|
It looks to me like features is an array of graphics when you need to compare geometries with intersects. Maybe you could change it to this: for (i = 0, il = features.length; i < il; i++) {
console.log("comparing:", features[i].attributes.ZIP_CRID);
console.log("intersects:", geometryEngine.intersects(features[i].geometry, touchPoint));
}
// this is probably preferred
selectedFeatures = features.filter(function(feature) {
return geometryEngine.intersects(feature.geometry, touchPoint);
}); This approach is fine, but you may run into issues if there are a large number of polylines (ie thousands). You can also query the client-side features using featureLayerView.queryFeatures, but this only lets you pass in an extent (which will be faster) but differs a little from a circle.
... View more
10-24-2017
11:05 AM
|
2
|
1
|
1720
|
POST
|
There's two issues that I notice, the first is that the attributes aren't set up like the code expects, like you mentioned. The second is that the array has ~10,000 undefined elements based on the objectids. I don't really know what to make of this, it seems unintentional to me. Anyway here's a simple fix: JS Bin - Collaborative JavaScript Debugging data = Array.from(new Set(value.data)) // this makes sure there are no dupes in array
.filter(d => d) // filter out nulls/undefined
.map(d => d.attributes); // map to attributes You could just filter the array like this: data = data.filter(d => d) before mapping instead of using a Set if your browser doesn't support that. Set should be faster though.
... View more
10-24-2017
10:55 AM
|
1
|
0
|
1230
|
Title | Kudos | Posted |
---|---|---|
1 | 05-03-2017 08:23 AM | |
1 | 11-02-2017 08:36 AM | |
1 | 11-02-2017 09:23 AM | |
1 | 09-20-2017 02:07 PM | |
1 | 10-06-2017 05:54 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|