POST
|
Our customer wants to use their own basemap, which has different wkid with esri's default wkid. To createmap, API allows to pass following valid options: "streets" , "satellite" , "hybrid", "topo", "gray", "oceans", "national-geographic", "osm" to the parameter "basemap", according to API reference. What I am doing is, temperately use "topo" as basemap when creating map, then use BasemapGallery.select(id) to switch to customer's basemap. However, since customer's basemap and esri's topo basemap wkid are different, I am hitting error Map: Geometry (wkid: 102100) cannot be converted to spatial reference of the map (wkid: 3417) . Is there a anyway to workaround? Thanks for your help! Tony
... View more
12-02-2013
09:48 AM
|
0
|
4
|
1796
|
POST
|
It's my code issue. I have some code ruined domNode of legend. The code is supposed to run after startup of legend, but it get run before that because of the timer I set for IE8. Thanks for visiting. Tony
... View more
08-23-2013
12:27 PM
|
0
|
0
|
200
|
POST
|
When doing Legend.startup() in IE8, I am hitting an error on following function in widget.js of 3.5 API createLegend: function() { var _695 = false; _672.set(this.domNode, "position", "relative"); ...... } The problem is, this.domNode is null in IE8. Chrome works fine, and this.domNode suppose to be "<div id="legendDiv" widgetid="legendDiv"></div>" This div is the container of the Legend, I created it dynamically using jquery, right before creating legend. var legendCp = new dijit.layout.ContentPane({ title: GISViewer.i18n.tools.legend.title, selected: true, region: 'center', id: "legendPanel" }); dijit.byId('stackContainer').addChild(legendCp); dojo.addClass(dojo.byId('legendPanel'), 'panel_content'); $('#legendPanel').append('<div id="legendDiv" widgetid="legendDiv"></div>'); var legendDijit = new esri.dijit.Legend({ map: GISViewer.map, layerInfos: layerInfo }, 'legendDiv'); if (dojo.isIE === 8 || dojo.isIE === 9) { setTimeout(function () { legendDijit.startup(); }, 500); } else { legendDijit.startup(); } Please help on this. Thanks, Tony
... View more
08-23-2013
07:50 AM
|
0
|
1
|
454
|
POST
|
If you know all the layers you need to select, you may try assign a queryTask for each layer , and after you get the polygon to select features, try" var queryTask1 = new QueryTask(serviceurl1);
var queryTask2 = new QueryTask(serviceurl2);
var queryTask3 = new QueryTask(serviceurl3);
...
queryTaskList = [queryTask1, queryTask2,queryTask3...];
var query = new Query();
query.spatialRelationship = Query.SPATIAL_REL_CONTAINS;
query.geometry = area.geometry;
var queryTaskToDoList = dojo.map(queryTaskList, function(item, index){
return item.execute(query)
}):
var listOfSelectedFeatures = [];
all(queryTaskToDoList).then(function(featureSetList) { //this function returns a list of feature sets from all queryTask executions.
dojo.forEach(featureSetList, function(featureSet) {
listOfSelectedFeatures.push(featureSet);
});
}); Thanks for your solution. Your solution is doing query against service directly which would introduce client server communication. What I am trying to do is querying feature layer using existed client side data. I will try your solution when there comes a need. Thanks again. Tony
... View more
08-21-2013
10:13 AM
|
0
|
0
|
644
|
POST
|
Try: var query = new esri.tasks.Query();
query.geometry = area.geometry;
var listOfSelectedFeatures = [];
for (var j = 0; j < map.graphicsLayerIds.length; j++) {
var currentLayer = map.getLayer(map.graphicsLayerIds );
if (currentLayer.declaredClass === "esri.layers.FeatureLayer") {
currentLayer.selectFeatures(query, currentLayer.SELECTION_NEW, function (featureSet) {
listOfSelectedFeatures.concat(featureSet.features);
});
}
} Please be noted that 1. The above code only deals with feature layers. Pure graphics layers should be filtered out since graphics layer has no selectFeatures method. 2. listOfSelectedFeatures may contain features in mixed spatial types. Thanks for your reminder. The two points you mentioned does make sense to me. The key to fix my problem is, the returned parameter "featureSet" for callback function of selectFeatures method. Things got much easier after knowing there is a featureSet returned by selectFeatures. Here is the updated code, which is working.
var listOfSelectedFeatures = [];
$.each(areas, function (ind, area) {
var query = new esri.tasks.Query();
query.geometry = area.geometry;
for (var j = 0; j < GISViewer.map.graphicsLayerIds.length; j++) {
var currentLayer = GISViewer.map.getLayer(GISViewer.map.graphicsLayerIds );
if (currentLayer.visible) {
if (currentLayer.declaredClass === "esri.layers.FeatureLayer") {
currentLayer.selectFeatures(query, currentLayer.SELECTION_NEW, function (featureSet) {
listOfSelectedFeatures.push.apply(listOfSelectedFeatures, featureSet);
});
}
}
}
});
... View more
08-21-2013
10:09 AM
|
0
|
0
|
644
|
POST
|
I am trying to get all features on multiple feature layers inside of a polygon. I was doing polygon.contains(), it works great for point type feature layer, but not for polyline type or polygon type feature layer. Then I was directed to implement this in different way, which is doing query on feature layer, by setting query.geomotry = polygon.geometry. It works fine for single layer, but when it comes to multiple layers, I have trouble to get correct result. What I am getting, is always the selected features for last layer. Does it clear the selectFeatures result from previous layer every time run for next layer? I did try SELECTION_ADD mode, which is not working either. Here is the code var query = new esri.tasks.Query(); query.geometry = area.geometry; var counter = 0; var listOfSelectedFeatures; for (var j = 0; j < map.graphicsLayerIds.length; j++) { var currentLayer = map.getLayer(map.graphicsLayerIds ); currentLayer.selectFeatures(query, currentLayer.SELECTION_NEW, function () { counter++; if (counter == (map.graphicsLayerIds.length - 1)) { for (var k = 0; k < map.graphicsLayerIds.length; k++) { var layer = map.getLayer(map.graphicsLayerIds ); if (listOfSelectedFeatures == undefined) { listOfSelectedFeatures = layer.getSelectedFeatures(); } else { listOfSelectedFeatures.concat(layer.getSelectedFeatures()); } } } }); } Thanks, Tony
... View more
08-20-2013
11:13 AM
|
1
|
5
|
2243
|
POST
|
I want to calculate the number of features in feature layer in current extent at the time everything is loaded. Is there a event I can capture? I tried following events, all of them get fired BEFORE layer graphics of current extent get loaded. That results in incorrect number of features. Map: onLayersAddResult onZoomEnd onPanEnd Layer: update-end Thanks, Tony
... View more
08-01-2013
12:21 PM
|
0
|
2
|
554
|
POST
|
I have nailed down the issue. It is related to Legend widget. For some reason, if I have some feature layers included, the code of legend widget throw exception when zoom in/out, which causes map broken. After debug it through I got the following details of stacktrace. When click zoom button, it runs "onZoomEnd" eventhandler inside of esri API. Then it jumps between var _5d7 = _5d6.advice.apply(this, args); and return _43e[_43f].apply(_43e, arguments || []); a couple of times. After that, if feature layer A is included, it then runs "_refreshLayers" which will eventually hit the null reference exception as shown in above post; if feature layer A is NOT included, it bypass "_refreshLayers", and everything works fine. "_refreshLayers" function is inside of esri's widgets.js, as follows: "esri/dijit/Legend": function() {
_refreshLayers: function() {
this.refresh();
}
} My question is, what is the condition "_refreshLayers" function in Legend widget get hit when clicking zoom button? From my side, Feature Layer A is just a regular layer, nothing odd. It is loaded correctly in legend when legend widget gets initialized. Thanks, Tony
... View more
07-25-2013
12:57 PM
|
0
|
0
|
233
|
POST
|
Here is compressed ESRI code. The code in red is where throw exception. Please give me some idea of it. Thanks, Tony _3ce.place = function place(node, _3dc, _3dd) {
_3dc = dom.byId(_3dc);
if (typeof node == "string") {
node = /^\s*</.test(node) ? _3ce.toDom(node, _3dc.ownerDocument) : dom.byId(node);
}
if (typeof _3dd == "number") {
var cn = _3dc.childNodes;
if (!cn.length || cn.length <= _3dd) {
_3dc.appendChild(node);
} else {
_3d5(node, cn[_3dd < 0 ? 0 : _3dd]);
}
} else {
switch (_3dd) {
case "before":
_3d5(node, _3dc);
break;
case "after":
_3d7(node, _3dc);
break;
case "replace":
_3dc.parentNode.replaceChild(node, _3dc);
break;
case "only":
_3ce.empty(_3dc);
_3dc.appendChild(node);
break;
case "first":
if (_3dc.firstChild) {
_3d5(node, _3dc.firstChild);
break;
}
default:
_3dc.appendChild(node);
}
}
return node;
};
... View more
07-25-2013
11:20 AM
|
0
|
0
|
233
|
POST
|
I am having a weird zoom issue on my map. Whenever I click zoom in/out button, I am seeing following error in development tool. And map zoom is out of control with the click. [INDENT]Empty string passed to getElementById() exception in animation handler for: onEnd (new TypeError("_3dc is null", "http://serverapi.arcgisonline.com/jsapi/arcgis/3.5", line 15, column 97887))[/INDENT] Any help would be appreciated. Btw, anyone can tell me what is function of column 97887, line 15 of http://serverapi.arcgisonline.com/jsapi/arcgis/3.5? I am not able to read this script since it is minified. I see this error message in IE 8 at the time of initializing my map app. I really want to know what value of "_3dc" is expected. Thanks, Tony
... View more
07-25-2013
10:58 AM
|
0
|
2
|
2276
|
POST
|
esri/geometry/Extent::contains take a point or extent. Per the docs: https://developers.arcgis.com/en/javascript/jsapi/extent.html#contains You could use the extent of your line but not the line itself. Thanks for your information. I do try the following area._extent.contains(graphic.geometry._extent). The area's extent is xmin: -9788742, ymin: 5311210, xmax: -9788670, ymax: 5311361 The graphic is a polyline, it's extent is xmin: -9788713, ymin: 5311291, xmax: -9788712, ymax: 5311317 The result is still FALSE. not sure why Thanks, Tony
... View more
06-27-2013
11:10 AM
|
0
|
0
|
519
|
POST
|
The IDs 102100 and 3857 both represent the same spatial reference: WGS84 Web Mercator (Auxiliary Sphere), so it would seem unlikely that the cause of the issue is due to a spatial reference system mismatch. The polygon geometry (xmin -9789042, xmax -9788311, ymin 5311122, ymax 5311413) The polyline geometry (xmin -9788713, xmax -9788712, ymin 5311291, ymax 5311317) It seems to me polyline is inside of polygon, am I missing somthing? Thanks, Tony
... View more
06-25-2013
01:18 PM
|
0
|
0
|
519
|
POST
|
I have a case one big polygon includes a polyline, but the code extent.contains(geometry) returns false. I checked Xmin, Xmax, Ymin, Ymax for both object. polyline is inside of the polygon. I do notice that the polygon's Spatial Reference wkid is 102100, the polyline has two SR, wkid 102100 and latestwkid 3857. Does extent.contains(geometry) check the SR? If so, what should I do for the case? Thanks, Tony
... View more
06-25-2013
11:16 AM
|
0
|
5
|
1838
|
POST
|
One option is to define a function that will generate your popup content using setContent. Then you can use the graphic.getLayer method to retrieve the graphics layer name. Here's an example that shows how this works: http://jsfiddle.net/AddHT/ Thank you! This is the solution I am using. I do use a customized function with graphic parameter in setContent. Actually what I need is graphic.getLayer().name.
... View more
06-05-2013
11:03 AM
|
0
|
0
|
716
|
POST
|
I did integrate identity manager in our app. Without using https in our app, I have no problem to GET https for the ArcGIS online authentication token in both IE10 and Chrome. I do have problem in IE 9-. It seems that I have to setup proxy page to do so in IE9-. I guess the reason proxy page is not needed in IE10 and latest Chrome, is because they support CROS. But I have no idea why the demo requires to access itself through https even use IE 10 though. It may be related to app server setting. Thanks, Tony
... View more
06-05-2013
10:36 AM
|
0
|
0
|
279
|
Title | Kudos | Posted |
---|---|---|
1 | 08-20-2013 11:13 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|