|
POST
|
That seems to work OK for the first time I measure. When I measure a 2nd time, it's still doing the identify, even though I think I have it turned off. I have my identifyHandler defined as pausable, so I don't have keep destroying it. var identifyHandler = on.pausable(map, 'click', runIdentifies); I added lines to suspend my identify, but that didn't make a difference. function windowPop(){ if (measurement.area.checked || measurement.distance.checked || measurement.location.checked){ console.log("measurement checked"); map.setInfoWindowOnClick(false); identifyHandler.pause(); } else { console.log("measurement not checked"); map.setInfoWindowOnClick(true); identifyHandler.resume(); } }
... View more
11-07-2014
08:52 AM
|
0
|
5
|
2841
|
|
POST
|
That could work. I was hoping to be able to suspend the identify just by clicking on one of the tools in the measurement dijit and having it resume once the measurement was complete. I tried originally listening for the measure-start and measure-end events to pause my identify, but it was firing anyway.
... View more
11-07-2014
08:21 AM
|
0
|
7
|
2841
|
|
POST
|
I want to do a very basic distance measure, but I also need identify in my project. I'm not seeing/understanding whether or not I can manage the listeners for that dijit in order to pause and remove my identify task as needed. I thought about using the Measure Distances example Measure distances | ArcGIS API for JavaScript which uses the GeometryService to get the length. That example is written in legacy. When I tried to rewrite it in AMD, I'm getting an error, "Cannot read property 'setImmediateClick' of undefined" That seems like I'm trying to use something before it's initialized or loaded, but I'm not sure what. Maybe someone can figure out what I did wrong. I haven't used the LengthsParameters before in GeometryService and I haven't used the Draw toolbar much either. http://jsfiddle.net/xksqx3an/
... View more
11-07-2014
07:23 AM
|
0
|
9
|
3526
|
|
POST
|
I guess I can't mark more than one thread as correct, so I'll just do the C# script since that's the bulk of what people need. I was just running the script from the development environment. I needed to run it from the server URL in order to get it to work.
... View more
10-28-2014
06:15 AM
|
0
|
1
|
2709
|
|
POST
|
Since I only have one option in the printTask, png, I figured it made sense to hard code it for png for saving. It still just opens the img.ashx file as a separate tab.
... View more
10-27-2014
02:45 PM
|
0
|
3
|
2709
|
|
POST
|
It just opens my img.ashx code in the browser. I'm not sure I'm feeding in the right input into the saveImage function. It's the url to the image location, not an image object.
... View more
10-27-2014
12:48 PM
|
0
|
0
|
2709
|
|
POST
|
I had to do something like that to allow the user to download a table as CSV. For that project, I found an example with instructions that worked without having to edit the C# code. I don't know that language at all. I've attempted to modify my CSV project code to work for images, but I don't know c# and I don't know where to insert the proper headers. If you happen to know C#, here's my attempt to modify the code I used before. I have a form that has all it's input hidden to act as placeholders. <div id="downloadForm" data-dojo-type="dijit/form/Form" method="post" action="webservices/img.ashx" target="_blank"> <input type="hidden" name="report" id="reportinput" value="" /> <input type="hidden" name="filename" id="filename" value="" /> </div> function submitPrint() { var deferred; var printParams = new PrintParameters(); printParams.map = map0; var status = dom.byId("printStatus"); status.innerHTML = "Generating ..."; var template = new PrintTemplate(); template.format = "png32"; template.layout="MAP_ONLY"; template.showAttribution = false; template.preserveScale = false; template.exportOptions = { width: 500, height: 400, dpi: 96 }; printParams.template = template; var printTask = new PrintTask(printServiceUrl,printParams); deferred = printTask.execute(printParams); deferred.addCallback(function (response){ var d = new Date(); var dateTime = d.getTime(); var outputUrl = response.url + '?time=' + dateTime; status.innerHTML = ""; var newDiv = domConstruct.create("div", null, registry.byId('centerPane').domNode, "last"); var imageLink = "<a href="+ outputUrl+ " target=_blank ;'>Open Image</a> "; var imageLink2 = "<a href="+ outputUrl+ " download='screenCapture.png'>Download</a>"; var saveButton = new Button({ label: "Save Image", onClick: function(){ saveImage(response.url); } },"btnSave"); var pFloatingPane = new FloatingPane({ title: "A floating pane", content: "<img src='"+response.url+"' />" +"</br>" , resizable: true, dockable: true, style: "position:absolute;top:50;left:50;width:500px;height:450px; z-index: 95;visibility:visible;" }, newDiv); pFloatingPane.addChild(saveButton); pFloatingPane.startup(); }); deferred.addErrback(function (error) { console.log("Print Task Error = " + error); status.innerHTML = "Error generating printout, try again"; }); } function saveImage(inputData) { var f = registry.byId("downloadForm"); dom.byId("reportinput").value = inputData; // var outFileName = setOutName(gridName); dom.byId("filename").value = "imageOutput"; // console.log(inputData); f.submit(); } C# code <%@ WebHandler Language="C#" class="img" %> using System; using System.Web; public class img : IHttpHandler { public void ProcessRequest (HttpContext context) { String content = "no data"; String filename = "MyFile"; if (context.Request["report"] != null) { try { content = context.Request["report"].ToString(); } catch { } } if (context.Request["filename"] != null) { try { filename = context.Request["filename"].ToString() + "_" + DateTime.Now.ToString("MMddyyyy"); } catch { } } context.Response.ContentType = "image/png"; context.Response.AddHeader("content-disposition","attachment;filename="+filename+".png"); context.Response.Write(content); } public bool IsReusable { get { return false; } } }
... View more
10-27-2014
11:01 AM
|
0
|
7
|
2709
|
|
POST
|
I had this crazy idea today that I could use the print task to do a sort of screen scrape of my map and save it into a floating pane. This would allow the user to keep a snapshot of what the screen looked like at a point in time. Now I would like to allow the user to have a 'Download' button that appears at the bottom of the image so that it prompts them where to save it. I know browsers will let them save an image with right click, but I'd like to make it more user friendly. At the moment it only lets them open the image in a new tab, which is the default behavior from the printTask in the first place. I'm trying to pretty it up a bit. http://jsfiddle.net/schlot/s2vzsL84/
... View more
10-24-2014
02:33 PM
|
0
|
9
|
3212
|
|
POST
|
I know there are several threads out there for printing secure services, but I haven't found one yet that describes what I'm experiencing. I have a created a secure print service following the instructions in the help. We have secured it. In the code, there is a call to that services as
var printTask = new esri.tasks.PrintTask(printServiceUrl,printParams);
deferred = printTask.execute(printParams);
deferred.addCallback(function (response){
var d = new Date();
var dateTime = d.getTime();
var outputUrl = response.url + '?time=' + dateTime;
status.innerHTML = "";
var select = dijit.byId("templateSelect");
var selectOptions = select.getOptions();
select.set("value", "Choose Print Format");
window.open(outputUrl,"_blank");
});
A PDF is getting created, we can see it in the output directory. However we can't open it, we get an error 499, indicating that it needs a token. If I look back through the webmap_as_JSON call to the print services, I can see the token that's generated. If I append it as an argument to the end of my PDF that's created, then I can view the PDF. My question is, is there a way to capture the token programmatically so I can pass it to the PDF?
... View more
10-21-2014
09:56 AM
|
0
|
0
|
2568
|
|
POST
|
Since everything else worked, it didn't occur to me to add this. It's fine now. Thanks so much!
... View more
10-03-2014
02:05 PM
|
0
|
0
|
1305
|
|
POST
|
The latest version is 3.10. Here's the link to the download page: Esri Downloads
... View more
10-03-2014
01:54 PM
|
1
|
7
|
2837
|
|
POST
|
If you don't like this, just wait until you discover that not all of the base maps that ESRI offers let you zoom in the same amount! I also came from FLEX, so from my perspective, having only specific scales available to you based on tiles is normal. I see it more as a limitation of using a tiled service, not as a restriction of the API itself.
... View more
10-03-2014
01:37 PM
|
0
|
0
|
2979
|
|
POST
|
I haven't done a whole lot of this, but you're better of starting with this example: Customize popup | Guide | ArcGIS API for JavaScript It isn't all CSS, there are also some sprite images involved that you'd have to edit.
... View more
10-03-2014
12:55 PM
|
0
|
0
|
2426
|
|
POST
|
I just want to use a few of the Navigation tools, Zoom Previous and Zoom Next. I had this originally placed in my right side pane. Where I really want them in tucked up into the upper right corner of my map. I added a div to my map, placed the buttons there and changed my entries in CSS to an absolute position to stay where I want them. Every thing looks fine, until I add the click listener to the buttons. Then not only does the display go wonky (side panel disappearing is the most obvious) but I'm also getting a registry.byId error on the id of my buttons. Here's the relevant code: map = new Map("mapDiv", { basemap: "topo", center: [-92.1, 38.5], infoWindow:popup, zoom: 7 }); navToolBar = new Navigation(map); navToolBar.on("extent-history-change",extentHistoryChangeHandler); //FUNCTIONS FOR NEXT, PREVIOUS AND HOME EXTENT BUTTONS function extentHistoryChangeHandler() { registry.byId("btnZoomBack").disabled = navToolBar.isFirstExtent(); registry.byId("btnZoomForward").disabled = navToolBar.isLastExtent(); } //event listeners registry.byId("btnZoomBack").on("click", function(){ navToolBar.zoomToPrevExtent(); }); registry.byId("btnZoomForward").on("click",function(){ navToolBar.zoomToNextExtent(); }); CSS: #navDiv { display:block; position: absolute; top: 12px; right: 12px; z-index: 999; opacity: 0.4; } #navDiv:hover { opacity:1.0; } .navButton { height:12px; font-size:3px; font-family: Arial, Helvetica, sans-serif; } .zoomprevIcon { background-image:url(../images/nav_back.png); width:32px; height:32px; font-size:8px; } .zoomnextIcon { background-image:url(../images/nav_next.png); width:32px; height:32px; font-size:8px; } HTML <div id="centerPane" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'" style="padding:0;"> <div id="mapDiv" > <div id="navDiv"> <button id="btnZoomBack" data-dojo-type="dijit/form/Button" data-dojo-props="label:'Previous Map View', iconClass:'zoomprevIcon',showLabel:false" type="button"></button> <button id="btnZoomForward" data-dojo-type="dijit/form/Button" data-dojo-props="label:'Next Map View', iconClass:'zoomnextIcon', showLabel:false" type="button"></button> </div> <img id="loadingImg" src="images/loading.gif" alt="Loading image" style="position:absolute; left:350px; top:250px; z-index:100;" /> <div id="HomeButton"></div> <div id="floater_report" data-dojo-type="dojox/layout/FloatingPane" data-dojo-props= "title:'Search Results', dockTo:'dock_report', closable:false, resizable:true, dockable:true" style="visibility:hidden;" > <div id="reportContainer" data-dojo-type="dijit/layout/ContentPane" > </div> </div> </div> </div>
... View more
10-03-2014
12:38 PM
|
0
|
2
|
1755
|
|
POST
|
Did you get this figured out yet? It seems like a post that even a week old gets lost down the list.
... View more
10-02-2014
01:48 PM
|
0
|
0
|
803
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-02-2017 02:38 PM | |
| 2 | 03-18-2022 10:14 AM | |
| 2 | 02-18-2016 06:28 AM | |
| 1 | 03-18-2024 07:29 AM | |
| 4 | 08-02-2023 06:08 AM |
| Online Status |
Offline
|
| Date Last Visited |
02-25-2025
01:56 PM
|