|
POST
|
Unfortunately, lots of layer properties won't be available until the layer is loaded. There will be some tradeoff for API design. It may sacrifice performance if have all the layer properties available at the map service level. Lazy loading can get better performance but you will need to get the info via ajax calls once in need. It's always hard to balance how to get the best performance and the most of the useful info at the same time. Anyway, for now, REST ajax call or feature layer onLoad approach might be the best way to go. Please let me know there is a better way.
... View more
08-20-2013
09:15 AM
|
0
|
0
|
1613
|
|
POST
|
Ok. Try this then: function init(){
var webmapid = "6eb589248e684df282db5bcd993d1ebe";
esri.arcgis.utils.createMap(webmapid, "map").then(function(response){
map = response.map;
var initExtent = new esri.geometry.Extent({
xmin:1577660.2638056062,
ymin::5056615.1691762265,
xmax::1604566.0977619751,
ymax:5120210.7767094625,
spatialReference:{wkid:102100}
});
map.setExtent(initExtent);
});
... View more
08-20-2013
09:08 AM
|
0
|
0
|
1427
|
|
POST
|
Change: dojo.connect(measurement, "onMeasureEnd", function(activeTool,geometry){
this.setTool(activeTool, false)
dojo.aspect.after(measurement, "setTool", toggleIdentify, true);
}); To: dojo.aspect.after(measurement, "setTool", toggleIdentify, true);
dojo.connect(measurement, "onMeasureEnd", function(activeTool,geometry){
this.setTool(activeTool, false)
});
... View more
08-20-2013
08:43 AM
|
0
|
0
|
1608
|
|
POST
|
1. In order for you to add anything that not showing on the printout, more than likely, you will need to modify the MXD templates that served as the print page templates. You can find these templates under <arcgis server folder>/templates on your arcgis server machine. If you are using third party print url, that will be an unfortunate. 2. To add anything to your popup, you just need to modify the popup content.
... View more
08-20-2013
06:42 AM
|
0
|
0
|
1472
|
|
POST
|
Have you tried my approach? My approach assumes that identifyHandler is a global variable. You will need to change it if not.
... View more
08-20-2013
06:30 AM
|
0
|
0
|
2455
|
|
POST
|
The extent in my code is just an example. You will need to replace with your extent with the spatial reference used in your web map.
... View more
08-20-2013
06:24 AM
|
0
|
0
|
1427
|
|
POST
|
esri.arcgis.utils.createMap(webmapid, "mapDiv", { mapOptions: { extent: new Extent({ xmin:-20098296, ymin:-2804413, xmax:5920428, ymax:15813776, spatialReference:{wkid:54032} }) } })
... View more
08-20-2013
05:36 AM
|
0
|
0
|
1427
|
|
POST
|
Try this:
// invoke toggleIdentify after measurement.setTool is called.
// The last parameter "true" means to pass the setTool parameter to toggleIdentify
dojo.aspect.after(measurement, "setTool", toggleIdentify, true);
function toggleIdentify(toolName, activate) {
// disable identifyHandler when measurement tool is set and activated
if (activate && identifyHandler) {
dojo.disconnect(identifyHandler);
identifyHandler = null;
}
// activate identify tool otherwise
else {
identifyHandler = map.on("click", executeIdentifyTask);
}
}
... View more
08-19-2013
08:46 PM
|
0
|
0
|
2455
|
|
POST
|
dojox.image.Magnifier is used to magnify an image that only makes an image larger. It cannot be used to show anything that dos not appear on the image. While a map maginifier will zoom the map in different zoom level, which may display some detail information that does not appear on the main map. So dojox.image.Magnifier cannot serve for the purpose of a map magnifier. Unfortunately, ESRI JS API does not provide a magnifying dijit. An idea is to create a movable div using dojo.dnd.Movable. Inside the movable div will be another map object whose zoom level will be the main map zoom level plus a number that designated by the magnifier. When drag and move the div, the magnifying map object will need to change its extent or center accordingly.
... View more
08-19-2013
06:27 AM
|
0
|
0
|
981
|
|
POST
|
You guess right. Point extent is still a point. You can recenter the map to the selected point, but not zoom it to a point. Two options: 1. Create an extent around the point: var distance = 500; var newExtent = new esri.geometry.Extent({ "xmin": pnt.x - distance, "ymin": pnt.y - distance, "xmax": pnt.x + distance, "ymax": pnt.y + distance, "spatialReference":{"wkid":4326} // change 4326 to your choice }); map.setExtent(newExtent); 2. As you already coded, use map.centerAndZoom(center, zoom); 3. Use geometryService to create a buffer around the point, and zoom the map to the result extent in the callback function.
... View more
08-17-2013
06:23 AM
|
0
|
0
|
1831
|
|
POST
|
You are welcome, Eric. Just keep us posted for what you get.
... View more
08-16-2013
02:49 PM
|
0
|
0
|
1325
|
|
POST
|
They are the same as to the application. pjson stands for "Pretty JSON":) It's formatted in a way good for reading.
... View more
08-16-2013
12:51 PM
|
0
|
0
|
1325
|
|
POST
|
An alternative way is to create a feature layer for each layer in the map service, and you can get the geometry type using featLayer.geometryType property inside the onLoad callback function. But I don't think it will be any better than using the REST API directly unless you will need to operate with the feature layer.
... View more
08-16-2013
12:47 PM
|
0
|
0
|
1613
|
|
POST
|
esri.setRequestPreCallback only fires "just before esri.request calls into dojo IO functions such as dojo.rawXhrPost and dojo.io.script.get." Adding the layer to the map object won't cause any dojo io functions. That's why it won't be triggered. If you want to access the secured map service, you can use proxy server and add the token to the map service url via proxy config file. Here is the link for the details: https://developers.arcgis.com/en/javascript/jshelp/ags_secureservices.html.
... View more
08-16-2013
11:48 AM
|
0
|
0
|
512
|
|
POST
|
Zach's approach should be the easiest solution if you can modify the MXD used for the map service. If you happen to use third-party map service, you may need to develop a custom legend dijit that you will have full control over how to format the legend labels. Here is a code snippet showing the workflow. You can render the legend the way you like inside the function loadLegend. dojo.forEach(map.layerIds, function(layerId) {
var legendRequest = esri.request({
url: map.getLayer(layerId).url + "/legend?f=json",
handleAs: "json"
});
legendRequest.then(
// if the legend REST service succeeds, create the placeholder for each layer legend
function(data) {
if (data && data.layers && data.layers.length > 0) {
// create the placeholder for each layer legend
loadLegend(data.layers, layerId);
}
}, function(error) {
console.log(error);
});
});
// legendNode is the container node for the legend
loadLegend: function(layers, svcLayerId) {
dojo.forEach(layers, function(layer) {
var legends = layer.legend;
if (legends.length > 0) {
var newLegendContainer = dojo.create("div", {className: "clsLegendNodeContainer"}, legendNode);
var newLegendLayerName = dojo.create("div", {className: "clsLegendLayerName", innerHTML: layer.displayName || layer.layerName}, newLegendContainer);
var newLegend, newLabel, imageSrc;
dojo.forEach(legends, function(aLegend) {
newLegend = dojo.create("div", {className: "clsLayerLegend"}, newLegendContainer);
imageSrc = "data:" + aLegend.contentType + ";base64," + aLegend.imageData;
dojo.create("img", {src: imageSrc}, newLegend);
dojo.create("label", {className: "clsLegendLabel", innerHTML: aLegend.label}, newLegend);
});
}
});
}
... View more
08-16-2013
11:35 AM
|
0
|
0
|
1325
|
| 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
|