POST
|
I have a ArcGISDynamicMapServiceLayer that I only want to make it visible when you get higher than scale 4 in the map as defined by my ArcGISTiledMapServiceLayer and I can't find a good way to do this. I have it so that the layers aren't visible in mxd at these scales but I had to use a nontransparent ImageFormat to get the detail I wanted in the layer. I think I'm almost there, code excerpts are below. dojo.connect(map, "onExtentChange", LayerVisible) function LayerVisible(extent, delta, outLevelChange, outLod) { if(outLod.level > 4) { }} I want to use something like MyLayer.setOpacity(0) inside the brackets but I can't seem to pass the MyLayer properly to a function or access it from within the function without passing it. Can anyone help me or tell me how else to make an entire dynamicservicelayer not show at a certain scale.
... View more
08-09-2012
10:25 AM
|
0
|
1
|
573
|
POST
|
content += "<td>" + layerResults.features.attributes['FieldName'] + "</td>"; is what's displaying the value and it seems that for the number classes it is not receiving a value to put in. Though it works for string fields. I can't convert it to a string or number because no value comes across from the feature to put in the datagrid
... View more
07-01-2010
12:00 PM
|
0
|
0
|
237
|
POST
|
This is the code directly from the sample. It works in the sample and when I point it at my map, feature classes, and fields it works for Text classes. When I point it at a Long or Integer class it comes up with an <undefined> as a result instead of showing the value <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta http-equiv="X-UA-Compatible" content="IE=7" /> <title>Identify Sample</title> <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/1.6/js/dojo/dijit/themes/tundra/tundra.css"> <script type="text/javascript">djConfig = { parseOnLoad:true }</script> <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=1.6"></script> <script type="text/javascript"> dojo.require("esri.map"); dojo.require("esri.tasks.identify"); dojo.require("dijit.layout.ContentPane"); dojo.require("dijit.layout.TabContainer"); dojo.require("dijit.form.Button"); var map, identifyTask, identifyParams, symbol; var layer2results, layer3results, layer4results; function init() { map = new esri.Map("mapDiv", { extent: new esri.geometry.Extent(-122.580,45.482,-122.571,45.488, new esri.SpatialReference({wkid:4326})) }); dojo.connect(map, "onLoad", initFunctionality); var imageryPrime = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer"); map.addLayer(imageryPrime); var portlandLandBase = new esri.layers.ArcGISTiledMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Portland/Portland_ESRI_LandBase_AGO/MapServer"); portlandLandBase.setOpacity(0.65); map.addLayer(portlandLandBase); dojo.connect(map.infoWindow, "onShow", function() { dijit.byId("tabs").resize(); }); } function initFunctionality(map) { dojo.connect(map, "onClick", doIdentify); identifyTask = new esri.tasks.IdentifyTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Portland/Portland_ESRI_LandBase_AGO/MapServer"); identifyParams = new esri.tasks.IdentifyParameters(); identifyParams.tolerance = 3; identifyParams.returnGeometry = true; identifyParams.layerIds = [2,3,4]; identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL; identifyParams.width = map.width; identifyParams.height = map.height; map.infoWindow.resize(415, 200); map.infoWindow.setContent(dijit.byId("tabs").domNode); map.infoWindow.setTitle("Identify Results"); symbol = 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.5])); } function doIdentify(evt) { map.graphics.clear(); identifyParams.geometry = evt.mapPoint; identifyParams.mapExtent = map.extent; identifyTask.execute(identifyParams, function(idResults) { addToMap(idResults, evt); }); } function addToMap(idResults, evt) { layer2results = {displayFieldName:null,features:[]}; layer3results = {displayFieldName:null,features:[]}; layer4results = {displayFieldName:null,features:[]}; for (var i=0, il=idResults.length; i<il; i++) { var idResult = idResults; if (idResult.layerId === 2) { if (!layer2results.displayFieldName) {layer2results.displayFieldName = idResult.displayFieldName}; layer2results.features.push(idResult.feature); } else if (idResult.layerId === 3) { if (!layer3results.displayFieldName) {layer3results.displayFieldName = idResult.displayFieldName}; layer3results.features.push(idResult.feature); } else if (idResult.layerId === 4) { if (!layer4results.displayFieldName) {layer4results.displayFieldName = idResult.displayFieldName}; layer4results.features.push(idResult.feature); } } dijit.byId("layer2Tab").setContent(layerTabContent(layer2results,"layer2results")); dijit.byId("layer3Tab").setContent(layerTabContent(layer3results,"layer3results")); dijit.byId("layer4Tab").setContent(layerTabContent(layer4results,"layer4results")); map.infoWindow.show(evt.screenPoint, map.getInfoWindowAnchor(evt.screenPoint)); } function layerTabContent(layerResults, layerName) { var content = ""; switch (layerName) { case "layer2results": content = "<i>Total features returned: " + layerResults.features.length + "</i>"; content += "<table border='1'><tr><th>TLID</th><th>Owner</th><th>Value</th></tr>"; for (var i=0, il=layerResults.features.length; i<il; i++) { content+="<tr><td>"+layerResults.features.attributes['TLID']+" <a href='#' onclick='showFeature(" + layerName + ".features[" + i + "]); return false;'>(show)</a></td>"; content+="<td>"+layerResults.features.attributes['OWNER1']+"</td>"; content+="<td>"+layerResults.features.attributes['TOTALVAL']+"</td>"; } content+="</tr></table>"; break; case "layer3results": content = "<i>Total features returned: " + layerResults.features.length + "</i>"; content += "<table border='1'><tr><th>Building ID</th><th>Area</th></tr>"; for (var i=0, il=layerResults.features.length; i<il; i++) { content+="<tr><td>"+layerResults.features.attributes['OBJECTID_1']+" <a href='#' onclick='showFeature(" + layerName + ".features[" + i + "]); return false;'>(show)</a></td>"; content+="<td>"+layerResults.features.attributes['Shape_Area']+"</td>"; } content+="</tr></table>"; break; case "layer4results": content = "<i>Total features returned: " + layerResults.features.length + "</i>"; content += "<table border='1'><tr><th>ID</th><th>Zone</th><th>Zone Class</th><th>General Class</th></tr>"; for (var i=0, il=layerResults.features.length; i<il; i++) { content+="<tr><td>"+layerResults.features.attributes['OBJECTID']+" <a href='#' onclick='showFeature(" + layerName + ".features[" + i + "]); return false;'>(show)</a></td>"; content+="<td>"+layerResults.features.attributes['ZONE']+"</td>"; content+="<td>"+layerResults.features.attributes['ZONE_CLASS']+"</td>"; content+="<td>"+layerResults.features.attributes['ZONEGEN_CL']+"</td>"; } content+="</tr></table>"; break; } return content; } function showFeature(feature) { map.graphics.clear(); feature.setSymbol(symbol); map.graphics.add(feature); } dojo.addOnLoad(init); </script> </head> <body class="tundra"> Click the map to identify buildings, parcels, and zoning information. <div id="mapDiv" style="width:800px; height:600px; border:1px solid #000;"></div> <!-- info window tabs --> <div id="tabs" dojoType="dijit.layout.TabContainer" style="width:385px;height:150px;"> <div id="layer2Tab" dojoType="dijit.layout.ContentPane" title="Tax Lots"></div> <div id="layer3Tab" dojoType="dijit.layout.ContentPane" title="Buildings"></div> <div id="layer4Tab" dojoType="dijit.layout.ContentPane" title="Zoning"></div> </div> </body> </html>
... View more
06-30-2010
10:14 AM
|
0
|
0
|
237
|
POST
|
I am using the sample Identify Code from the resource center and I modified to use it on my own data. When I try to get feature information from a field that is a number type, the table throws up an undefined instead of showing the value. I am assuming it is because the variable is of the wrong type or I have to make a conversion but I cannot spot the problem. Please Help The below link brings you to the original code http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jssamples/identify_drilldown.html
... View more
06-28-2010
10:56 AM
|
0
|
3
|
462
|
POST
|
Turns out the reason why my code was erroring out was I had a layer with missing source information because I had renamed it (and hidden it in a group layer). The program worked fine until it needed to layerEnum down to a layer below one of the ones with the missing source. It works at it should now.
... View more
04-29-2010
09:27 AM
|
0
|
0
|
486
|
POST
|
Nice Catch, I had clipped the code You are right, I tried the code in another mxd and it works ok. I am going to try to remake the .mxd and see if that helps. Thanks
... View more
04-29-2010
07:46 AM
|
0
|
0
|
486
|
POST
|
I have a program written in Visual Basic through ArcGIS 9.3 which has worked fine for a few years and now suddenly I get an error every time I try to run it. I have not updated my programs in the recent past and the programming language seems sound to me. My other programs seem to work. Can anyone look at this and help me figure out what might be causing a problem. I get Run-Time error '91' Object variable or With Block variable not set. I have posted the code below, the code I have provided is supposed to go through each layer in my .mxd until it finds one with features selected in it. I get an error on the very last line If pSelSet.Count > 0 Then Exit Do and I can't figure it out. Public Sub UpdateData() 'On Error GoTo EH: Dim pMxDoc As IMxDocument Dim pMap As IMap Dim pActiveView As IActiveView Dim pFeatureLayer As IFeatureLayer Dim pEnumLayer As IEnumLayer Dim pLayer As ILayer Dim pFeature As IFeature Set pMxDoc = Application.Document Set pEnumLayer = pMxDoc.FocusMap.Layers Set pLayer = pEnumLayer.Next Dim pFeatureSelection As IFeatureSelection Dim pSelSet As ISelectionSet Dim pID As New UID pID = "esriCore.Editor" Dim pEditor As IEditor Dim pWorkspace As IWorkspace Dim pDataset As IDataset Dim pEnumFeature As IEnumFeature Dim Phasenum As Integer '======================================================== Do Until pLayer Is Nothing If TypeOf pLayer Is IFeatureLayer Then Set pFeatureSelection = pLayer Set pSelSet = pFeatureSelection.SelectionSet If pSelSet.Count > 0 Then Exit Do End If
... View more
04-29-2010
07:15 AM
|
0
|
4
|
1027
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|