POST
|
Hi Jamal, Did you ever resolve this? I am about to start attempting this same thing.
... View more
02-06-2017
12:20 PM
|
1
|
0
|
2151
|
POST
|
Did you ever resolve this? I am having the same issue. Just upgraded to 10.5, new service wont draw. I can query and return results, view the table in AGOL, etc. but it will not draw and gives the error There is an error drawing layer: <layer_name>
... View more
01-25-2017
07:27 PM
|
0
|
0
|
566
|
POST
|
each service type also has advantages... rendering 100,000 point features is like 10x faster as a dynamicmapservice.
... View more
01-25-2017
10:09 AM
|
1
|
0
|
1240
|
POST
|
Its very simple, i just loop through all the dynamic layers in the map, and apply your "patch" I load it in the header, and since i wanted to be able to just load it in any code ive written, it wont know when the layers will all be loaded, and i didnt want to have to add ANYTHING else to any of the apps. So the timeouts are just waiting and trying again, not pretty i know, but it allows me to not have to add any support code in the apps themselves. I wanted something that would just loop through any dynamic layer, so this is what i've implemented. Though it's FAR from ideal, It's worked great so far. function patch() {
if (map) {
if (map.loaded) {
var patchDebug = true
if (patchDebug) {
console.debug("Applying 10.5 Patch")
}
jQuery.each(map.layerIds, function (index, value) {
map.getLayer(value).on('update-start', function (evt) {
//console.log("Original layerDefs:" + evt.target._params.layerDefs);
try {
if (evt.target._params) {
if (evt.target._params.layerDefs) {
if (evt.target._params.layerDefs.charAt(0) != '{') {
//if not json syntax, convert
evt.target._params.layerDefs = evt.target._params.layerDefs.split(':').join(':"').split(';').join('",') + '"';
evt.target._params.layerDefs = '{' + evt.target._params.layerDefs + '}';
}
if (patchDebug) {
console.log("Patch Corrected " + evt.target.id + " defQ to: " + evt.target._params.layerDefs);
}
}
}
}
catch
(err) {
if (patchDebug) {
console.error(err)
}
}
});
map.getLayer(value).refresh()
})
}
else {
window.setTimeout(function () {
patch()
}, 1000)
}
} else {
window.setTimeout(function () {
patch()
}, 1000)
}
}
window.setTimeout(function () {
patch()
}, 5000)
... View more
01-24-2017
12:15 PM
|
4
|
2
|
985
|
POST
|
This just saved me. After realizing the implications of downgraded ArcGIS server, that became a no-go. Considering that we have dozen of apps, with several dynamic layers in each, manually defining the listener on each layer would be cumbersome. So I am utilizing this logic in a modular js file to include to loop through each dynamic service and apply the listener. Thanks for your help!
... View more
01-15-2017
09:05 AM
|
0
|
4
|
2102
|
POST
|
I am also having the issue. Anyone know of a resource guide for reverting back to 10.3 without a "backup" made?
... View more
01-13-2017
07:17 PM
|
0
|
9
|
2102
|
POST
|
use the URL tied to that service to load the FeatureLayer into your ArcGIS API application. var traffic = new FeatureLayer(" http://services.arcgis.com/AgwDJMQH12AGieWa/arcgis/rest/services/Traffic_Data/FeatureServer/0")
... View more
11-11-2015
02:05 PM
|
0
|
0
|
715
|
POST
|
Hi, I am using a python GP service to run a print task to PDF with custom layouts. This works great, except when i have any map service enabled in the map. The layer in the resulting PDF displays jumbo sized points, and I cannot figure out why or what to change. Thanks in advance for any advice! Javascript printTask = new esri.tasks.PrintTask(printUrl, { //new instance of print job async: false //our service is set to syncronous }); params = new esri.tasks.PrintParameters(); //placeholder for our parameters to put in the script params.map = map; //reference to the active map object function print(){ //action to run when submit is clicked dojo.style(dijit.byId("statusDialog").closeButtonNode, "display", "none"); document.getElementById("printStatus").innerHTML = " Converting to PDF <img src='loader.gif'>"; var title = dijit.byId("title").get("value") //parameter[2] var subtitle = dijit.byId("subtitle").get("value") //parameter[3] var agent = dijit.byId("agent").get("value") //parameter[4] var legendLayer = new esri.tasks.LegendLayer(); params.template = { layout: mxdTemplate, format: 'PDF', preserveScale: false, layoutOptions: { legendLayers: [] } }; params.outSpatialReference = map.spatialReference params.extraParameters = { Title: title, Subtitle: subtitle, Agent: agent }; //the custom parameters for the python script printTask.execute(params, printComplete, printError); //run the task, completion triggers 'printComplete' function, any error triggers printError } function printComplete(result){ dojo.style(dijit.byId("statusDialog").closeButtonNode, "display", "block"); console.log(result.url); document.getElementById("printStatus").innerHTML = "<a href='" + result.url + "' target='_blank'><b>Download PDF<b></a>" //link to the PDF } function printError(error){ dojo.style(dijit.byId("statusDialog").closeButtonNode, "display", "block"); document.getElementById("printStatus").innerHTML = "An unexpected Error has occured <br>( " + error + " )<br> try saving again" //error warning popup } Python GP service import arcpy import os import uuid # Param 0 = INPUT JSON STRING # Param 1 = OUTPUT FILE # Param 2 = Layout Template # Param 3 = Title # Param 4 = Subtitle # Param 5 = Agent # Input WebMap json Web_Map_as_JSON = arcpy.GetParameterAsText(0) # The template location in the server data store templateMxd = arcpy.GetParameterAsText(2) title = arcpy.GetParameterAsText(3) subtitle = arcpy.GetParameterAsText(4) agent = arcpy.GetParameterAsText(5) # Convert the WebMap to a map document result = arcpy.mapping.ConvertWebMapToMapDocument(Web_Map_as_JSON, templateMxd) mxd = result.mapDocument # Reference the data frame that contains the webmap # Note: ConvertWebMapToMapDocument renames the active dataframe in the template_mxd to "Webmap" df = arcpy.mapping.ListDataFrames(mxd, 'Webmap')[0] for elem in arcpy.mapping.ListLayoutElements(mxd,"TEXT_ELEMENT"): if elem.name == "Title": elem.text = title elif elem.name == "Subtitle": elem.text = subtitle elif elem.name == "Agent": elem.text = agent # Use the uuid module to generate a GUID as part of the output name # This will ensure a unique output name output = 'WebMap_{}.pdf'.format(str(uuid.uuid1())) Output_File = os.path.join(arcpy.env.scratchFolder, output) # Export the WebMap arcpy.mapping.ExportToPDF(mxd, Output_File) # Set the output parameter to be the output file of the server job arcpy.SetParameterAsText(1, Output_File) # Clean up - delete the map document reference filePath = mxd.filePath del mxd, result os.remove(filePath)
... View more
11-03-2014
10:52 AM
|
0
|
0
|
2576
|
POST
|
Hi, When i try to print to pdf using the print dijit, it works fine, until i add a layer to the map using a unique-value render (i've tried symbolizing it with simple markers, text, png image markers -- all make it fail). If i change the layer to just a simple marker, not unique values, it prints fine. Anyone else experiencing this? The chrome developer panel logs this error onclicking the print dijit with a unique-value rendered layer visible. "SyntaxError: Unexpected token <
at Object.b.fromJson (http://js.arcgis.com/3.9/init.js:226:310)
at Object.b._contentHandlers.b.contentHandlers.json (http://js.arcgis.com/3.9/init.js:183:373)
at t (http://js.arcgis.com/3.9/init.js:188:81)
at c (http://js.arcgis.com/3.9/init.js:74:221)
at d (http://js.arcgis.com/3.9/init.js:74:10)
at resolve.callback (http://js.arcgis.com/3.9/init.js:75:350)
at http://js.arcgis.com/3.9/init.js:191:300
at k (http://js.arcgis.com/3.9/init.js:195:431)
at r (http://js.arcgis.com/3.9/init.js:195:357)
at resolve (http://js.arcgis.com/3.9/init.js:197:441)" Any input would be much appreciated!!!
... View more
05-20-2014
06:03 AM
|
0
|
0
|
580
|
POST
|
So I've mostly succeeded implementing the latest example for adding the Google StreetView tool to an Esri JS API application. The address and coordinates return successfully, etc. However the actual street view, or panorama control, only appears in the DIV upon a browser re-size. Anyone else experienced this? Esri API v.3.1 Google Maps API v.2 Thanks! rGibson maybe you could try something like this? var panorama = gMap.getStreetView();
google.maps.event.addListener(panorama, 'visible_changed', function(){
google.maps.event.trigger(gMap, 'resize');
})
... View more
05-20-2014
05:47 AM
|
0
|
0
|
220
|
POST
|
This is how i did it [PHP] //Layers, these will be referenced later by their "id" var A = new FeatureLayer("http://maphics:6080/arcgis/rest/services/Transportation/MapServer/4", { mode: FeatureLayer.MODE_SNAPSHOT, infoTemplate: TrafficTemplate, outFields: ["Name1", "AADT2011"], id: "Layer1", opacity: 0 }); l var B = new FeatureLayer("http://maphics:6080/arcgis/rest/services/Transportation/MapServer/6", { mode: FeatureLayer.MODE_SNAPSHOT, infoTemplate: TrafficTemplate, outFields: ["Name1", "AADT2011"], id: "Layer2", opacity: 0 //create a checkbox for each layer (referencing their IDs), that when pressed will toggle show/hide arrayUtils.forEach(["Layer1", "Layer2"], function(id){ new CheckBox({ id: "cb_" + id, name: "cb_" + id, checked: false, onChange: function(bool){ bool ? map.getLayer(this.id.split("_")[1]).show() : map.getLayer(this.id.split("_")[1]).hide(); } }, domConstruct.create("input", { id: "lyr_" + id })).placeAt(dom.byId("layerToggle")); // create a label for the check box var label = domConstruct.create('label', { "for": "cb_" + id, "id": "lbl_" + id, "innerHTML": id }); domConstruct.place(label, dom.byId("layerToggle")); domConstruct.place(domConstruct.create("br"), dom.byId("layerToggle")); });[/PHP]
... View more
05-20-2014
05:34 AM
|
0
|
0
|
434
|
POST
|
Also, when i just have the CSV layer symbolized with, lets say, a circle graphic, (not a PNG image) it prints to PDF fine. So i am assuming there is some issue happening with it being symbolized with an Image. Any ideas?
... View more
05-19-2014
09:36 AM
|
0
|
0
|
207
|
POST
|
Hi, i am attempting to print a map with a csv layer with custom unique value renderer (picture marker symbols) when i have this layer in the map, the print dijit fails, in Chrome logging SyntaxError: Unexpected token < at Object.b.fromJson (http://js.arcgis.com/3.9/init.js:226:310) When i remove the CSV layer, it prints out fine. here is the code in its entirety.
CSVpath = "http://astro.ngacres.com/htmlemails/master/master/lburbank.csv";
request(CSVpath).then(function(data){
lines = data.split(/\r?\n/);
});
var popup = new Popup({
popupWindow: true
}, domConstruct.create("div"));
var csvTemplate = new PopupTemplate({
title: "{name}", //wrap field names in {}
fieldInfos: [
{
fieldName: "address", //acutal field name in the file
visible: true,
label: "Address: " //what shows in the popup box
},
{
fieldName: "city",
visible: true,
label: "City: "
},
{
fieldName: "state",
visible: true,
label: "State: "
},
{
fieldName: "zipcode",
visible: true,
label: "Zip Code: "
},
{
fieldName: "county",
visible: true,
label: "County: "
},
{
fieldName: "psf",
visible: true,
label: "Price per Square Foot: "
},
{
fieldName: "acres",
visible: true,
label: "Acreage: "
},
{
fieldName: "parcel_id",
visible: true,
label: "Parcel Number: "
}
]
});
map = new Map("mapDiv", {
basemap: "hybrid",
center: [-111.98868856152143, 40.76044344742585], // long, lat
zoom: 14, //the smaller the number, the farther it zooms out
infoWindow: popup, //reference to the popup object we made
logo: false, //hide esri logo
minZoom: 3 ,//farthest we can zoom out
wrapAround180: true, //continuous scrolling
slider: true
});
map.attribution.destroy()
csv = new CSVLayer(CSVpath, {
copyright: "Acres Companies",
id: "CSV"
});
csv.setInfoTemplate(csvTemplate);
var i = 1;
var orderNums = []
while(i<100){
orderNums.push(i)
i++
}
map.on("load", addRenderRules); //When the map is done loading, add some rendering rules to the CSV Layer with a function called 'addRenderRules'
function addRenderRules() {
var defaultSymbol = null; //if there is a feature that doesnt match the 'Order' rules, it will not draw
//create renderer and rules
var renderer = new UniqueValueRenderer(defaultSymbol, "order"); //Create the renderer based on the 'Order' field
//add symbol for each value 1-99
for (var n=0;n<orderNums.length;n++){
renderer.addValue(orderNums , new PictureMarkerSymbol('http://astro.ngacres.com/htmlemails/interactive/images/'+orderNums +'.png', 25, 25)) //variable URL to icon images, width, height
};
csv.setRenderer(renderer); //apply the render rules to the CSV layer
}
//ESRI roads layer
var Transportation = new Tiled("http://services.arcgisonline.com/arcgis/rest/services/Reference/World_Transportation/MapServer",{
id: "Roads"
});
var items = []; //placeholder to count the items added to the legend
//once the layers has been added, build the legend by referencing the CSV file
map.on("layers-add-result",function(){
var headers = lines[0].split(',');
var otherData = lines.splice(1);
array.map(headers, function(header){ ///get the header fields from the CSV File
return {
field: header,
name: header
};
});
array.map(otherData, function(line){ //Match the subsequent fields to their headers
var cells = line.split(','), obj = {};
array.forEach(cells, function(cell, idx){
obj[headers[idx]] = cell;
});
if (obj.name !== undefined) { //All valid data added one by one to the legend
items.push(obj.order)
document.getElementById("legendDiv").innerHTML += "<img src=http://astro.ngacres.com/htmlemails/interactive/images/" + obj.order + ".png style='width:20px;height:20px;vertical-align:middle'> " + "<a href='javascript: void(0)' id='button"+obj.order+"'>" + obj.name + "</a><br/>"
}
return obj
});
array.forEach(items, function(id){ //Click on legend to pan to feature
document.getElementById('button' + id).onclick = function(me){
var buttonID = me.srcElement.id.replace(/[A-Za-z]/g,"");
array.forEach(map.getLayer("CSV").graphics, function(item){
if (item.attributes.order === buttonID){
map.centerAt([item.attributes.longitude,item.attributes.latitude]);
}
})
};
})
})
printer = new Print({
map: map,
templates: [{
label: "Letter Portrait",
format: "PDF",
layout: "Letter ANSI A Portrait",
preserveScale: false,
exportOptions: {
dpi: 300
},
showAttribution: false
}, {
label: "Letter Landscape",
format: "PDF",
layout: "Letter ANSI A Landscape",
preserveScale: false,
exportOptions: {
dpi: 300
},
showAttribution: false
}],
url: "http://maphics:6080/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task"
}, dom.byId("printButton"));
printer.startup();
map.addLayers([csv,Transportation]); //add the layers to the map
});
}); How can i get the print dijit working with my CSV layer in the map? Any help would be much appreciated!!!
... View more
05-19-2014
07:54 AM
|
0
|
1
|
2326
|
Title | Kudos | Posted |
---|---|---|
1 | 01-25-2017 10:09 AM | |
4 | 01-24-2017 12:15 PM | |
1 | 02-06-2017 12:20 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|