|
POST
|
Also, I think I am confused over what server needs what, or rather what part of the same server needs what. I have my AGS component. That runs on the default website of IIS . It has a web.config and settings in IIS. Then there is my application. On the same server, but a different site in IIS. That also has its settings and (potentially) a web.config. I have tried all sorts of combinations of edits to web.config and either the page fails totally with a http 500, it fails with The 'Access-Control-Allow-Origin' header contains multiple values 'http://applicationservername, *', but only one is allowed. Or the other error above. I am really bashing head against wall here.
... View more
03-26-2015
09:30 AM
|
0
|
2
|
2143
|
|
POST
|
I'm using 10.2.2 and I believe it is all enabled - the same results occur when I strip the code out and have no AGS component. OK - also tested it in IE - it gave me an alert about loading stuff outside of control, but loaded OK (failed elsewhere, but that my problem) Firefox gave Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://<<server name>>/arcgis/rest/services/test/emap2/MapServer/22/2006/attachments/6/index.html. This can be fixed by moving the resource to the same domain or enabling CORS. So, assuming I haven't got CORS enabled - how do I? I have read about this for several years now, and yet found a simple answer. I have <customHeaders> <add name="Access-Control-Allow-Origin" value="*"/> </customHeaders> In my webconfig. Cheers ACM
... View more
03-26-2015
02:30 AM
|
0
|
3
|
2143
|
|
POST
|
I thought I had seen the last of these. However, I am trying to retrieve the EXIF metadata of attached images using this code jseidelin/exif-js · GitHub - it works when I run the example page and load in the full URL of the images returned via a " featureLayer.queryAttachmentInfos" command. However, the AGS server being a different domain to my site hits CORS issues - which I thought I had sorted by changes to web.config and adding the server name in with a "esri.config.defaults.io.corsEnabledServers.push" However, when I try to retrieve the data using a simple function for (index = 0; index < attachmentPath.length; ++index) {
var image = new Image();
image.src = attachmentPath[index];
image.onload = function () { // always fires the event.
EXIF.getData(this, function () {
console.debug(this)
var make = EXIF.getTag(this, "Make"),
model = EXIF.getTag(this, "Model");
alert("I was taken by a " + make + " " + model);
});
};
....do stuff with the info returned
} I get XMLHttpRequest cannot load http://<<server name>>/arcgis/rest/services/test/emap2/MapServer/22/2009/attachments/8. Request header field If-Modified-Since is not allowed by Access-Control-Allow-Headers. All other requests to resources using the server name seem fine. I'm stumped. All I want to do is to know which way up to display the attachments!
... View more
03-25-2015
05:47 AM
|
0
|
6
|
7853
|
|
POST
|
This one has cursed me for years - I've still not really sorted it adding require(["esri/config"], function (esriConfig) {
esri.config.defaults.io.corsEnabledServers.push("eddc-gis2");
}); helps for files that use the API - but I still get it when I create simple pages - the problem is no-one has given me an answer in simple terms what to check for - plus there is at least one Chrome issue logged that indicates this is a misleading error message.
... View more
03-13-2015
06:37 AM
|
0
|
1
|
2211
|
|
POST
|
see Find attachments using task in JavaScript API But I've sort of moved on, so I thought I'd open a new thread. So, (as every sentence has to start with "so" these days) I am detecting if my layers have attachments on load with a call to the REST thingy, this is stored in an array, with the array index matching the LayerID When I go through the records returned in the results dataset of an ID task, I check the layerID of returned record against this array and if it has attachments I then do stuff. That's my first issue. I used something like this if (layerHasAttachments) {
objectId = results.feature.attributes.OBJECTID;
t = mapservice2 + "/" + results.layerId.toString();
featureLayer = new esri.layers.FeatureLayer(t, {
mode: esri.layers.FeatureLayer.MODE_ONDEMAND
});
//use queryAttachmentInfos to return into array the path of each attachment
featureLayer.queryAttachmentInfos(objectId, function (infos) {
if (infos.length > 0) {
for (index = 0; index < infos.length; ++index) {
attachmentPath.push(infos[index].url)
}
}
console.debug(2);
}
);
console.debug(3);
} However, the code carried on before the results came in -0 I get my debug 3, before my debug 2 - so I have issues then deciding if action is needed if a feature has an attachment. - So, first issue, how can I wait for the info from the "queryAttachmentInfos" before moving on? I had to move on, so every feature in that is in the results dataset that is in a layer that is enabled for attachments has a button next to the result. This opens a popup where I show the photos (currently we only have photos, so I haven't done the code to detect attachment type). My code is featureLayer.queryAttachmentInfos(objectId, function (infos) {
imagePopupHTML = "<!DOCTYPE html><html xmlns='http://www.w3.org/1999/xhtml\'><head><title></title></head>'";
if (infos.length > 0) {
for (index = 0; index < infos.length; ++index) {
attachmentPath.push(infos[index].url)
console.debug(infos[index])
}
}
for (index = 0; index < attachmentPath.length; ++index) {
imagePopupHTML += "<a href='" + attachmentPath[index] + "'>"
imagePopupHTML += "<img src='" + attachmentPath[index] + "' style='width:600px'></a></br>"
}
imagePopupHTML += "<body></body></html>"
OpenWindowThumb = window.open("", "thumb", "height=" + popY + ", width=" + popX + ",toolbar=no,scrollbars=yes,menubar=no,resizable=yes");
OpenWindowThumb.document.getElementsByTagName('body')[0].innerHTML = 'Please Wait';
OpenWindowThumb.focus()
OpenWindowThumb.document.getElementsByTagName('body')[0].innerHTML = '';
OpenWindowThumb.document.write(imagePopupHTML);
}
);
So I get the URL and fling it into an basic HTML page - not elegant, but I am pushed for time and needed to show people that field collected data from Collector can be seen in the office in our browser mapping. If I use the raw URL for an image in Chrome, it detects the orientation. IE doesn't. So I am guessing that some metadata is stored with the image. I have failed totally in getting it. I tried a few add on chunks of code, but they didn't return what I was after. So, that's the next question - Is it possible to query the server to get image rotation info (and other metadata) Many thanks ACM
... View more
03-10-2015
09:05 AM
|
0
|
0
|
2945
|
|
POST
|
Similar here - I have a custom ID task, that doesn't use the templates, it crunches all the results from all the layers into multiple tables then passes this lot over to a popup window (like what ArcIMS did 🙂 ) I have a need to show attachments, but nothing in the results of the ID task shows the presence of attachemts, let alone the actual attachment.
... View more
02-27-2015
06:51 AM
|
0
|
1
|
1855
|
|
POST
|
Ok - I'm not sure if this more an issue with our setup rather than the code, as it is random. But sometime the creation of a TOC hangs - eventually I get a timeout error. I tracked this down and occasionally it seems to be hitting www.arcgis.com/sharing/tools/legend to get the legend - of course, with an internal URL it falls over. I have hacked the code to prevent this //ACM hack
//if (this.rootLayer.version >= 10.01) {
if (1==1) {
url = this.rootLayer.url + '/legend';
} else {
url = 'http://www.arcgis.com/sharing/tools/legend';
var i = this.rootLayer.url.toLowerCase().indexOf('/rest/');
var soap = this.rootLayer.url.substring(0, i) + this.rootLayer.url.substring(i + 5);
url = url + '?soapUrl=' + escape(soap);
} As I know my services are greater than 10.01 I can always do this section and rather than remove the 'if' totally I replaced the condition with 1==1 I also put a console.debug(this.rootLayer.version) in the code - the times it fails this returns as empty However console.debug(this.rootLayer.dpi) always returns a value, even when version is empty - other properties of this.rootlayer are also fine. I have no idea why it is happening, but this is my fix I thought I'd share. ACM
... View more
01-30-2015
06:49 AM
|
0
|
0
|
4060
|
|
POST
|
See Liu's post here Re: Collapse all layers at start in agsjs.dijit.TOC You need to add another property, autotoggle My code is now. layer: dynamicMapServiceLayer,
slider: true,
style: "inline",
title: "MyLayers",
collapsed: true,
autoToggle:false And works fine - without autoToggle it doesn't.
... View more
01-30-2015
05:08 AM
|
0
|
0
|
2641
|
|
POST
|
Ok, I have it working and going to answer my own post What I learned - Whatever I did the graphics layer was always 4326, despite what the map is in (27700 in my case) If graphic items are added to a graphics layer then if the projection is NOT the same as the map - it fails to print The results of the ID task have no projection returned with them - or so it would appear but changing the projection of the graphic object prior to adding it to the graphic layer works idGeo.push(results.feature.geometry)
idGeo.spatialReference = inSR This is my bit of code that takes the geometry of the ID features, one at a time, and adds them to an array - without the second line these would get added as 4326. inSR is a pre-defined projection object matching my map (27700) - when I later add the appropriate array item it adds as 27700 and prints. All very odd.
... View more
01-20-2015
01:38 AM
|
0
|
0
|
1107
|
|
POST
|
OK a bit more digging and it appears the user graphics layer is reference 4326! I tried modifyig its creation ths userGraphics = new esri.layers.GraphicsLayer({
"id": "usergraphics",
"spatialReference": msr
}); But it appears that the GraphicsLayer object doesn't support a spatiaReference property!
... View more
01-19-2015
08:56 AM
|
0
|
1
|
1107
|
|
POST
|
OK - I have an ID task. it pushes results into a HTML table and stores the returned geometries in an array and the HTML table has and extra "highlight" button that, well, highlights the feature into a graphics layer. I have a draw tool bar that allows custom graphics to the same graphics layer. However when I use printemplate way of printing the highlight graphics fail to print. The user added graphics (remember, the same graphics layer) works. I have context thingy on my user graphics layer, that allows edit, move etc. If I select the highlight graphic so that the resize handles appear and then print i get the resize handles but still not the graphic So, what is different? The only thing I can see is that my user added graphics are in the same projection as the map, 27700. So, I specify that the results from the ID task should be in 27700 (they get returned in 4326) by adding var sr = new esri.SpatialReference(27700); identifyParams.spatialReference = sr And yet the results still return in 4326! So, two questions - 1) is by diagnostics likely to be correct, that the projectiion is at fault & 2) why don't the identifyParams stick? Cheers ACM
... View more
01-19-2015
07:17 AM
|
0
|
2
|
4861
|
|
POST
|
gosh, so simple " window.opener" - I never knew. Or if I did I'd forgotten
... View more
01-09-2015
07:25 AM
|
0
|
0
|
2438
|
|
POST
|
OK - I'll research - not something I've done before - many thanks
... View more
01-09-2015
07:15 AM
|
0
|
1
|
2438
|
|
POST
|
Thanks for that - I just tried the API demo, and it went splut - didn't work at all 😞
... View more
01-09-2015
07:01 AM
|
1
|
5
|
2438
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-28-2025 01:14 AM | |
| 1 | 12-01-2023 06:07 AM | |
| 2 | 11-29-2024 04:32 AM | |
| 1 | 05-28-2024 12:50 AM | |
| 1 | 03-16-2023 06:46 AM |
| Online Status |
Online
|
| Date Last Visited |
21m ago
|