|
POST
|
please forgive me if I'm unclear. it was at the end of the code I added. I'm not sure if it fixed anything aside from the map now draws. I have tried using the sample html code provided in the sample: <div id="print_button"></div>
<div id="info">
<a href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/printtemplate.htm">Print templates</a> are generated
from the Export Web Map Task's <a href="http://servicesbeta2.esri.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task">Layout_Template parameter</a>. This info is retrieved from the service
using <a href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/namespace_esri.htm#request">esri.request</a>.
</div>
</div> However, when added, the block of text and print button does not show. I understand that the window.print() is the native print function and that it will need to be changed. That is what my end question is, assuming the print widget code I added actually works, what should be entered in the html area so that when I click on the icon, it triggers the print...
... View more
08-16-2012
11:40 AM
|
0
|
0
|
1335
|
|
POST
|
I was missing a pesky ; Used: // get print templates from the export web map task
var printInfo = esri.request({
"url": printURL,
"content": { "f": "json" }
});
printInfo.then(handlePrintInfo, handleError);
function handlePrintInfo(resp) {
var layoutTemplate, templateNames, mapOnlyIndex, templates;
layoutTemplate = dojo.filter(resp.parameters, function(param, idx) {
return param.name === "Layout_Template";
});
if ( layoutTemplate.length == 0 ) {
console.log("print service parameters name for templates must be \"Layout_Template\"");
return;
}
templateNames = layoutTemplate[0].choiceList;
// remove the MAP_ONLY template then add it to the end of the list of templates
mapOnlyIndex = dojo.indexOf(templateNames, "MAP_ONLY");
if ( mapOnlyIndex > -1 ) {
var mapOnly = templateNames.splice(mapOnlyIndex, mapOnlyIndex + 1)[0];
templateNames.push(mapOnly);
}
// create a print template for each choice
templates = dojo.map(templateNames, function(ch) {
var plate = new esri.tasks.PrintTemplate();
plate.layout = plate.label = ch;
plate.format = "PDF";
plate.layoutOptions = {
"authorText": "Made by: Marion County Information Technology",
"copyrightText": "Maps are for display purposes only",
"legendLayers": [],
"titleText": "Marion County Parks",
"scalebarUnit": "Miles"
};
return plate;
});
// create the print dijit
var printer = new esri.dijit.Print({
"map": map,
"templates": templates,
url: printURL
}, dojo.byId("print_button"));
printer.startup();
}
function handleError(err) {
alert(err);
console.log("Something broke: ", err);
}
} and now want to call it using the button I placed in the header: <td align="center" style="width: 40px;" valign="middle">
<button dojotype="dijit.form.ToggleButton" id="imgprint" title="Print Map" onclick="window.print();">
<img style="border:none;" src="images/print.png" alt="Print Map"/>
</td> Should I change the html to reference "print_button" since that is what it is expecting?
... View more
08-16-2012
11:00 AM
|
0
|
0
|
1335
|
|
POST
|
Thanks for your response. So would I be able to use either the printTask or the Print Widget? Essentially I am trying to configure a WYSIWYG print option. Right now I have placed a print icon inbetween the Share and Help Icons on the ParksFinder app. Right now it just calls the basic windows print function. Obviously, I want it to call the printTask or Widget. <td align="center" style="width: 40px;" valign="middle">
<button dojotype="dijit.form.ToggleButton" id="imgprint" title="Print Map" onclick="window.print();">
<img style="border:none;" src="images/print.png" alt="Print Map"/>
</td> I've attempted to assemble the code that relates to the printTask from the sample you provided, but it causes my map to fail. The header draws, but the map does not.
... View more
08-16-2012
09:55 AM
|
0
|
0
|
1335
|
|
POST
|
Looking to add printing capabilities to the Parks Finder Web application. Specifically, a printout that shows the map as well as the directions and amenities information in the left tab panel. Looking through the API it looks like the PrintTask is the most likely solution. Am I on the right track? I can't seem to find any samples that show how the PrintTask works together.
... View more
08-15-2012
06:00 AM
|
0
|
17
|
3015
|
|
POST
|
We are configuring the Parks Finder for our needs and the last piece we are looking for is to add a print option for users. Specifically, a printout that shows the map as well as the directions in the pull tab on the left. I've read through the API and it looks like we will need to incorporate the PrintTask code. However, there doesn't seem to be a sample available that uses PrintTask so I can see how it flows together. Am I on the right track? Is there an easier way to incorporate printer capabilities into the Parks Finder App? If I have to use PrintTask, can somebody point me towards a sample or other information on how to put it together? Thanks, Craig
... View more
08-15-2012
04:17 AM
|
0
|
1
|
958
|
|
POST
|
I'm working with the print widget sample and would like to configure it for the my services. I have started the PrintingTools service and changed the printer app url in the code to reflect properly for our server. However, when I run the code the print button is unresponsive. I haven't changed anything else in the code. Looked through the API reference and saw the parameters need to be defined, but looks like there are some defaults already defined in server manager. Any ideas. Obviously I'm a newbie and just getting my feet wet.
... View more
08-08-2012
06:50 AM
|
0
|
1
|
688
|
|
POST
|
I can't seem to find a good parks and recreation symbol/style set. In particular I need sports symbols like tennis, football, volleyball, etc. I have used the NPS 2012 set but they are more for parks than recreation/sports. Any help?
... View more
08-02-2012
12:09 PM
|
0
|
0
|
3026
|
|
POST
|
I cut out the html portion of the code bc it has been tested and works.
... View more
07-20-2012
09:30 AM
|
0
|
0
|
386
|
|
POST
|
I've been creating a mashup of code that started with the LocalGovernment ParkFinder and some of the custom stuff I have done and am almost finished with the application. I just can't seem to get the basemap gallery to open fully when I click on the icon. I have referenced js files and a config file that is unchanged from the ParkFinder Template. Can anybody check my code to see what I might be missing? The initial basemap loads so I know it is reading correctly from the config file, it just doesn't give me the option to change it... Beating my head against the wall on this one. dojo.require("esri.tasks.locator");
dojo.require("dojo.number");
dojo.require("dijit.form.Button");
dojo.require("dijit.form.Textarea");
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("esri.map");
dojo.require("esri.dijit.Popup");
dojo.require("esri.tasks.query");
dojo.require("esri.tasks.geometry");
dojo.require("esri.layers.FeatureLayer");
dojo.require("dijit.Dialog");
dojo.require("dijit.TooltipDialog");
dojo.require("dijit.form.ToggleButton");
dojo.require("dojox.widget.Standby");
dojo.require("esri.tasks.route");
var baseMapLayerCollection; //variable to store basemap collection
var map, locator;
var resizeTimer;
var identifyTask,identifyParams;
var defaultAddress; //variable for storing the default address
;
function init() {
var initExtent = new esri.geometry.Extent({
"xmin":-9261027.70119949,
"ymin":3341936.2768268585,
"xmax":-9021474.054553657,
"ymax":3479370.053683658,
"spatialReference":{"wkid":102100}});
esri.config.defaults.io.proxyUrl = "proxy.ashx"; //Setting to use proxy file
esriConfig.defaults.io.alwaysUseProxy = false;
esriConfig.defaults.io.timeout = 180000; //ersi request timeout value
dojo.connect(window, "onresize", function () {
if (map) {
map.resize();
map.reposition();
}
});
//Read Data from Config File
dojo.xhrGet({
url: "Config.txt",
handleAs: "json",
preventCache: true,
load: function (responseObject, ioArgs) {
dojo.connect(dijit.byId('imgHelp'), "onClick", function () {
window.open(helpFileURL, "helpwindow");
dijit.byId('imgHelp').attr("checked", false);
});
helpFileURL = responseObject.HelpFileUrl;
dojo.byId('imgApp').src = responseObject.ApplicationImage;
dojo.byId('lblAppName').innerHTML = responseObject.ApplicationName;
baseMapLayerCollection = responseObject.BaseMapLayers;
CreateBaseMapComponent();
dojo.connect(map, "onLoad", MapInitFunction);
customMouseHandler.addEvent(dojo.byId('divContainer'), 'mouseleave', HideBaseMapWidget, false);
customMouseHandler.addEvent(dojo.byId('divAppContent'), 'mouseleave', HideApplicationShareWidget, false);
}
});
//setup the popup window
var popup = new esri.dijit.Popup({
fillSymbol: new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0]), 2), new dojo.Color([255,255,0,0.25]))
}, dojo.create("div"));
map = new esri.Map("map",{
logo:false,
infoWindow:popup,
extent:initExtent
});
dojo.connect(map,"onLoad",mapReady);
//Add the imagery layer to the map. View the ArcGIS Online site for services http://arcgisonline/home/search.html?t=content&f=typekeywords:service
var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://services.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer");
map.addLayer(basemap);
var landBaseLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://gisdev2/arcgis/rest/services/Basemaps/GeneralPurpose/MapServer",{opacity:0.75});
map.addLayer(landBaseLayer);
var operationalLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://gisdev2:6080/arcgis/rest/services/Dynamic/SurveyBenchmarks/MapServer", {"opacity":1});
map.addLayer(operationalLayer);
}
function mapReady(map){
dojo.connect(map,"onClick",executeIdentifyTask);
//create identify tasks and setup parameters
identifyTask = new esri.tasks.IdentifyTask("http://gisdev2:6080/arcgis/rest/services/Dynamic/SurveyBenchmarks/MapServer");
identifyParams = new esri.tasks.IdentifyParameters();
identifyParams.tolerance = 5;
identifyParams.returnGeometry = true;
identifyParams.layerIds = [0,2];
identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL;
identifyParams.width = map.width;
identifyParams.height = map.height;
//resize the map when the browser resizes
dojo.connect(dijit.byId('map'), 'resize', map,map.resize);
}
locator = new esri.tasks.Locator("http://tasks.arcgis.com/ArcGIS/rest/services/WorldLocator/GeocodeServer");
dojo.connect(locator, "onAddressToLocationsComplete", showResults);
function locate() {
map.graphics.clear();
var address = {"SingleLine":dojo.byId("address").value};
locator.outSpatialReference= map.spatialReference;
var options = {
address:address,
outFields:["Loc_name"]
}
locator.addressToLocations(options);
}
function showResults(candidates) {
var candidate;
var symbol = new esri.symbol.SimpleMarkerSymbol();
var infoTemplate = new esri.InfoTemplate("Location", "Address: ${address}<br />Score: ${score}<br />Source locator: ${locatorName}");
symbol.setStyle(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE);
symbol.setColor(new dojo.Color([153,0,51,0.75]));
var geom;
dojo.every(candidates,function(candidate){
console.log(candidate.score);
if (candidate.score > 80) {
console.log(candidate.location);
var attributes = { address: candidate.address, score:candidate.score, locatorName:candidate.attributes.Loc_name };
geom = candidate.location;
var graphic = new esri.Graphic(geom, symbol, attributes, infoTemplate);
//add a graphic to the map at the geocoded location
map.graphics.add(graphic);
//add a text symbol to the map listing the location of the matched address.
var displayText = candidate.address;
var font = new esri.symbol.Font("12pt",esri.symbol.Font.STYLE_NORMAL, esri.symbol.Font.VARIANT_NORMAL,esri.symbol.Font.WEIGHT_BOLD,"Helvetica");
var textSymbol = new esri.symbol.TextSymbol(displayText,font,new dojo.Color("#666633"));
textSymbol.setOffset(0,8);
map.graphics.add(new esri.Graphic(geom, textSymbol));
return false; //break out of loop after one candidate with score greater than 80 is found.
}
});
if(geom !== undefined){
map.centerAndZoom(geom,16);
}
}
function executeIdentifyTask(evt) {
identifyParams.geometry = evt.mapPoint;
identifyParams.mapExtent = map.extent;
var deferred = identifyTask.execute(identifyParams);
deferred.addCallback(function(response) {
// response is an array of identify result objects
// Let's return an array of features.
return dojo.map(response, function(result) {
var feature = result.feature;
feature.attributes.layerName = result.layerName;
if(result.layerName === 'Control Corners'){
console.log(feature.attributes.NAME);
var template = new esri.InfoTemplate("",
"<b>Control Station:</b> <a target='_blank' href=http://gisdev2/surveybenchmarks/scans/${Corner Point Identifier}.pdf>${Corner Point Identifier}</a> <br><b>Point Type:</b> ${Corner Point Type} <br><b>Monument Type:</b> ${Monument Type} <br><b>Status:</b> ${Status}"
);
feature.setInfoTemplate(template);
}
return feature ;
});
});
// InfoWindow expects an array of features from each deferred
// object that you pass. If the response from the task execution
// above is not an array of features, then you need to add a callback
// like the one above to post-process the response and return an
// array of features.
map.infoWindow.setFeatures([ deferred ]);
map.infoWindow.show(evt.mapPoint);
}
dojo.addOnLoad(init);
... View more
07-20-2012
09:29 AM
|
0
|
1
|
1740
|
|
POST
|
Update: I can construct the url using: var template = new esri.InfoTemplate("",
"<b>Station:</b> http://gisdev2/surveybenchmarks/scans/${Corner Point Identifier}.pdf" ) ; This populates the popup with the http://.....pdf string However, the map fails when I try to use the html link constructors.
... View more
07-18-2012
07:46 AM
|
0
|
0
|
680
|
|
POST
|
well that seems to be closer. Now the map draws and the popup comes up, however, it is empty and shows "no information available". I've tried using similar sample code as located in the "Info Window Lite" sample, however that doesn't work for this either. I appreciate your help!
... View more
07-18-2012
05:39 AM
|
0
|
0
|
680
|
|
POST
|
No, when I edit the code like that it fails the entire map and nothing starts.
... View more
07-18-2012
04:04 AM
|
0
|
0
|
680
|
|
POST
|
Working with the Identify - Popup sample code Is there a way to configure the returned value as a link? Example: var template = new esri.InfoTemplate("",
"<b>Station:</b> ${Corner Point Identifier}"); I'd like the Corner Point Identifier to be returned as a link to its individual file. All the files have the same path except for the Corner Point Identifier + .pdf Is this possible?
... View more
07-17-2012
12:43 PM
|
0
|
5
|
932
|
|
POST
|
Yes I have, like I said I'm new so I'm 100% confident the issue is on my end. I guess my real trouble is very basic issues I'm sure: where to insert the code and how to edit the info window to reference my parks data. Do I need to save the js file and css file locally to edit what is referenced in the code?
... View more
07-16-2012
07:37 AM
|
0
|
0
|
788
|
|
POST
|
Attached is what I'm running locally. My goal is to have an info window popup when I click on a parks feature that shows the Parks name and a link to the County website.
... View more
07-16-2012
06:01 AM
|
0
|
0
|
788
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-16-2014 09:52 AM | |
| 6 | 06-12-2013 08:01 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|