|
POST
|
I figured out part of my problem. I did not capitalize my attribute so that it matches the field name - CentroidLongitude vs centroidLongitude. Now I can at least see the value in console.log. Still can't figure out how to add graphic markers to a graphicsLayer using this information.
... View more
04-30-2013
11:11 AM
|
0
|
0
|
929
|
|
POST
|
The documentation for a new graphic states "Creates a new Graphic object. All parameters are required and must be specified in the order given." http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/graphic.html#GraphicConst1 but under the concepts section on graphics there is this statement "Graphics are not required to have all of the above items, and no one item is required. " http://help.arcgis.com/en/webapi/javascript/arcgis/jshelp/inside_graphics.html Is this a discrepancy in the documentation or is there a real difference that I'm not seeing?
... View more
04-30-2013
09:33 AM
|
0
|
1
|
879
|
|
POST
|
Is it possible to add graphic points to the map or graphicsLayer using coordinates stored in the feature? I'm using a query to collect the features I'm interested in. The function addToMap will display those polygons on a the map graphics layer or another graphics Layer (I did that just to test it). I want to add a point marker on top using the coordinates in the feature. The coordinate fields type are double. I haven't been able to retrieve those coordinates even to show them through console.log much less create a graphic point. Various attempts show undefined. function addToMap(featureSet) { //initialize symbology defaultSymbol = new esri.symbol.SimpleMarkerSymbol().setColor(new dojo.Color([255,0,255])); var iconSymbol = new esri.symbol.PictureMarkerSymbol({ "angle":0, "xoffset":0, "yoffset":10, "type":"esriPMS", "url":"http://static.arcgis.com/images/Symbols/Shapes/BluePin1LargeB.png", "contentType":"image/png", "width":24, "height":24 }); var gLayer = new esri.layers.GraphicsLayer(); iTemplate = new esri.InfoTemplate("Sitename", "<tr><td>${Sitename}</tr></td>"); map.addLayer(gLayer); dojo.forEach(featureSet.features,function(feature){ map.graphics.add(feature.setSymbol(defaultSymbol).setInfoTemplate(iTemplate)); //gLayer.add(feature.setSymbol(defaultSymbol).setInfoTemplate(iTemplate)); //var ptX = feature.attributes.centroidLongitude; // returns undefined //var ptX = feature.centroidLongitude; // returns undefined //var ptY = feature.attributes.centroidLatitude; console.log(ptX); gLayer.add(new esri.geometry.Point(ptX,ptY,map.spatialReference).setSymbol(iconSymbol)); });
... View more
04-30-2013
07:58 AM
|
0
|
2
|
1489
|
|
POST
|
I solved it. Works in 3.4 too. I had to use a combination of hide,show and refresh. This post on GIS stack exchange helped get me on track. http://bit.ly/1035f0m. My code refreshes without needing a pan/zoom as this post suggests. I only posted the part of my code that really changed from my original question. The changeLayerVisibility function was deleted. function init() { map = new esri.Map("map", { basemap: "oceans", center: [-98.0, 38.0], zoom: 4, sliderOrientation: "horizontal" }); //set the parameters of the service here. Limit the service to show only a specific layer. var imageParameters = new esri.layers.ImageParameters(); imageParameters.layerIds = [5]; imageParameters.layerOption = esri.layers.ImageParameters.LAYER_OPTION_SHOW; //Takes a URL to a non cached map service. dmslayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer",{"imageParameters":imageParameters}); map.addLayer(dmslayer); dmslayer.hide(); // hide the layer initially } function addMap(dropdown){ //console.log(dropdown); //create the layer definition here var layerDefs = []; layerDefs[5] = "STATE_NAME = '" + dropdown + "'"; dmslayer.setLayerDefinitions(layerDefs); dmslayer.refresh(); dmslayer.show(); }
... View more
03-25-2013
12:55 PM
|
0
|
0
|
698
|
|
POST
|
I need help in interpreting what I am seeing and wondering why I'm seeing duplicate features. I'm using this example: http://help.arcgis.com/en/webapi/javascript/arcgis/jssamples/fl_layer_definition.html "Feature layer with layer definition applied" on my own server and viewing the results after opening the page in Firefox. I modified the tooltip code so I can see the OBJECTID. Your results may be different from what I describe here. I used the tooltip to find the OBJECTID on screen and then expanded the URLs to find the same OBJECTID. I'm specifically looking at the shaded area next to the I-35 sign on the map. When I expand the keys under the URLs in the JSON tab on the NET tab I can see where the featurelayer (fields) is being created (the line starts as GET1?). Then there are 3 more lines that when expanded have a key called "features". The first one has 1 feature (0), the second line has 4 features (0,1,2,3) and the third line has 2 features (0,1). In the second line with 4 features, the 4th feature has an OBJECTID of 5095 and in the third line the 2nd feature has an OBJECTID of 5095. Does that mean that this feature is being downloaded twice? I'm not moving the map around at all. There are also URLs that when expanded do not show any features. They appear to show the same keys as the ones I described above but the features key cannot be expanded. These have a size of 2.6kb. I'm not sure what is happening here. In this example the sizes that are being downloaded are not a big deal. In my own data I have some large features and when I run this example against my own internal data and limit the definition expression to one feature I get six URLs returned. I'm assuming the first two are about the creation of the actual feature layer. The next four seem to be pairs of duplicates. The URLs with a size of 865B have a key called features that appears to be empty. The URLs with a size of 4.2KB have a key called features that is listing the feature I defined. So, I asked myself if in fact it was downloading the feature twice. Am I interpreting these results correctly? [ATTACH=CONFIG]22845[/ATTACH]
... View more
03-21-2013
10:38 AM
|
0
|
1
|
947
|
|
POST
|
I've modified this sample to see if there is a way to change the display of an ArcGISDynamicMapService layer that uses layer definitions. I'm changing the definition through a drop down menu. The previous state boundary does not clear before drawing a new state. I've looked through the forums and the API and tried different ideas. Nothing seems to work. Of course, it could just be that my advanced novice skills are not just advanced enough and I am missing something obvious. 🙂 I know that I could use feature layers but in my own project some of my features are just too big and will actually crash the browser. Using a dynamic service is much faster. I tried to create a jsfiddle instead of posting the code but I could not figure out how to make the drop down menu work. So, I've posted both. http://jsfiddle.net/mapguymike/aThtT/ <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9"> <!--The viewport meta tag is used to improve the presentation and behavior of the samples on iOS devices--> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>Create Map with Custom ArcGISDynamicMapServiceLayer Layer Definitions</title> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/dojo/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/esri/css/esri.css"> <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/"></script> <script> dojo.require("esri.map"); var map, layer, state = 'Iowa'; function init() { map = new esri.Map("map", { basemap: "streets", center: [-98.258, 38.236], zoom: 4 }); } function changeLayerVisibility(){ console.log('inside clv'); var layerIdsArr = map.layerIds; layer = map.getLayer(layerIdsArr["census"]); layer.hide(); } function addMap(state){ var imageParameters = new esri.layers.ImageParameters(); var layerDefs = []; layerDefs[5] = "STATE_NAME='" + state + "'"; imageParameters.layerDefinitions = layerDefs; imageParameters.layerIds = [5]; imageParameters.layerOption = esri.layers.ImageParameters.LAYER_OPTION_SHOW; imageParameters.transparent = true; var dynamicMapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer", {"imageParameters":imageParameters, id:"census"}); map.addLayer(dynamicMapServiceLayer); layer.show(); } dojo.ready(init); </script> </head> <body class="claro"> <div id="map" style="width:900px; height:600px;"></div> <div style="position:absolute;top:10px;right:250px;z-index:999;"> <form><select id="ddbox" onClick="changeLayerVisibility()" onChange="addMap(this.value)" data-dojo-type="dijit.form.Select"> <option value = "" selected="selected">Select...</option> <option value="Oregon" id = "1">Oregon</option> <option value="Colorado" id = "2">Colorado</option> <option value="Iowa" id = "3">Iowa</option> <option value="Alabama" id = "4">Alabama</option> <option value="Maine" id = "5">Maine</option> </select></form> </div> </body> </html>
... View more
03-20-2013
08:55 AM
|
0
|
1
|
3477
|
|
POST
|
I'm still not clear as to whether both parameters should be included or not. The API says that by specifying layerids then only those layers will be identified. It doesn't say anything about whether the layers are visible or not. Whereas the layer_option parameter is about visibility. I discovered that it does help to use both the layerids and layer_option_all. In my particular application I was identifying two featurelayers from one mapservice. An identify operation was only returning the results from one layer even though I specified both layers in identifyParams.layerIds = [3,4] and I knew that it should be picking up a feature from the second layer; When I added identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL; the results from both layers came back. So, the sample from the original posting may be correct, and all that might be needed is a clearer explanation of how these two parameters work together.
... View more
06-08-2012
12:52 PM
|
0
|
0
|
564
|
|
POST
|
After reading all about graphics and graphicLayer I'm still somewhat confused. If I add a layer to a map it displays the map feature (or graphic? Is that the right terminology?). Is the default symbol what is listed in the service properties? If I want to change the color do I create a symbol and add it to a graphicsLayer and then add it to the map? Does this mean that I am essentially drawing on top of the default symbol that draws first? Is it really displaying twice? How would I change the color and add it to the map? var imageParameters = new esri.layers.ImageParameters();
imageParameters.layerIds = [0];
imageParameters.layerOption = esri.layers.ImageParameters.LAYER_OPTION_SHOW;
imageParameters.transparent = true;
var dLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer",{"imageParameters":imageParameters});
map.addLayer(dLayer);
... View more
06-07-2012
11:43 AM
|
0
|
2
|
978
|
|
POST
|
Sounds like a bug/typo in the sample. The default value for layerOption is that only the top-most visible layer is identified. So the sample should probably specify the visible layers and set the layerOption to LAYER_OPTION_VISIBLE instead of all. I'm still not clear as to whether both parameters should be included or not. The API says that by specifying layerids then only those layers will be identified. It doesn't say anything about whether the layers are visible or not. Whereas the layer_option parameter is about visibility.
... View more
05-25-2012
06:24 AM
|
0
|
0
|
564
|
|
POST
|
In the identify sample http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm, the code shows using both specific layerids and the option to use all. It seems like it should be one or the other. identifyParams.layerIds = [0,2];
identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL;
... View more
05-24-2012
05:56 AM
|
0
|
3
|
1050
|
|
POST
|
Yes, I see this message in Chrome all of the time. StackOverflow says that answer requires a server fix. Another user provides a way to hide the messages while you are developing. http://stackoverflow.com/questions/1549967/chrome-warning-about-static-resource-css-gif-png-js
... View more
02-16-2012
10:29 AM
|
0
|
0
|
438
|
|
POST
|
I think I finally have it resolved. You were right that the code I sent you did not work in IE8! I went back a couple of days from there until I found a version that did not throw that error and then worked forward until I found the right combination. Hi Mike, I see "Out of memory at line: 14" when running the files you initially posted in IE8. I'll keep looking, but it seems like this issue was present before I added the additional border container.
... View more
02-13-2012
11:41 AM
|
0
|
0
|
517
|
|
POST
|
It turns out that this fix (testing using your attached files) does not work in IE. It works in Chrome and FF. This is where I'm getting the "Out of Memory at line: 48" error. Try out the attached files. The issue was that your nav toolbar was inside the map div. To fix it, I added an additional border container and put the nav toolbar in its own content pane and the map is another content pane.
... View more
02-13-2012
06:02 AM
|
0
|
0
|
2060
|
|
POST
|
Do you see this in all browsers? Firefox 9.01, 10 - yes; Chrome 17.0.963.46 m - it does draw but it is really slow IE 7,8 - I get a popup with "out of memory at line: 48" (the console shows this as line 48 in the javascript api). This is new. My app usually loads and brings in the interface and the basemap in IE. I had not checked IE for a while so it is possible that something I did the other day is causing this problem.
... View more
02-09-2012
11:31 AM
|
0
|
0
|
1259
|
|
POST
|
Post your code? Is your server endpoint public? I'm hoping to have the endpoint public next week. And, when jsfiddle is back up I will post my code there. Until then I thought you might have another idea I could try.
... View more
02-09-2012
10:59 AM
|
0
|
0
|
1259
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-05-2025 11:56 AM | |
| 1 | 11-27-2024 11:10 AM | |
| 22 | 08-12-2024 11:06 AM | |
| 1 | 02-01-2019 08:27 AM | |
| 2 | 04-23-2024 08:44 AM |
| Online Status |
Offline
|
| Date Last Visited |
10-06-2025
12:09 PM
|