|
POST
|
Yep :). You need to set up an event listener for onZoomEnd. When that event fires, calculate a value for maxAllowableOffset and then pass it to your feature layer's setMaxAllowableOffset method. The feature layer will then update with new geometries that are appropriate for the map's new scale. I have this partially solved. When I can get the feature to display and I zoom in/out for more/less detail my shapes are not jagged anymore (Yea!). However, if the feature is large it won't draw at all and I get a script error Error: timeout exceeded http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.6 Line 14 plus a "script too large" error.
... View more
02-09-2012
10:39 AM
|
0
|
0
|
2748
|
|
POST
|
Thank you very much. I thought an additional container might be needed but I had difficulty understanding how to do it despite the example here.
... View more
02-09-2012
08:55 AM
|
0
|
0
|
2066
|
|
POST
|
You should only need to call reposition() if you've changed the position of the map. You should not need to call it immediately after creating the map. Can you post the html, css and js you're using? Or maybe even a simplified page that shows the problem? I tried to simplify my app as much as possible but it was still too long for this reply window. I have attached the files. You will need to change the extensions on the files. efhm_style.txt to .css and the other one to .html
... View more
02-09-2012
06:28 AM
|
0
|
0
|
2066
|
|
POST
|
I started out with that sample, however, my application uses a bordercontainer and several contentpanes. When I placed the toolbar's DIV outside of the map's DIV strange things happen with the UI. This indicates that the navigation toolbar is pushing the map contents downwards. Try putting the Toolbar's DIV outside of the Map's DIV, as in the example here. Steve
... View more
02-09-2012
03:57 AM
|
0
|
0
|
2066
|
|
POST
|
It makes sense. And, thanks for the link to the demo!
... View more
02-01-2012
09:13 AM
|
0
|
0
|
777
|
|
POST
|
this is what I was doing: var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID,
new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,
new dojo.Color([0,0,0],0.1)),
new dojo.Color([100,149,237,0.15])); Then, after posting the original question, I changed the line style from STYLE_SOLID to NULL var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID,
new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.NULL,
new dojo.Color([0,0,0])),
new dojo.Color([255, 255, 0,0.15])); and the polygon displays with the thin line that I expected to see in the first place. But, it doesn't make sense to me why it works because the API states that NULL means "The line has no symbol".
... View more
02-01-2012
08:34 AM
|
0
|
0
|
777
|
|
POST
|
The API states the width is in pixels. I have tried numbers smaller than 1 (0.5, 0.25, 0.05) and my lines, or outlines to my SimpleFillSymbols are still very wide. Is there another solution? I'm using a featurelayer.
... View more
02-01-2012
08:14 AM
|
0
|
5
|
1765
|
|
POST
|
I have a featureclass with a value (type: text) that contains an apostrophe (ex: Red's Reef). The value is being passed into the query function. When I query for that string nothing happens and I get no error in firebug. Using console log I can see that the value is being passed in properly and I can see that the query.where value is correct too. I can see in ArcMap and the Services directory that including a second apostrophe results in a successful search. I have tried to add a second apostrophe or using escape characters in the original value (it starts out in json text, gets pulled into a drop down menu, and then gets passed on to the query function) but nothing seems to work. The easiest thing for me to do is remove the apostrophe for the field value itself but I'm changing the official spelling of this place and I would rather not do that. I'm curious to know if there is a workaround.
... View more
01-27-2012
07:27 AM
|
1
|
2
|
4441
|
|
POST
|
I have a feature layer that might display a feature that is comprised of 4 (sub-)features. I want to be able to show just one of those graphics by clicking on some text. Actually, I can do that but the map only displays that other feature if I change the extent. Is there another way to refresh the screen by not changing the extent?
... View more
01-20-2012
09:53 AM
|
0
|
8
|
5718
|
|
POST
|
I'm having a hard time understanding how to solve this. Although I'm sure the answer is right in front of me. 🙂
... View more
01-13-2012
10:49 AM
|
0
|
0
|
2748
|
|
POST
|
"When is zoomToEFH_Feature called?" - it is called from a select box on a form. The user chooses an item and it calls this function. I do have maxOffset set as a global variable. I was looking at my code again after your last response and I noticed that I used this twice: var maxOffset = function maxOffset(map, pixelTolerance) {
return Math.floor(map.extent.getWidth() / map.width) * pixelTolerance;
}; once in the init function and once in the zoomtoEFH_Feature function. Is that right? I also noticed that I am not using the setMaxAllowableOffset anywhere. Should I put that inside the zoomtoEFH_Feature function? dojo.connect(efhLayer, "onLoad", function() {
dojo.connect(map, "onZoomEnd", function() {
efhLayer.setMaxAllowableOffset(maxOffset(map,1));
});
});
... View more
01-13-2012
08:44 AM
|
0
|
0
|
2748
|
|
POST
|
[ATTACH=CONFIG]11168[/ATTACH][ATTACH=CONFIG]11169[/ATTACH] Thanks for your help. This is inside my init function: dojo.connect(map, 'onLoad', function (theMap) {
//resize the map when the browser resizes
dojo.connect(dijit.byId('mapDiv'), 'resize', map, map.resize);
var maxOffset = function maxOffset(map, pixelTolerance) {
return Math.floor(map.extent.getWidth() / map.width) * pixelTolerance;
};
}); This is a function that I use to query my feature and then add the graphic(s) to the map: function zoomToEFH_Feature(name) {
//set up maxOffset for performance
var maxOffset = function maxOffset(map, pixelTolerance) {
return Math.floor(map.extent.getWidth() / map.width) * pixelTolerance;
};
//create feature layer
var efhLayer = new esri.layers.FeatureLayer("http://<internal server>/ArcGIS/rest/services/NMFS/EFH_MapperData/MapServer/6", {
maxAllowableOffset: maxOffset(map, 1),
outFields: ["*"],
opacity: 0.75,
id: "efhL"
});
efhLayer.setDefinitionExpression("TYPE='EFH'");
//initialize query
EFH_Fquery = new esri.tasks.Query();
EFH_Fquery.where = "DDBOX = '" + name + "' AND FMC = '" + regionName + "'";
//console.log(EFH_Fquery.where);
//execute query
efhLayer.queryFeatures(EFH_Fquery, function showResults(featureSet) {
//console.log('inside show Results for EFH query');
map.graphics.clear();
var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID).setColor(new dojo.Color([255, 255, 0, 0.5]));
//console.log(featureSet.features.length);
var legendcode = '<table border=0 cellspacing="5" cellpadding="5"><caption>Lifestages</caption>';
//Loop through features in the featureSet and add them to the map.
for (var i = 0, il = featureSet.features.length; i < il; i++) {
//Get the current feature from the featureSet.
//Feature is a graphic
var graphic = featureSet.features;
graphic.setSymbol(symbol);
var featureextent = graphic.geometry.getExtent();
map.setExtent(featureextent, true);
//Add graphic to the map graphics layer.
map.graphics.add(graphic); })
}
... View more
01-13-2012
08:09 AM
|
0
|
0
|
2748
|
|
POST
|
Are the concepts that are presented in the generalize and performance samples under feature layers going to solve the problem of jagged edges at large scales? I have one featurelayer (150 mb featureclass) that displays 1-4 features at a time at most. At large scales I get really jagged edges. The source data, as viewed in ArcMap, is more detailed. I have included the maxAllowableOffset parameter as described in the generalize features sample. This does help with the speed of initially displaying some of the larger features based on what I am seeing in firebug. However, I'm struggling to make sense of the two samples and how I should implement the code in my own application. It seems that the code in the generalize sample might be all I need: var maxOffset = function maxOffset(map, pixelTolerance) { return Math.floor(map.extent.getWidth() / map.width) * pixelTolerance; }; but the performance sample uses a different calculation: function calcOffset() { return (globals.map.extent.getWidth() / globals.map.width); // console.log('extent changed...maxOffset: ', globals.maxOffset); } I'm not sure what to do or whether it will fix this problem.
... View more
01-13-2012
07:35 AM
|
0
|
17
|
5552
|
|
POST
|
The solution was to specify display levels on both of the layers I wanted to use (as the previous user suggested). I also made sure to not use the same level (10) in both layers.
basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer",{displayLevels:[10,11,12,13,14,15,16]});
map.addLayer(basemap); //added this layer so there would be a large number of zoom levels and for overview map
oceanBM = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer",{displayLevels:[0,1,2,3,4,5,6,7,8,9]});
map.addLayer(oceanBM);
... View more
12-20-2011
10:12 AM
|
0
|
0
|
619
|
|
POST
|
I want it the other way around. When the ocean basemap disappears I want the light canvas map to appear.
... View more
12-20-2011
09:08 AM
|
0
|
0
|
619
|
| 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
|