POST
|
Occasionally on loading of my javascript map app I see messages like this in the firebug console: "uncaught-exception: Could not load cross-domain resources: dojox.gfx.svg esri.nls.jsapi_en-us" (the exact resource is not always the same) Nothing seems amiss when the map finishes initializing, and I'm not sure whether I've seen this when running off a server (typical development environment is to have javascript files and index.html on desktop, just map services on servers). Is this innocuous? What does it mean precisely? Screenshot of one example attached. Thanks, Rex Bradford Direct Relief International
... View more
03-27-2013
11:00 AM
|
0
|
0
|
855
|
POST
|
Not sure I quite understand, but I usually set the offset to half the height, so that the bottom of the marker, usually a pointer or flag will be at the actual x/y of the graphic.
var pm_sym = new esri.symbol.PictureMarkerSymbol({
url: "images/stop-sign_alt.png",
height: 26,
width: 24,
yoffset: 26 / 2,
type: "esriPMS"
});
When the marker is scaled, i.e. the width and height passed in to PictureMarkerSymbol is not the same as the source image's width and height, which is being "offsetted"? To achieve the effect above, should I pass in yoffset = half the height being supplied, or half the height of the source png file? Thanks, Rex Bradford Direct Relief International
... View more
03-07-2013
04:40 PM
|
0
|
0
|
611
|
POST
|
Have you looked at this Thread. There is a link to a web site. Looks like he had to load the graphics as transparent features so he can control the mouseover event. Maybe this can help: http://forums.arcgis.com/threads/77010-Cursor-Hover-Style-Over-DynamicMapService I think my problem is a little different. Rather than trying to use a transparent layer to catch mouse events, I want to do the opposite. I want a visible layer which completely ignores the mouse, including hover as well as click. I tried using disableMouseEvents(), but that has two problems: 1. If I click on the layer, the underlying map gets the event with evt.graphic set to undefined, EVEN IF underneath my trying-to-be-invisible-to-the-mouse graphic there is another layer that really should have gotten the event. It seems that disableMouseEvents() throws up its hands and passes off to map, instead of looking at what is under the mouse at that spot. 2. The trying-to-be-invisible-to-the-mouse graphic interferes with mouseover and mouseout events. I have an underlying layer (filled in countries) which changes the cursor when the mouse is inside it, but that layer gets a mouseout when I enter the trying-to-be-invisible-to-mouse-events overlay. An alternative, though unattractive, would be to somehow traverse the layers to see which one really is under the mouse, in effect doing the esri toolkit's job for it. Is this possible even if undesirable? Rex Bradford Direct Relief International
... View more
02-12-2013
05:06 AM
|
0
|
0
|
788
|
POST
|
I have a GraphicsLayer which is used to display a graphic pointer overlay, and I would like it to be completely invisible to the mouse. layer.disableMouseEvents() almost owrks - mouse clicks pass through to underlying layers. But the underlying layers do not get onMouseOver() events, which is what I use to set the cursor, display tooltips, etc. Is there a way to make the Graphics layer completely transparent to mouse movement as well as clicks? Or should it do that already and I am missing something or have a bug? Thank you, Rex Bradford Direct Relief International
... View more
02-11-2013
12:18 PM
|
0
|
6
|
1632
|
POST
|
In case anyone's following this and interested, the "same longitude" thing was a red herring. The real clue was "first time", because i n the real app the first time this zoom happens I also turn on another layer and their markers and other stuff like that. I haven't figured out the details, but delaying that layer creation until the end of the zoom cured the problem. I don't know why only IE9 is unhappy with creating the layer while zooming and not other browsers, but anyhow that's the area where the issue lies. Rex Bradford Mary Ferrell Foundation
... View more
11-07-2012
02:13 PM
|
0
|
0
|
156
|
POST
|
Also if there are any hooks for troubleshooting this kind of thing.... Rex Bradford Direct Relief International
... View more
11-07-2012
12:49 PM
|
0
|
0
|
156
|
POST
|
I have a repeatable bug in an app, where in certain circumstances Internet Explorer 9 fails to map.centerAndZoom properly. Other browsers I've tested (Firefox, Safari, Chrome, Opera) are fine. The condition seems to be when the starting point has essentially the same longitude as the desired destination (doesn't need to be exact). In this scenario, but only the first time (I swear), the map just zooms straight in without adjusting lat or lon. Both the map and the desired destination are Web Mercator spatial refs (wkid: 102100). In other words, the bug is triggered by code kind of like so, where xnew, ynew, and zoomLevel are supplied (and where xnew is not much different from current center x of the map):
var zoomLevel = 4; // or whatever, zooming in in this case
var WMRef = new esri.SpatialReference({wkid: 102100});
var newCenter = new esri.geometry.Point(xnew, ynew, WMRef);
map.centerAndZoom(newCenter, zoomLevel);
in IE9 and no other browser, first execution will just zoom straight in with no panning at all. I do not have an isolated 1-page for this, no. If I put the line:
xnew += 1000000"
before the code above, then the zoomcenter works (though zoomcenters to the wrong spot of course), because the longitude is apparently different enough to cure the bug. Anybody seen this? Rex Bradford Direct Relief International
... View more
11-07-2012
12:32 PM
|
0
|
2
|
558
|
POST
|
It seems like the default behavior when mouse panning is enabled is that you must click without even moving the cursor a pixel in order to invoke an onClick; the slightest movement begins a pan operation. This can make it frustrating for people who don't have very precise control over their hand when clicking. Is there a setting which would allow the mouse to move N pixels between press and release and still be considered a click and not start of pan? Or am I missing something else altogether in the pan behavior? Thanks, Rex Bradford Direct Relief International
... View more
10-03-2012
10:48 AM
|
1
|
1
|
999
|
POST
|
when working with featurelayers using a definition expression gives you the ability to separate features based on SQL expressions and working in selection mode allows you to query for individual features spatially and only draw specific items. i still don't know if i understand exactly what your workflow is, but i think either one or the other of these techniques would be the most straightforward way to go. I see, thanks, that seems reasonable. Although the reason I am using a Feature Layer with UniqueValueRenderer in mode esri.layers.FeatureLayer.MODE_SNAPSHOT, is that then the 360K worth of outline data (for this dataset) only gets downloaded once in the browser at map startup. I presume that if I do what you're suggesting, I will get new web traffic each time. Admittedly it would presumably only download the needed outlines, but still the network traffic is another factor here that I am balancing. The same map may have other modes where I want to turn on all countries and color-code them, and if so the single-startup-download is desirable. Rex Bradford Direct Relief International
... View more
08-30-2012
12:35 PM
|
0
|
0
|
323
|
POST
|
have you considered creating a separate GraphicsLayer for your selected features instead of attempting to maintain invisible symbology? No. Are you suggesting that I keep my country outline data layer invisible, or even just get the data and not make a layer at all, and then copy features to a separate GraphicsLayer when needed (and delete them when not needed)? And does your answer imply that indeed there isn't a straightforward way to "turn off" individual elements in my current feature layer? What about hiding all of the graphic items in my feature layer and then showing those which I want to be visible? I didn't try that, would that solve the svg performance issue? Thanks, Rex Bradford Direct Relief International
... View more
08-30-2012
11:48 AM
|
0
|
0
|
323
|
POST
|
I am developing an app which displays shaded country boundaries for selected countries. Most of the time, all of the country boundaries are turned off. I am using a UniqueValueRenderer to then "turn on" one or a few selected countries and display them shaded with an outline. My default "empty" symbol is currently:
var outlineNull = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_NULL, '#000000', 0);
mapLayerCountries.defSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_NULL, outlineNull, '#000000');
This works, but is currently non-optimal. Looking at the svg in Firebug, I see that each invisible country still has its huge outline, in svg code that looks like this:
<path fill="none" fill-opacity="0" stroke="none" stroke-opacity="0" stroke-width="1"
stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="4"
path="M 195,333 195,333 195,333 195,333 195,333 195,334 195,333 195,333 195,334 196,334 196,333
196,333 196,333 196,333 197,333 197,333 197,333 197,333 197,334 195,334 195,334 195,334 195,334
194,334 192,334 192,334 192,334 192,334 191,335 191,335 190,335 190,335 190,335 190,335 189,335
188,336 188,336 188,336 188,336 187,336 .......
How do I make a truly NULL default symbol which results in no svg being generated for the countries which are not selected? I have tried using undefined for the symbol but the toolkit complains "sym is undefined". Thank you, Rex Bradford Direct Relief International
... View more
08-30-2012
05:50 AM
|
0
|
5
|
882
|
POST
|
I looked into this a bit more and using setRenderer() doesn't cause the features to re-draw. Calling refresh() does the job, but as you noted it re-qureies the service. In cases where you're using 10.0 or 10.1, this shouldn't be a concern because the server should return a 304 in 100 or so milliseconds. If your server isn't quickly returning 304s, you could use centerAt and pass in the map's current center so that the map doesn't actually move but it does re-draw the features with the new renderer:
map.centerAt(map.extent.getCenter());
Working example using this workaround: http://jsfiddle.net/FePUD/ Thanks very much - this workaround works like a charm and is basically instantaneous (avoids the server roundtrip). Rex Bradford Direct Relief International
... View more
05-29-2012
12:46 PM
|
0
|
0
|
362
|
POST
|
Class breaks or unique value doesn't make a difference. Once you've modified your renderer, apply it to your feature layer using setRenderer (and comment out your call to refresh()). Please let us know if that works. Hmm, nope, it doesn't send out any sort of query nor refresh the countries visually.
// Go thru all countries, computing the color for each and changing its symbol
for (var ic = 0; ic < mapLayers.countryCodeList.length; ic++) {
var ccode = mapLayers.countryCodeList[ic];
var csym = csymNoData;
var val = mapData.currDataView.cntryVals[ccode];
var index = _getRangeIndexForData(val);
if (index >= 0)
csym = options.cranges[index].csym;
// console.log("cntry: " + ccode + " val: " + cntryVals[ccode] + " color: " + csym.r + "," + csym.g + "," + csym.b);
mapLayers.countrySymbols[ccode] = new esri.symbol.SimpleFillSymbol().setColor(csym);
mapLayers.renderer.removeValue(ccode);
mapLayers.renderer.addValue({value: ccode, symbol: mapLayers.countrySymbols[ccode],
label: "Label: " + ccode, description: "Description: " + ccode});
}
mapLayers.countryLayer.setRenderer(mapLayers.renderer);
// mapLayers.countryLayer.refresh();
... View more
05-25-2012
04:28 AM
|
0
|
0
|
362
|
POST
|
Are you using countryLayer.setRenderer() to update your symbology? Also, you should be seeing http 304s and very small response sizes when your feature layer fetches a URL more than once. Are you not seeing 304s? I am using a UniqueValueRenderer, which I'm not sure is the right thing here (as opposed to a class breaks renderer)
mapLayers.renderer = new esri.renderer.UniqueValueRenderer(defSymbol, "ISO_2DIGIT");
.....
mapLayers.countrySymbols[ccode] = defSymbol;
mapLayers.renderer.addValue({value: ccode, symbol: mapLayers.countrySymbols[ccode],
label: "Label: " + ccode, description: "Description: " + ccode});
.....
countryLayer.setRenderer(mapLayers.renderer);
And then to update I am creating new symbols (as needed, I reuse symbols across the country feature graphics), and assigning them with removeValue() and addValue(), one per country:
mapLayers.renderer.removeValue(ccode);
mapLayers.renderer.addValue({value: ccode, symbol: mapLayers.countrySymbols[ccode],
label: "Label: " + ccode, description: "Description: " + ccode});
But nothing changes onscreen until I do a refresh(), which shows up in Firebug as a full 200 OK weighing in at 310.6K every time in my case. If it's relevant, I have a longish definition expression, to get just the few dozen countries I want.
dojo.io.script.jsonp_dojoIoScript_Countries_generalized_boundaries_10._jsonpCallback({"displayFieldName":"CNTRY_NAME","fieldAliases":{"OBJECTID":"OBJECTID","FIPS_CNTRY":"FIPS_CNTRY","GMI_CNTRY":"GMI_CNTRY","ISO_2DIGIT":"ISO_2DIGIT","ISO_3DIGIT":"ISO_3DIGIT","ISO_NUM":"ISO_NUM","CNTRY_NAME":"CNTRY_NAME","LONG_NAME":"LONG_NAME","ISOSHRTNAM":"ISOSHRTNAM","UNSHRTNAM":"UNSHRTNAM","LOCSHRTNAM":"LOCSHRTNAM","LOCLNGNAM":"LOCLNGNAM","STATUS":"STATUS","POP2007":"POP2007","SQKM":"SQKM","SQMI":"SQMI","LAND_SQKM":"LAND_SQKM","COLORMAP":"COLORMAP","Shape_Length":"Shape_Length","Shape_Area":"Shape_Area"},"geometryType":"esriGeometryPolygon","spatialReference":{"wkid":102100},"fields":[{"name":"OBJECTID","type":"esriFieldTypeOID","alias":"OBJECTID"},{"name":"FIPS_CNTRY","type":"esriFieldTypeString","alias":"FIPS_CNTRY","length":2},{"name":"GMI_CNTRY","type":"esriFieldTypeString","alias":"GMI_CNTRY","length":3},{"name":"ISO_2DIGIT","type":"esriFieldTypeString","alias":"ISO_2DIGIT","length":2},{"name":"ISO_3DIGIT","type":"esriFieldTypeString","alias":"ISO_3DIGIT","length":3},{"name":"ISO_NUM","type":"esriFieldTypeInteger","alias":"ISO_NUM"},{"name":"CNTRY_NAME","type":"esriFieldTypeString","alias":"CNTRY_NAME","length":40},{"name":"LONG_NAME","type":"esriFieldTypeString","alias":"LONG_NAME","length":40},{"name":"ISOSHRTNAM","type":"esriFieldTypeString","alias":"ISOSHRTNAM","length":45},{"name":"UNSHRTNAM","type":"esriFieldTypeString","alias":"UNSHRTNAM","length":55},{"name":"LOCSHRTNAM","type":"esriFieldTypeString","alias":"LOCSHRTNAM","length":43},{"name":"LOCLNGNAM","type":"esriFieldTypeString","alias":"LOCLNGNAM","length":74},{"name":"STATUS","type":"esriFieldTypeString","alias":"STATUS","length":60},{"name":"POP2007","type":"esriFieldTypeDouble","alias":"POP2007"},{"name":"SQKM","type":"esriFieldTypeDouble","alias":"SQKM"},{"name":"SQMI","type":"esriFieldTypeDouble","alias":"SQMI"},{"name":"LAND_SQKM","type":"esriFieldTypeInteger","alias":"LAND_SQKM"},{"name":"COLORMAP","type":"esriFieldTypeInteger","alias":"COLORMAP"},{"name":"Shape_Length","type":"esriFieldTypeDouble","alias":"Shape_Length"},{"name":"Shape_Area","type":"esriFieldTypeDouble","alias":"Shape_Area"}],"features":[{"attributes":{"OBJECTID":45,"FIPS_CNTRY":"HA","GMI_CNTRY":"HTI","ISO_2DIGIT":"HT","ISO_3DIGIT":"HTI","ISO_NUM":332,"CNTRY_NAME":"Haiti","LONG_NAME":"Republic of Haiti","ISOSHRTNAM":"Haiti","UNSHRTNAM":"Haiti","LOCSHRTNAM":"Haiti","LOCLNGNAM":"Republique d'Haiti","STATUS":"UN Member State","POP2007":8706497,"SQKM":27949.040000000001,"SQMI":10791.120000000001,"LAND_SQKM":27560,"COLORMAP":1,"Shape_Length":1588233.8414093608,"Shape_Area":30535891711.168987},"geometry":{"rings":[[[-8138691.4058999997,2228889.4081000015],[-8143052.1421000008,2227346.691300001],[-8166800.5819000006,2228429.5656000003],[-8168223.4750999995,2228560.7611999996],[-8171701.7705000006,2229758.7012999989],[-8174006.0781999994,2231285.5639999993],[-8176108.8989000004,2233223.0943000019],[-8176882.1333000008,2234109.7089000009],[-8178118.7673000004,2236079.8148999996],[-8177746.4166999999,2239890.4375],[-8177515.6500000004,2241421.2894000001],[-8172861.5009000003,2251686.2349000014],[-8171423.4733000007,2253117.0102999993],[-8169707.0177999996,2253330.0311000012],[-8166151.9309,2253461.2608999982],[-8164728.0485999994,2253198.7824000008],[-8162967.1977999993,2253790.4800999984],[-8158421.3593000006,2255565.7047999986],[-8156813.2332000006,2256322.1193999983],[-8147567.7117999997,2261516.6174000017],[-8143546.9486999996,2263818.8687000014],[-8130065.1437999997,2262668.2435000017],[-8124653.0252999999,2262898.5216999985],[-8114851.9170999993,2264015.8933000006],[-8109037.9069999997,2265167.6732000001],[-8106008.0074000005,2266089.1838999987],[-8103873.6676000003,2266252.8614000008],[-8102328.4677000009,2266187.1123000011],[-8091258.1801999994,2263588.5791999996],[-8089990.1391000003,2263161.254999999],[-8079506.9760999996,2259344.7490999997],[-8075116.8482000008,2254743.6314000003],[-8069889.9625000004,2251785.1594000012],[-8050348.2651000004,2244949.2298000008],[-8038010.0671999995,2246313.8137999997],[-8037831.9442999996,2242847.0227999985],[-8036216.8202,2242124.5170000009],[-8025856.9715999998,2240186.0751999989],[-8021466.9930000007,2239989.2802999988],[-8012869.9920000006,2240317.2135000005],[-7994842.3673,2238936.8476000018],[-7987638.9985000007,2238214.4714000002],[-7986957.9513000008,2237426.6327],[-7985674.6451999992,2235883.0824000016],[-7985288.1492999997,2235060.7963000014],[-7985536.0658,2232172.0879999995],[-7985814.3629999999,2228921.6827000007],[-7985503.6696000006,2226919.1374999993],[-7984545.3142000008,2223998.1931999996],[-7984081.7654999997,2222882.2571999989],[-7983587.9666000009,2221766.3865999989],[-7982473.7699999996,2219732.1966999993],[-7982103.4162000008,2218550.9468999989],[-7980711.9300999995,2213695.683699999],[-7980681.5307,2212219.5797999986],[-7981345.4466999993,2202429.8465999998],[-7984236.6175999995,2197366.2901999988],[-7986587.4668000005,2188616.4857000001],[-7983340.0688000005,2185308.1530000009],[-7981175.3296000008,2183408.7291000001],[-7980248.3813000005,2182688.3081],[-7978515.8024000004,2181901.7043000013],[-7977186.0855,2181541.5086000003],[-7973724.0628999993,2180821.3150999993],[-7973738.1896000002,2178938.3376000002],[-7974326.1910999995,2173946.3467999995],[-7974914.1740000006,2171065.6356000006],[-7976536.4453999996,2169003.6919],[-7987173.4528999999,2157257.5456999987],[-7990235.7300000004,2149753.1471999995],[-7983471.6502,2140608.7206999995],[-7982566.8343000002,2130259.4646000005],[-7982627.6143999994,2129084.7065000013],[-7983370.3189000003,2125491.3227000013],[-7984406.7347999997,2121850.5126999989],[-7985194.9729999993,2120528.8786000013],[-7985690.8992999997,2120267.135400001],[-7987854.5000999998,2120136.8068999983],[-7988966.6998999994,2119745.6689000018],[-7989987.8322000001,2119190.1530999988],[-7991596.8354000002,2116644.3407000005],[-7995369.5701000001,2111292.2038999982],[-7996266.2496000007,2110541.4360999987],[-7998677.8789000008,2109855.8957000002],[-8004058.6276999991,2108909.7298000008],[-8005232.466,2109415.8687999994],[-8006578.4370000008,2111104.2533],[-8011726.5342999995,2110736.9235999994],[-8012747.5360000003,2110182.5645999983],[-8015344.4167999998,2107995.6638999991],[-8014663.3695999999,2107017.6506999992],[-8009345.3044000007,2101700.0179000013],[-8003562.6827000007,2095308.2358999997],[-8002372.5715999994,2093473.8691000007],[-8004645.6215000004,2090989.0848000012],[-
etc. etc. etc. - goes on for a long time
... View more
05-24-2012
02:18 PM
|
0
|
0
|
362
|
POST
|
I have a layer of country polygons that I am color-coding based on dynamic metrics. My problem is not one of functionality but performance - the country polygons are requeried every time I want to change the color-coding symbols (fill color) associated with them. The layer is created with code like this:
var countryLayer = new esri.layers.FeatureLayer(urltools.fixServerURL(layerInfo.url), {
id: layerID,
mode: esri.layers.FeatureLayer.MODE_ONDEMAND, // neither ONDEMAND nor SNAPSHOT works as I'd like
// mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,
opacity: 0.75,
outFields: ["*"] });
When I want to update the map to change the color-coding of countries, after some computation I assign new symbols with code like this:
// Go thru all countries, computing the color for each and changing its symbol
for (var ic = 0; ic < mapLayers.countryCodeList.length; ic++) {
var ccode = mapLayers.countryCodeList[ic];
var csym = csymNoData;
var val = mapData.currDataView.cntryVals[ccode]
var index = _getRangeIndexForData(val);
if (index >= 0)
csym = options.cranges[index].csym;
// console.log("cntry: " + ccode + " val: " + cntryVals[ccode] + " color: " + csym.r + "," + csym.g + "," + csym.b);
mapLayers.countrySymbols[ccode] = new esri.symbol.SimpleFillSymbol().setColor(csym);
mapLayers.renderer.removeValue(ccode);
mapLayers.renderer.addValue({value: ccode, symbol: mapLayers.countrySymbols[ccode],
label: "Label: " + ccode, description: "Description: " + ccode});
}
Nothing is updated unless I call refresh(), but that causes a refetch over the internet tubing:
mapLayers.countryLayer.refresh();
Is there a way for me to dynamically update the country colors without continually refetching the same unchanging boundary data? Thanks, Rex Bradford Direct Relief International
... View more
05-24-2012
01:46 PM
|
0
|
6
|
622
|
Title | Kudos | Posted |
---|---|---|
1 | 10-03-2012 10:48 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|