|
POST
|
Did you set the printTemplate.layout to be "MAP_ONLY"? If so, there should have no problem. I have an app doing exactly the same thing, and I can get the map image showing the exact map area constrained with the drawn rectangle area. The DPI is set to 96. Please note that the exportOptions.width and height only work and required for MAP_ONLY. If you use other layout options, the map size is determined by the map area defined in the map template you choose. With that, if the map size on the template is different than that on the screen, which is true most of the cases, then the map area you see on the printout will be different than that on the screen. Hope it helps.
... View more
10-16-2013
02:39 PM
|
0
|
0
|
1017
|
|
POST
|
Ed, below code only hides the map service layers, like tiled or dynamic map service layers. Feature layers are a special type of graphics layers. map.graphicsLayerIds contains ids of all the graphics layers loaded to the map, including the feature layers. // hide other layers dojo.forEach(map.layerIds, function(id) { map.getLayer(id).hide(); }); Below code will hide all the feature layers. If you like to hide all the graphics layers, then simply move layer.hide(); out of the if statement. // hide all feature layers dojo.forEach(map.graphicsLayerIds, function(id) { var layer = map.getLayer(id); if (layer.declaredClass === "esri.layers.FeatureLayer") { layer.hide(); } }); Same idea applies if you like to show a feature layer.
... View more
10-15-2013
06:04 AM
|
0
|
0
|
509
|
|
POST
|
Must be something wrong inside the loop. Please post the code containing the whole loop.
... View more
10-15-2013
05:51 AM
|
0
|
0
|
984
|
|
POST
|
This is what you can do. Define a object that contains the selected feature count for each feature layer. Remember to reset the object to empty object prior to each selection. var selectedFeatureCount = {}; Change your callback function to accept two parameters: the feature layer and the result returned from selectFeatures. function selectCallback(featureLayer, selectResult) {
selectedFeatureCount[featureLayer.id] = selectResult.features.length;
// process your select result
} Change selectFeatures statement as below. featLayer.selectFeatures(query, selectionMethod, function(result) {
selectCallback(featLayer, result);
},errback?)
... View more
10-14-2013
09:59 AM
|
0
|
0
|
984
|
|
POST
|
Understand. But I believe creating 40 map templates takes much less effort than developing custom print solution. Map templates are very easy to create, maintain, and deploy. They are scalable as well. Even if you develop custom solution, you will still need to figure out how to deal with different page sizes, orientation and custom layout options. I used to develop one template, but to use CSS and JS to control the layout, orientation and paper sizes. But trust me, it is not fun. I'd go for ESRI's solution if that works for you. If you still like to consider developing custom print solution, you can develop server object extension either using ArcObjects or arcpy.mapping. Here is the link that may be useful: http://resources.arcgis.com/en/help/main/10.1/index.html#//01540000056t000000. Stay away from Web ADF. It's deprecated.
... View more
10-11-2013
07:04 AM
|
0
|
0
|
1107
|
|
POST
|
Hi Miguel, If you want to use ESRI's print solution (PrintDijit or PrintTask), using Templates to determine the page size, layout and orientation might be the only way to go, and I believe might be the easiest way per design perspective. Otherwise, you may end up developing custom solution on your own. Good luck.
... View more
10-11-2013
06:14 AM
|
0
|
0
|
1107
|
|
POST
|
You will need to disconnect the default event handlers for onClick and onDoubleClick, and define your own version of onClick event handler. Here is the sample which I tested working, assuming two things: code in legacy mode and the drawToolbar and map objects are global variables. drawToolbar.activate(esri.toolbars.Draw.POLYLINE); dojo.disconnect(drawToolbar._onDblClickHandler_connect); dojo.disconnect(drawToolbar._onClickHandler_connect); drawToolbar._onClickHandler_connect = dojo.connect(map, "onClick", onMapClick); function onMapClick(evt) { if (evt.ctrlKey) { drawToolbar._onDblClickHandler(evt); // end draw operation } else { drawToolbar._onClickHandler(evt); // normal draw operation } }
... View more
10-09-2013
03:00 PM
|
0
|
0
|
753
|
|
POST
|
Hi roessera, how do you assign the triangle to text like text : "�?�"? When I copy the triangle and paste to the code and try to save the change, I got the attached error. But if I use the unicode like text : "▲", it will display just like ▲, not the triangle. [ATTACH=CONFIG]28194[/ATTACH]
... View more
10-09-2013
10:41 AM
|
0
|
1
|
3862
|
|
POST
|
IdentifyTask.execute returns the attributes for each feature with the field alias names instead of the field name. So change all the fieldName property in each fieldInfos with the field alias name. It should work then. Note that the fieldName value is case-sensitive. To test it, take "Public Schools K12" layer as example. Change: if (result.layerName === 'Public Schools K12') { //console.log(feature.attributes.PARCELID); var template = new PopupTemplate({ title: "Public Schools K12", //description: , fieldInfos: [{ // define field infos to specify alias fieldName: "INST_NAME", visible: true, label: "Name: " }, { fieldName: "ADDRESS", visible: true, label: "ADDRESS: " }, { fieldName: "CITY", visible: true, label: "CITY: " }] }); To: if (result.layerName === 'Public Schools K12') { //console.log(feature.attributes.PARCELID); var template = new PopupTemplate({ title: "Public Schools K12", //description: , fieldInfos: [{ // define field infos to specify alias fieldName: "Name of the Institution", visible: true, label: "Name: " }, { fieldName: "Address", visible: true, label: "ADDRESS: " }, { fieldName: "City", visible: true, label: "CITY: " }] });
... View more
10-08-2013
02:35 PM
|
0
|
0
|
999
|
|
POST
|
Hi Ben, Your approach works great! So far, that might be the best workaround for the print issues I have experienced. I like to summarize the print issues we experienced related to the JSAPI. Two main issues: If one graphics layer contains points using any MarkerSymbol and texts (texts are point spatial type but using TextSymbol. For simplicity, I just use points as spatial features, and texts as label or informative message), the printout using PrintTask will vary depending on the order points and texts are added to the layer. If points are added first, the texts will be drawn using the point symbol. If texts added first, the points will disappear on the printout. If one graphics layer contains mixed spatial types, like using drawing tool to draw polygons, lines, points, multipoints and texts, no matter what order they are added, the PrintTask will re-shuffle all the graphics and put them into four sub-layers: pointLayer, polylineLayer, polygonLayer and multipointLayer. These four sub-layers will be added to the printout page in the order from top to bottom as multipointLayer, polygonLayer, polylineLayer and pointLayer. The result will be all polygons will be on top of lines and points even if you added the points and lines on top of polygons. I firmly believe they are the bugs. Hopefully ESRI can recognize these and correct them in the future release. For the second issue, I don't quite understand why all the graphics need to be shuffled into four categories. Why not just add and render each graphic as it is added to the layer?
... View more
10-08-2013
06:12 AM
|
0
|
0
|
613
|
|
POST
|
I am using PrintTask in JSAPI 3.6 for the map print. Everything works fine until I want to print a map with a graphics layer that contains points AND texts. The print result varies based on the order in which the points and texts are added to the graphics layer. For simplicity, let's draw one point first and then one text on the map. On the printout, the point will be displayed correctly, but the text will be displayed using the same symbol as the point. No text string. Ok, let's switch the order. Add the text first and then the point. This time on the printout, the text will be displayed correctly, but the point disappears! I have tested the behavior via my app and the REST service endpoint, and got the same result. Below is the sample Web_Map_as_JSON string for test for point first then text. { "mapOptions": { "showAttribution": true, "extent": { "xmin": -10626238.11274791, "ymin": 3299637.0692294897, "xmax": -9574464.603543935, "ymax": 3846926.191751325, "spatialReference": { "wkid": 102100 } }, "spatialReference": { "wkid": 102100 }, "scale": 2311162.2171550025 }, "operationalLayers": [{ "id": "Ocean", "title": "Ocean", "opacity": 1, "minScale": 591657527.591555, "maxScale": 9027.977411, "url": "http://services.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer" }, { "id": "Boundaries", "title": "Boundaries", "opacity": 1, "minScale": 0, "maxScale": 0, "url": "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer", "visibleLayers": null, "layers": [] }, { "id": "map_graphics", "minScale": 0, "maxScale": 0, "featureCollection": { "layers": [{ "layerDefinition": { "name": "pointLayer", "geometryType": "esriGeometryPoint" }, "featureSet": { "geometryType": "esriGeometryPoint", "features": [{ "geometry": { "x": -10069165.050605573, "y": 3702001.586122638, "spatialReference": { "wkid": 102100 } }, "symbol": { "color": [0, 255, 0, 191], "size": 7.5, "angle": 0, "xoffset": 0, "yoffset": 0, "type": "esriSMS", "style": "esriSMSSquare", "outline": { "color": [0, 0, 0, 255], "width": 1, "type": "esriSLS", "style": "esriSLSSolid" } } }, { "geometry": { "x": -10056323.629853662, "y": 3658585.35405666, "spatialReference": { "wkid": 102100 } }, "symbol": { "color": [0, 0, 0, 255], "type": "esriTS", "angle": "0", "xoffset": 0, "yoffset": 0, "text": "Teest Text", "decoration": "none", "rotated": false, "kerning": true, "font": { "size": 16, "style": "italic", "variant": "normal", "weight": "bold", "family": "Arial" } } }] } }] } }], "exportOptions": { "outputSize": [800, 1100], "dpi": 96 } } Does anybody else experience the same problem or only me? Any workaround? Thanks.
... View more
10-04-2013
09:55 AM
|
0
|
2
|
1285
|
|
POST
|
Move the creation of basemapGallery inside the callback function of createMap; otherwise, map may be undefined when you assign map to basemapGallery.map. <script>
var map;
require([
"esri/map", "esri/dijit/BasemapGallery", "esri/arcgis/utils",
"dojo/parser",
"dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dijit/TitlePane",
"dojo/domReady!"
], function(
Map, BasemapGallery, arcgisUtils, parser
) {
parser.parse();
arcgisUtils.createMap("ff0591055e3541ab951f3494c3553181", "mapDiv").then(function (response) {
map = response.map;
//add the basemap gallery, in this case we'll display maps from ArcGIS.com including bing maps
var basemapGallery = new BasemapGallery({
showArcGISBasemaps: true,
map: map
}, "basemapGallery");
basemapGallery.startup();
basemapGallery.on("error", function(msg) {
console.log("basemap gallery error: ", msg);
});
});
});
</script>
... View more
10-02-2013
12:56 PM
|
0
|
0
|
794
|
|
POST
|
What the doc says is correct. It is useful when you need to query the related records for some features, but no need to get those feature details. Here is the code snippet from ESRI document. Consider to replace [graphicAttributes.OBJECTID] in relatedQuery.objectIds = [graphicAttributes.OBJECTID]; with the objectIds returned from the queryIds method call. require([
"esri/layers/FeatureLayer", "esri/tasks/RelationshipQuery", "dojo/_base/connect", ...
], function(FeatureLayer, RelationshipQuery, connect, ... ) {
var featureLayer = new FeatureLayer( ... );
var relatedQuery = new RelationshipQuery();
relatedQuery.outFields = ["AGREE_WITH_INCIDENT"];
relatedQuery.relationshipId = 1;
//query for the features related to the "clicked" feature
connect.connect(featureLayer, "onClick", function(evt) {
graphicAttributes = evt.graphic.attributes;
relatedQuery.objectIds = [graphicAttributes.OBJECTID];
featureLayer.queryRelatedFeatures(relatedQuery,relatedRecords);
}
...
});
... View more
10-01-2013
02:28 PM
|
0
|
0
|
471
|
|
POST
|
Try to change: // DELETE TOOL
function EditingDeleteFeature(results) {
var deleteFeatureslLayer = results[0].layer;
var layers = dojo.map(results, function (result) {
return result.layer;
});
// Ctrl+click to delete features and add this delete operation to undomanager
dojo.connect(deleteFeatureslLayer, "onClick", function (evt) {
dojo.stopEvent(evt);
// DELETE FEATURE IS DELETE BUTTON IS CHECKED (ACTIVE)
if (dijit.byId("tool_delete").checked) {
deleteFeatureslLayer.applyEdits(null, null, [evt.graphic], function () {
operation = new esri.dijit.editing.Delete({
featureLayer: deleteFeatureslLayer,
deletedGraphics: [evt.graphic]
});
});
}
});
} To: // DELETE TOOL
function EditingDeleteFeature(results) {
var layers = dojo.map(results, function (result) {
return result.layer;
});
// Ctrl+click to delete features and add this delete operation to undomanager
dojo.forEach(layers, function (deleteFeatureslLayer) {
dojo.connect(deleteFeatureslLayer, "onClick", function (evt) {
dojo.stopEvent(evt);
// DELETE FEATURE IS DELETE BUTTON IS CHECKED (ACTIVE)
if (dijit.byId("tool_delete").checked) {
deleteFeatureslLayer.applyEdits(null, null, [evt.graphic], function () {
operation = new esri.dijit.editing.Delete({
featureLayer: deleteFeatureslLayer,
deletedGraphics: [evt.graphic]
});
});
}
});
}; }
... View more
10-01-2013
02:12 PM
|
0
|
0
|
1163
|
|
POST
|
The alias you set for "dojo/_base/array" module is arrayUtils, not array. So Change: var data = array.map(results.features, function (feature) { To: var data = arrayUtils.map(results.features, function (feature) { Remember to change all array operations accordingly.
... View more
09-30-2013
07:31 PM
|
0
|
0
|
1692
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-17-2013 05:16 AM | |
| 1 | 11-06-2013 04:34 AM | |
| 1 | 08-29-2013 10:58 AM | |
| 6 | 10-20-2020 02:09 PM | |
| 1 | 11-20-2013 06:09 AM |
| Online Status |
Offline
|
| Date Last Visited |
10-17-2024
08:41 AM
|