|
POST
|
Hi Hzhu, My problem is in posted code for only polygon feature featureset will be retrieved. For Line and point feature featureset will be always empty. How can i get those feature's objectID "onDrawEnd". Please help me. // The query is done, now we'll take the query results to do the data linking function geometryQuery_Complete(featureSet) { alert(featureSet.features.length);//Its showing length = 0 } Thanks in advance, Sowmya I think i know your problem now. you draw a point and then use that point to do a spatial query against the layer. Since you do not specify the query's spatialRelationship. The default is always SPATIAL_REL_INTERSECTS. So when you do a spatial query against a point or polyline layer, you would not get any results unless your query point touchs a point or line feature. My suggestion would be to specify the spatialRelationship to something other than SPATIAL_REL_INTERSECTS when you do query on point or polyline layer. Please let me know if you understand what i am saying or not.
... View more
03-09-2011
04:39 AM
|
0
|
0
|
1584
|
|
POST
|
Hi Hzhu, My problem is in posted code for only polygon feature featureset will be retrieved. For Line and point feature featureset will be always empty. How can i get those feature's objectID "onDrawEnd". Please help me. // The query is done, now we'll take the query results to do the data linking function geometryQuery_Complete(featureSet) { alert(featureSet.features.length);//Its showing length = 0 } Thanks in advance, Sowmya Put alert into your function runGeometryQuery(geometry) to see if the returned geometry is a point or polyline. something like: function runGeometryQuery(geometry) { alert (geometry.type); } and then go from there to see if you get anything in your featureset...
... View more
03-08-2011
03:53 AM
|
0
|
0
|
1584
|
|
POST
|
Dear All, Its a very urgent issue. I am not able get feature on querying on point and line feature. Featureset length will be 0.I am giving my code here.Please help me.. function createToolbar(map) { // Create the ESRI drawing toolbar toolbar = new esri.toolbars.Draw(map); dojo.connect(toolbar, "onDrawEnd", runGeometryQuery); } var lyrind; function runGeometryQuery(geometry) { var query = new esri.tasks.Query(); query.returnGeometry = true; if (typeof (geometry) == "object") { query.geometry = geometry; } lyrind= document.getElementById("hidLayerIndex").value; query.outFields = ["*"]; var queryTask = new esri.tasks.QueryTask(servicename+lyrind); // Perform the query, and call the data linking routine with // the results once the query executes successfully. dojo.connect(queryTask, "onComplete", geometryQuery_Complete); queryTask.execute(query); } // The query is done, now we'll take the query results to do the data linking function geometryQuery_Complete(featureSet) { alert(featureSet.features.length);//Its showing length = 0 if ((featureSet != null) && (featureSet.features.length > 0)) { // If there is at least one result var resultSymbol; var feature = featureSet.features[0]; if(lyrind=="0" ){ resultSymbol= new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 10, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0]), 1), new dojo.Color([0,255,0,0.25])); alert('in0'); } else if(lyrind=="1" || lyrind=="8"){ resultSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0, 0, 255, .8]), 2), new dojo.Color([100, 100, 255, 0.8])); alert('in1or8'); } else { resultSymbol=new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH, new dojo.Color([255,0,0]), 3); alert('inelse'); } // add the selection highlight feature.setSymbol(resultSymbol); // display the graphics for the selected feature map.graphics.add(feature); } var code,disp; if(lyrind=="0" || lyrind=="1" ||lyrind=="3") { code="FEATURECD"; disp ="OBJECTID"; } else if(lyrind=="8" ) { code="FEATURECODE"; disp ="SURVEY_NO"; } var ddlVillage_ProjWiseBudget = document.getElementById("ddlVillage_ProjWiseBudget"); var context = 'SurveyNoSelection'; var argument = 'ControlType=SurveyNoSelection'; argument += '&SURVEY_NO=' + featureSet.features[0].attributes[disp]; argument += '&FEATURECODE=' + featureSet.features[0].attributes ;
eval(Planning_CallBack);
} Theorically, typeof (geometry) should definitely return a string "object". However, typeof null produces 'object' instead of 'null'. That means, in your case, if geometry== null, your statement: if (typeof (geometry) == "object") will be true. So you end up assign query.geometry = null; My suggestion is to use geometry.type to varify instead of typeof or just get rid of if (typeof (geometry) == "object")....
... View more
03-07-2011
04:36 AM
|
0
|
0
|
1584
|
|
POST
|
Thanks for your reply. The data is shared by several apps so I can't do that. I've got something working along these lines: dojo.connect(map, "onZoomEnd", addAerialLayer);
var hasAerialLayer = false;
function addAerialLayer() {
if (map.getLevel() > 8 && !hasAerialLayer){
map.addLayer(aerialLayer, 1);
hasAerialLayer = true;
} else if (map.getLevel() < 9 && hasAerialLayer){
map.removeLayer(aerialLayer);
hasAerialLayer = false;
}
} map's lods property specify the visible scale range for the map, not the individual layers in the map services. You might have to use layerInfos to loop through your aerialLayer service and use setVisibleLayers to set visibility of specific layer in your service. Obviously i assumed that your aeiallayer service is a dynamic map service because cann't use setVisibleLayers for tiled map services.
... View more
03-04-2011
05:43 AM
|
0
|
0
|
669
|
|
POST
|
Hi, my mapservice has two layers and I want each to display at different extents. I can see that I can specify this in the map constructor: var lods = [
{"level" : 1, "resolution" : 0.010986328125, "scale" : 4617149.97766929},
{"level" : 2, "resolution" : 0.0054931640625, "scale" : 2308574.98883465}
];
map = new esri.Map("map", { extent: startExtent, lods: lods }); I think I've got the wrong end of the stick here though -- that sets the lods for the map, right? How do I say which layer should be shown at a certain lod? Thanks in advance, Why just set scale range for each layer in your .mxd(.msd)? It's much easy and no code is needed.
... View more
03-04-2011
04:11 AM
|
0
|
0
|
669
|
|
POST
|
I notice in the latest version of the API you can use the function esri.geometry.getExtentForScale and then set the map extent to change scale. Is there any way to do this in 1.6? If there is any method to set the map extent based on a given scale number then please let me know. Regards, Mark 1.6 has the same method. http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jsapi/namespace_geometry.htm
... View more
03-02-2011
09:01 AM
|
0
|
0
|
432
|
|
POST
|
Only the newest version of Opera shows the issue. It seems that Opera doesn't like the ticks. If setting tick as 0 in esri.config.defaults.map.sliderLabel, it works fine. Of course, that would lose the ticks. Please add the following code to the init() function: if (dojo.isOpera) { esri.config.defaults.map.sliderLabel = {labels:null,style:"width:2em; font-family:Verdana; font-size:75%;",tick:0}; } Hope this helps. It works althrough without ticks. By the way, I have tested my apps on IE, Firefox, Google chrome, Navigator, Sfari and Opera. Overall it is very impressive. Thanks.
... View more
03-01-2011
04:01 AM
|
0
|
0
|
567
|
|
POST
|
I am testing my app on Opera 11.0.1 and everything works OK except the scale Slider don't display properly. I used one of the sample apps to test and got the same result. Any idea?
... View more
02-28-2011
11:12 AM
|
0
|
3
|
928
|
|
POST
|
Take out this optional function function(err) from your code and try again. Believe it or not sometime this function do harm that it do good. Just a follow up for what i was saying. I found out that sometimes onComplete and onError both fired up if you put both in execute method. if i put them seperately using dojo.connect, it works just fine. I could not figure out why.
... View more
02-25-2011
04:21 AM
|
0
|
0
|
929
|
|
POST
|
When I try to identify a feature, the IdentifyTask's execute function is invoking an error that simply contains the message "Unable to complete operation." The strange thing is, this identify function works as it should when I use it at either the map's full extent or a specific extent of a feature (when I zoom to a feature via the results in a Datagrid), but once I pan the map even slightly out of that specific extent, the IdentifyTask throws that error. My code is listed in the following. It's a loose interpretation of the "Identify features on a map" sample provided by ArcGIS. doIdentify = function(evt) {
// Hide the previous results
myMap.infoWindow.hide();
var task = null;
var params = null;
task = new esri.tasks.IdentifyTask(url.baseMap);
params = new esri.tasks.IdentifyParameters();
params.tolerance = 4;
params.returnGeometry = true;
params.layerIds = [3, 4, 5, 6];
params.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL;
params.width = myMap.width;
params.height = myMap.height;
params.geometry = evt.mapPoint;
params.mapExtent = myMap.extent;
task.execute(params, function(idResults) {
identifyInfoWin(idResults, evt);
}, function(err) {
console.log("doIdentify: (" + err.name + ") " + err.message);
});
}; I consider myself well-acquainted with the ArcGIS JS API, but I have been staring at this problem for much too long without seeking help. Thanks in advance Take out this optional function function(err) from your code and try again. Believe it or not sometime this function do harm that it do good.
... View more
02-25-2011
04:11 AM
|
0
|
0
|
929
|
|
POST
|
Hi, Thanks for the response 🙂 I am getting set of polygon feature for querytask. One of the key field i need to display on polygon as label. I can create label for clicked point on map. How to label polygon? Thanks, Sowmya here is the link that might help you: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/geometryservice.htm#labelPoints
... View more
02-25-2011
04:00 AM
|
0
|
0
|
829
|
|
POST
|
Hi there, I have a custom web application (JSAPI) consuming a web service from ArcGIS Server 10. In that service there are some polygon layers with a transparency value set > 0% (i.e. semi-transparent). However, when that service is published in the application, the layers are shown at 0% transparency (i.e. opaque). I have published the same service in a web application built from the ArcGIS Server Manager, and the transparency is honored. Can someone explain how to replicate that behavior in my own application? Thanks! Richard. You can use setOpacity method (in its supper class: Layer to set up the transparency. However. This method applies for the whole layer. you might have to find a workaround to achieve your goal.
... View more
02-24-2011
04:12 AM
|
0
|
0
|
1063
|
|
POST
|
Hi, I'm running an IdentifyTask on the following layer: http://207.114.175.57/ArcGIS/rest/services/Lake_Region_Greenprint_Map/MapServer/2 When I get the results back from the identify, I find that all of the fields that are esriFieldTypeSingle return rounded values. For example, if a value is .4023 in the attribute table, the IdentifyTask returns 0. If I run a QueryTask on the same layer, the values are not rounded. The fields that are type esriFieldTypeDouble are not rounded in the IdentifyTask results, so it seems the issue is with the field type. I've asked the people who generated the parcel layer to make sure that all fields are set to type esriFieldTypeDouble. They've responded that the table is generated from a number of different sources (including several joins to dbf tables) and that ArcGIS seems to be choosing type single for them when they do the joins. Can anyone suggest how to resolve this? Is there a way to prevent the IdentifyTask from rounding the values? Thanks, Jennifer I think this is a very good question. You might be able to format the returned field value, but i don't think you have control on field value itself. It might be an system bug. I will be very interested to know the answer.
... View more
02-23-2011
12:24 PM
|
0
|
0
|
1051
|
|
POST
|
I have made some progress with this but I don't know how to diable the custom graphics onclick handlers. Here is the onClick handler I added to map: function afterClick(evt) {
console.log('afterclick');
console.log(evt.mapPoint);
var p = evt.mapPoint;
var green = new esri.symbol.SimpleMarkerSymbol().setColor(
new dojo.Color([0, 255, 0]));
var red = new esri.symbol.SimpleMarkerSymbol().setColor(
new dojo.Color([255, 0, 0]));
//make a map extent around the mapclick point
var dx, dy;
dx = dy = 10;
var extent = new esri.geometry.Extent(p.x - dx, p.y - dy, p.x + dx, p.y + dy, p.spatialReference);
var graphics = map.graphics.graphics;
var results = [];
var graphic;
for (var i=0, il=graphics.length; i<il; i++) {
graphic = graphics;
//if point is contained within extent, highlight it and add for display in results list
if (extent.contains(graphic.geometry)) {
graphic.setSymbol(red);
results.push(graphic.attributes);
}
//else if point was previously highlighted, reset its symbology
else if (graphic.symbol == red) {
graphic.setSymbol(green);
}
}
//if reults.length == 1, show the infoWindow for that graphic. If > 1, show an infoWindow offering a choice of the results.
console.log(results);
}
When I click on the map avoiding the points, the afterClick function is called. If I click on a point, the infoWindow for that point is shown, and afterClick is never called. How do I remove the onclick handler for the graphics? Thanks! Since the map.graphics layer in always on top, the onclick event on graphics are fired first. to avoid that, you might have to use map.graphics.disableMouseEvents() to disable onclick for graphics, and after your afterClick is fired, enable onclick event on graphics using map.graphics.enableMouseEvents() to enable onclick.
... View more
02-23-2011
08:12 AM
|
0
|
0
|
1143
|
|
POST
|
Hi, I am running a query to select a number of polygons based on an intersecting polygon. The selected polygons are contiguous and are highlighted when the query is complete. I am trying to set the map extent to the extent of all these polygons combined together but have been unsuccessful. I have tried suggestions posted on these forums and using samples provided by ESRI but am still unable to get the map to zoom to this area. I have tried creating an array to push graphics inside it. I have also tried creating a polygon feature, a feature set and a graphicsLayer as a container to hold all the selected graphics, but it didn't work. I am using ArcGIS Server 9.3 with JavaScript API. Please help. (Note: The code below has been extracted from a longer version. It might be missing some braces) function findPolygonsInExtent(extent) { var graphics = map.graphics.graphics; var attr =[]; var items = []; var graphic; var len=0; var intersectedGraphics =[]; for (var i=0, il=graphics.length; i<il; i++) { graphic = graphics; if (extent.intersects(graphic.geometry)) { intersectedGraphics.push(graphic); len = len + 1; var results = []; graphic.setSymbol(highlightSymbol); var featureAttributes = graphic.attributes; for (att in featureAttributes) { var s = featureAttributes[att]; results.push(s); } attr = results.slice(0,10); for(var j=0, jl=10; j<jl; j++) { items.push(attr ); } } //if else if (graphic.symbol == highlightSymbol) { graphic.setSymbol(symbol); } } //for var extent =esri.graphicsExtent(intersectedGraphics); map.setExtent(extent); } function findPolygonsInExtent(extent) { var graphics = map.graphics.graphics; var attr =[]; var items = []; var graphic; var len=0; var intersectedGraphics =[]; for (var i=0, il=graphics.length; i<il; i++) { graphic = graphics; if (extent.intersects(graphic.geometry)) { intersectedGraphics.push(graphic); len = len + 1; var results = []; graphic.setSymbol(highlightSymbol); var featureAttributes = graphic.attributes; for (att in featureAttributes) { var s = featureAttributes[att]; results.push(s); } attr = results.slice(0,10); for(var j=0, jl=10; j<jl; j++) { items.push(attr ); } } //if else if (graphic.symbol == highlightSymbol) { graphic.setSymbol(symbol); } } //for var extent =esri.graphicsExtent(intersectedGraphics); map.setExtent(extent); }
... View more
02-23-2011
06:42 AM
|
0
|
0
|
2113
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 04-11-2011 12:16 PM | |
| 1 | 05-25-2017 08:26 AM | |
| 1 | 06-02-2017 07:37 AM | |
| 1 | 06-28-2011 07:02 AM | |
| 1 | 06-12-2017 10:10 AM |
| Online Status |
Offline
|
| Date Last Visited |
10-01-2024
09:57 PM
|