POST
|
Tried something similar, but the extent would be wrong if I didn't wait for the "update-end" event. Otherwise it would zoom to part of the shapes and leave others off the screen.
... View more
08-15-2017
05:46 AM
|
0
|
1
|
617
|
POST
|
Okay. Have an example? Didn't think you could get to sub layers within a ArcGISDynamicMapServiceLayer as a featureLayer to do a queryExtent.
... View more
08-14-2017
02:10 PM
|
0
|
1
|
617
|
POST
|
Okay figured this out. no way to do it directly with a ArcGISDynamicMapServiceLayer, so you need to create a temporary FeatureLayer and get the extent of it after applying the same definition expression that was applied to the ArcGISDynamicMapServiceLayer. Sorry about the formatting. When you cut and paste it strips the tabs. function WDsetDefinitionExpressionDone(results) { if (results.error) { alert("Error occured getting WD trade area. "+results.error.message); console.log("results.error",results.error); } else { try { // Hide layer while we calc renderer and re-display wdLayer.hide(); // Zoom to the layers objects var filterDefinition = wdLayer.layerDefinitions[1]; var tempLayer = new esri.layers.FeatureLayer( "https://mktserv5.goodyear.com:6443/arcgis/rest/services/MarketAnalysis/MarketAnalysis_WD_TradeAreas/MapServer/1", { id: "Temp Feature Layer" ,outFields: ["*"] } ); var queryObject = new query(); queryObject.where = filterDefinition; tempLayer.queryExtent(queryObject,function(response) { // queryExtent worked. var extent = response.extent; if (extent) { extent.expand(2.0); map.setExtent(extent).then(function (response) { // Color code the layer var promise = smartMapping.createClassedColorRenderer({ layer: tempLayer ,field: "MARKETANALYSIS.WD_SUBGEO_SALES.WD_NET_PURCHASES_UNITS" ,showOthers: true ,basemap: map.getBasemap() ,classificationMethod: "natural-breaks" ,numClasses: 6 }).then(function (response) { // Color coding completed now display it var layerDrawingOptions = []; var layerDrawingOption1 = new esri.layers.LayerDrawingOptions(); layerDrawingOption1.renderer = response.renderer; layerDrawingOptions[1] = layerDrawingOption1; wdLayer.setLayerDrawingOptions(layerDrawingOptions,true); // Have to toggle layer on and off to make sure colors always display. wdLayer.hide(); wdLayer.show(); },function (error) { console.log("WD Coloring Error",error); alert("WD Coloring Error: "+error); }); }); } else { console.log("Error getting extent of trade area from tempLayer",tempLayer); alert("Error getting extent of trade area"); } }, function(error){ // Error querying extent console.log("tempLayer.queryExtent error",error); alert("tempLayer.queryExtent error"); }); // // Setup fuction to run after filter is applied // dojo.on.once(tempLayer, "update-end", zoomTempLayer); // // Apply the filter // tempLayer.setDefinitionExpression(filterDefinition); } catch ($err) { console.log("Error color coding WD Trade Area", $err); alert("Error color coding WD Trade Area: $err"); } } } // wdLayer.setDefinitionExpression("WKUNNR='" + wkunnr + "'") var definitions = []; definitions[1] = "WKUNNR='" + wkunnr + "'"; wdLayer.setLayerDefinitions(definitions); dojo.on.once(wdLayer, "update-end", WDsetDefinitionExpressionDone); // "update-end" won't happen unless layer is displayed. map.addLayer(wdLayer);
... View more
08-14-2017
01:46 PM
|
0
|
3
|
617
|
POST
|
ArcGIS Server is 10.5.1. queryExtent I believe is only available with a FeatureLayer, not a ArcGISDynamicMapServiceLayer. Hence why I'm asking the question about how to do it with a ArcGISDynamicMapServiceLayer.
... View more
08-14-2017
10:47 AM
|
0
|
1
|
617
|
POST
|
After doing a setLayerDefinitions on a ArcGISDynamicMapServiceLayer layer. How do I zoom to results?
... View more
08-13-2017
12:50 PM
|
0
|
9
|
1612
|
POST
|
Okay figured this out layer.layerInfos[0].name="New Legend Label"; will change inner layer 0's legend label to "New Legend Label".
... View more
08-07-2017
06:30 PM
|
1
|
0
|
434
|
POST
|
Okay you are right. It works for esriFieldTypeInteger, and esriFieldTypeString, but not esriFieldTypeDouble columns. Any idea on how to get esriFieldTypeDouble to work?
... View more
08-07-2017
03:03 PM
|
0
|
1
|
836
|
POST
|
See my note before your last response. Think we posted at about the same time. Any ideas on the issue with numeric columns as label? Thanks so much for your help by the way.
... View more
08-07-2017
01:36 PM
|
0
|
3
|
836
|
POST
|
Okay made some progress. had to go back to the MDX and turn off the labels. Otherwise they overrode anything I tried to set as the label. Issue now is that I can only set the labels to a text column. Nothing shows up if the column is numeric.
... View more
08-07-2017
12:35 PM
|
0
|
0
|
836
|
POST
|
It is set to true for the layer. Any other ideas? I'm running out.
... View more
08-07-2017
12:25 PM
|
0
|
6
|
836
|
POST
|
Okay I modeled your example in my app, but my service on the ArcGIS Enterprise server crashes if I have the line drawingOptions.labelingInfo = [labelClass]; Error: Error exporting map Code: 500 if I change it to drawingOptions.labelingInfo = labelClass; The code executes without an error, but the labels are not changed. I also tried var labelClasses = []; labelClasses[geoLayerNumber] = labelClass; layerDrawingOption.labelingInfo = labelClasses; without success. Is there something that needs to be turned on in the layer in the MDX or on the ArcGIS server side to make labels work?
... View more
08-07-2017
10:33 AM
|
0
|
8
|
836
|
POST
|
I have a ArcGISDynamicMapServiceLayer layer that has a layer within it I am applying a createClassedColorRenderer to which is working great. I want to change the name/title that appears in the legend after I apply the renderer. So by default it appears as "State" as is defined in the MDX. I want to change it to something like "State by Market Share" after I apply the renderer. I can find examples of doing this to a feature layer, but not a layer within a ArcGISDynamicMapServiceLayer. Any hints would be appreciated.
... View more
08-07-2017
06:23 AM
|
0
|
1
|
998
|
POST
|
Trying to change the field used for a label in a lay with in a ArcGISDynamicMapServiceLayer layer. Here's what I tried. var json = { "labelPlacement":"esriServerPolygonPlacementAlwaysHorizontal" ,"where":null ,"labelExpression":"[States.NAME]" ,"useCodedValues":true ,"symbol":{ "type":"esriTS" ,"color":[0,0,0,255] ,"backgroundColor":null ,"borderLineColor":null ,"borderLineSize":null ,"verticalAlignment":"bottom" ,"horizontalAlignment":"left" ,"rightToLeft":false ,"angle":0 ,"xoffset":0 ,"yoffset":0 ,"kerning":true ,"haloColor":null ,"haloSize":null ,"font":{ "family":"Arial" ,"size": 8 ,"style":"normal" ,"weight":"normal" ,"decoration":"none" } } ,"minScale":0 ,"maxScale":0 }; // create instance of LabelClass var labelClass = new LabelClass(json); console.log("labelClass",labelClass); var layerDrawingOptions = []; var layerDrawingOption = new esri.layers.LayerDrawingOptions(); var renderer = response.renderer; layerDrawingOption.renderer = renderer; layerDrawingOption.showLabels = true; layerDrawingOption.labelingInfo = labelClass; // Sets the opacity (transparency) of the layer. // Values range from 0.0 to 1.0, where 0.0 is 100% transparent and 1.0 has no transparency. layerDrawingOption.transparency = transparency; console.log("layerDrawingOption",layerDrawingOption); layerDrawingOptions[1] = layerDrawingOption; geoLayer.setLayerDrawingOptions(layerDrawingOptions); Any ideas would be appreciated.
... View more
08-04-2017
04:09 PM
|
0
|
10
|
1786
|
POST
|
Is there a script that will dump the field names along with the field alias. I'm looking to get something like the following dumped for a data set. Field, Alias TOTPOP_CY, 2015 Total Population HHPOP_CY, 2015 Population in Households
... View more
09-14-2016
01:28 PM
|
1
|
4
|
6231
|
POST
|
Note the points will be in a ArcGIS server layer. The shape will be a drive time pulled form ArcGIS on-line as a local layer.
... View more
08-29-2016
07:18 AM
|
0
|
0
|
236
|
Title | Kudos | Posted |
---|---|---|
1 | 09-14-2016 01:28 PM | |
1 | 08-07-2017 06:30 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|