POST
|
For anyone still having this issue (I was in 3.18), this appears to be the fix. It's not a "bug" per se, just that the wkid you pass to the SpatialReference constructor must be a number, not a string. If you are getting your wkid from a configuration file, consider using dojo/number.parse() to convert it to a number.
... View more
03-05-2017
04:50 PM
|
0
|
0
|
414
|
POST
|
I'm using JSAPI 3.8 on AGS10.2.1. I'm creating a very simple print task like this
var url = configuration.servicesHome + "/Utilities/PrintingTools/GPServer/Export Web Map Task";
console.log(url);
var template = new PrintTemplate();
template.layoutOptions = {
titleText: "Selected Work",
legendLayers: []
};
template.format = "PDF";
template.layout = "A4 Landscape";
template.exportOptions = {
width: 1024,
height: 786,
dpi: 96
};
var params = new PrintParameters();
params.template = template;
params.map = map;
showLoading();
var printTask = new PrintTask(url);
printTask.execute(params, function(results){
window.open(results.url);
hideLoading();
});
If I check the request, I get a value for Web_Map_as_JSON that looks like this...
{
"mapOptions": {
"showAttribution": true,
"extent": {
"xmin": 503082.44985599886,
"ymin": 6944909.337356286,
"xmax": 503759.78454400157,
"ymax": 6945403.050843714,
"spatialReference": {
"wkid": 28356,
"latestWkid": 28356
}
},
"spatialReference": {
"wkid": 28356,
"latestWkid": 28356
},
"scale": 1999.9999999999995
},
"operationalLayers": [{
"id": "layer2",
"title": "layer2",
"opacity": 1,
"minScale": 1000000,
"maxScale": 200,
"url": "http://gisapps/ArcGIS/rest/services/gis_cache_prd/MapServer"
},
{
"id": "layer3",
"title": "layer3",
"opacity": 1,
"minScale": 1000000,
"maxScale": 200,
"url": "http://gisapps/ArcGIS/rest/services/gis_client_prd/MapServer"
},
{
"id": "layer4",
"title": "layer4",
"opacity": 1,
"minScale": 500000,
"maxScale": 0,
"url": "http://gisapps/arcgis/rest/services/work_orders_prd/MapServer",
"visibleLayers": [1,
3,
4,
5,
6,
7],
"layers": []
},
{
"id": "graphicsLayer5",
"minScale": 0,
"maxScale": 0,
"featureCollection": {
"layers": []
}
},
{
"id": "graphicsLayer6",
"minScale": 0,
"maxScale": 0,
"featureCollection": {
"layers": []
}
},
{
"id": "graphicsLayer7",
"minScale": 0,
"maxScale": 0,
"featureCollection": {
"layers": []
}
},
{
"id": "graphicsLayer8",
"minScale": 0,
"maxScale": 0,
"featureCollection": {
"layers": []
}
},
{
"id": "graphicsLayer9",
"minScale": 0,
"maxScale": 0,
"featureCollection": {
"layers": []
}
},
{
"id": "map_graphics",
"minScale": 0,
"maxScale": 0,
"featureCollection": {
"layers": [{
"layerDefinition": {
"name": "pointLayer",
"geometryType": "esriGeometryPoint"
},
"featureSet": {
"geometryType": "esriGeometryPoint",
"features": [{
"geometry": {
"x": 503421.1172000002,
"y": 6945156.1941,
"spatialReference": {
"wkid": 28356,
"latestWkid": 28356
}
},
"attributes": {
"SITE_SUN": 1529778
},
"symbol": {
"color": [0,
255,
0,
64],
"size": 13.5,
"angle": 0,
"xoffset": 0,
"yoffset": 0,
"type": "esriSMS",
"style": "esriSMSSquare",
"outline": {
"color": [0,
255,
0,
255],
"width": 0.75,
"type": "esriSLS",
"style": "esriSLSSolid"
}
}
}]
}
}]
}
}],
"exportOptions": {
"outputSize": [1024,
786],
"dpi": 96
},
"layoutOptions": {
"titleText": "Selected Work",
"scaleBarOptions": {
},
"legendOptions": {
"operationalLayers": []
}
}
}
And the resulting map appears as I expect. If however I add a layer definition to one of the layers such that the resulting Web_Map_as_JSON is this
// Everything is identical except the layer definition on "layer4" which now looks like this...
//...
{
"id": "layer4",
"title": "layer4",
"opacity": 1,
"minScale": 500000,
"maxScale": 0,
"url": "http://gisapps/arcgis/rest/services/work_orders_prd/MapServer",
"visibleLayers": [1,
3,
4,
5,
6,
7],
"layers": [{
"id": 7,
"layerDefinition": {
"definitionExpression": "LAST_SCH_DATE >= date '2014-4-1' and LAST_SCH_DATE <= date '2014-8-31'",
"layerTimeOptions": null
}
}]
},
// ...
That layer ("layer4") no longer appears on my print map and I can see a "severe" error in my ArcGIS server log which reads "layer4: invalid or corrupt file". Has anyone else had success adding layer definitions (particularly when using dates and/or other standardized queries) to maps for print tasks?
... View more
06-23-2014
10:07 PM
|
0
|
3
|
2356
|
POST
|
Thanks Tim, one more question if I may. For reasons I wont go into, I have to be sure whatever I develop runs on IE8. Are there any browser version limitations placed on the developer by the JavaScript API versions? I realise there may be some functionality that can't be presented to users on old broswers but will the latest APi's still allow the user tto run basic ESRI viewer functionality something on IE8? thanks for your help Graham For the record, I also develop for IE8 and I do frequently run into issues, but it's almost always the lack of HTML5 and CSS support in IE8 (and IE8 being generally terrible at rendering javascript) rather than the functionality of the API itself. My best advice is keep it simple. 😛 Things like adding lots of graphics will result in pretty bad performance. That said, I have also run into occasional API issues between browsers... but that will happen from time to time with any web API (any any API for that matter :p).
... View more
04-10-2014
05:09 AM
|
0
|
0
|
312
|
POST
|
The API is more or less independent of the server version. There probably exists cases where the API might not support a server feature... but none spring to mind. 😛
... View more
04-10-2014
04:25 AM
|
0
|
0
|
312
|
POST
|
If you are querying just a single layer, you could use a query task and write a more specific "where" clause like "street_name = 'SOUTH' and owner_name = 'katz'". https://developers.arcgis.com/javascript/jsapi/query-amd.html#where
... View more
04-10-2014
04:16 AM
|
0
|
0
|
1641
|
POST
|
Can you log your query.where to the console? I'm not sure if it is your only problem, but at a first glance it looks like you're probably missing a space before the "LIKE" in this line: query.where = optionValue + "LIKE '%" + sel +"%'";
... View more
04-09-2014
09:24 PM
|
0
|
0
|
116
|
POST
|
I think "searchText" is probably what you are looking for. https://developers.arcgis.com/javascript/jsapi/findparameters-amd.html#searchtext
... View more
04-09-2014
09:16 PM
|
0
|
0
|
1641
|
POST
|
I have a site with two cached map services and one dynamic service. When I add my dynamic layer to my map, I call .setVisibleLayers([ ... ]) to set my desired layers. One of the layers is a group layer, the others are in the "root" level. I pass the "group" level id to .setVisibleLayers([ ... ]) for the group layer as I want all layers in that group visible. I've created a "print" function which is called from a button onclick which executes a simple PrintTask.
function printMap() {
require(["esri/tasks/PrintTask", "esri/tasks/PrintParameters", "esri/tasks/PrintTemplate"],
function(PrintTask, PrintParameters, PrintTemplate){
var url = "http://gisapps/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export Web Map Task";
var template = new PrintTemplate();
template.layoutOptions = {
titleText: "Selected Work",
legendLayers: []
};
template.format = "PDF";
template.layout = "A4 Landscape";
template.exportOptions = {
width: 1024,
height: 786,
dpi: 96
};
var params = new PrintParameters();
params.template = template;
params.map = map;
var printTask = new PrintTask(url);
printTask.execute(params, function(results){
window.open(results.url);
});
}
);
}
When I execute this PrintTask, the grouped layers in my dynamic service do not appear in the output - the other layers do. If instead of supplying the group layer id to .setVisibleLayers[ ... ]) I supply the individual layer ids, they then appear in the PrintTask output. I'm fairly sure this is a bug, because it would seem a bit strange that supplying the group layer id to .setVisibleLayers() would result in all layers in the group becoming visible in the map, but not the output of the PrintTask.
... View more
04-07-2014
09:08 PM
|
2
|
2
|
939
|
POST
|
Yep, it should log as a POST request, and it should display like "http://urltoproxy/proxy.jsp?http://urltoarcgis/services?allyourparameters=12345 I would say it's not going via your proxy because that url isn't exceeding the ~2000 character length restriction (or whatever it is for your browser). You could set "alwaysUseProxy" to ensure that your proxy is always called if you want to test it is working. https://developers.arcgis.com/javascript/jshelp/inside_defaults.html
... View more
04-05-2014
07:14 PM
|
0
|
0
|
634
|
POST
|
Also, it doesn't look like you're waiting for your DOM and all of your widgets/components to finish loading before you start trying to access them. I usually just use data-dojo-config="praseOnLoad: true" to do this to make sure the document gets parsed when the page loads and then wrap my loading function inside a dojo/ready which makes sure that all the required widgets have laoded. See here and here for more info on this. It would look something like this (I took out your TOC, but you should be able to add it back in when you run it in your environment). http://jsbin.com/ficetiwo/1/edit
... View more
04-03-2014
07:14 PM
|
0
|
0
|
465
|
POST
|
It looks like there are quite a few issues with your code. Some that jump out... - It doesn't look like your main BorderContainer has a closing tag. - Your javascript is all messed up. You are missing closing parenthesis and braces. - It doesn't look like you've defined the function "executeQueryTask" which you set as the callback on the click of your Query button Go through your javascript carefully and make sure that all your braces and parenthesis are opening and closing where they should be. When you load your page, you can open the developer tools of whatever browser you are using and it will report a lot of these errors.
... View more
04-03-2014
06:34 PM
|
0
|
0
|
465
|
POST
|
You just need to be careful because you define "Area" as a FeatureSet and assign that to params.Area_of_Interest, but you also assign featureSet.features[0].geometry.toJson() to params.Area_of_Interest and this is a geometry. You should decide which type you want to assign, a FeatureSet or a geometry. Probably what you want is just something like this
queryTask.execute(query, function(featureSet){
var Area = new FeatureSet();
var features = [];
features.push(map.graphics.graphics[0]);
Area.features = features;
var params = {
"Layers_to_Clip": clipLayers,
"Feature_Format": registry.byId("formatBox").get("value")
};
if (featureSet.features.length > 0) {
var AOI = featureSet.features[0].geometry;
params.Area_of_Interest = AOI;
} else {
params.Area_of_Interest = map.graphics.graphics[0].geometry;
}
// now do something with "params" here
});
... View more
04-03-2014
03:20 PM
|
0
|
0
|
465
|
POST
|
Sounds like you want to use filter instead of map? http://dojotoolkit.org/reference-guide/1.9/dojo/_base/array.html#filter I think your code would look something like this var templateLayers = arrayUtils.filter(evt.layers, function(result){
return result.layer.id == "id of layer you want";
});
... View more
04-02-2014
09:57 PM
|
0
|
1
|
249
|
POST
|
I'm not familiar with the sample you referenced, but after a quick look at your code and I think there are few issues here... 1) You need to include the brackets to call a function. So where you have "if (executeQueryTask)", this should read "if (executeQueryTask())" if you want it to call your function. As it stands, it will always return true. 2) executeQueryTask() returns nothing, so if you do call it from your if statement, it will always return false. 3) queryTask.execute() is asynchronous, so if you do call executeQueryTask in your "if" statement, it will not wait queryTask.execute() to complete before returning. 4) You are declaring AOI within the scope of the callback function on queryTask.execute(). It will not be accessible in other areas of your code. You should declare this outside the callback function and then assign it within the callback function. I think what you probably want to do is include all that code inside the call back function, so the callback function will look something like this
queryTask.execute(query, function(featureSet){
var Area = new FeatureSet();
var features = [];
features.push(map.graphics.graphics[0]);
Area.features = features;
var params = {
"Layers_to_Clip": clipLayers,
"Feature_Format": registry.byId("formatBox").get("value")
};
if (featureSet.features.length > 0) {
var AOI = featureSet.features[0].geometry.toJSON();
params.Area_of_Interest = AOI;
} else {
params.Area_of_Interest = Area;
}
// now do something with "params" here
});
edit: Actually, there is still a question of what you want params.Area_of_Interest to actually be? In one case you are setting it to be a geometry string with: featureSet.features[0].geometry.toJson()... in the other case you are setting it to be a FeatureSet.
... View more
04-02-2014
07:05 PM
|
0
|
0
|
465
|
POST
|
To answer the original question, the maximum url length depends on your browser. In IE it's 2,083 characters. http://support.microsoft.com/kb/208427 And the easiest way to check the length of the url being created is in the developer tools/console of whatever browser you are using.
... View more
04-02-2014
06:01 PM
|
0
|
0
|
634
|
Title | Kudos | Posted |
---|---|---|
2 | 04-07-2014 09:08 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|