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
Solved! Go to Solution.
Ok, I have it working and going to answer my own post
What I learned -
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.
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!
Ok, I have it working and going to answer my own post
What I learned -
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.