|
POST
|
hzhu, Thank you for your continued help. Can you let me know what you mean by "set up your schema AOI polygon feature class" Do you mean in the ExtractDataTask model? Or in the Javascript code, something like: var clipFeatureSet = new esri.tasks.FeatureSet();
clipFeatureSet.setSpatialReference(27700) Thank you, Ben I mean in your ExtractData model. Modify your AOI parameter ->Data Type -> Import schema and symbology from:. The polygon feature class (your schema) should have SR as 27700. What happen is that even though you draw or add a AOI on the web map and your mxd (both has WKID 10200), its internal SR is still 27700 so that your AOI and cliped layer are in the same SR-27700.
... View more
05-09-2011
12:33 PM
|
0
|
0
|
2431
|
|
POST
|
Hi there, I am trying to replicate the Clip and Ship Geoprocessing sample using my own data and I am having trouble getting the data to export. I am getting a zip file exported and downloaded but the shapefile is empty although the .DBF does have the column names. My data is held in Oracle in British National Grid (SRID 27700) and the map uses web mercator (102100). I am setting the geoprocessing output spatial refernce but this does not seem to affect anything. gp = new esri.tasks.Geoprocessor("http://maps.lynxinfo.co.uk:8080/LIVE/services/UKOGL/UKOGLTools/GPServer/Extract%20Data%20Task");
gp.setOutSpatialReference({wkid:27700}); Does anyone have any idea what I need to do to fix this? if you set up your schema AOI polygon feature class to wkid 27700 and your mxd (that contains the gp layer and your clip layers) data frame to wkid 102100. you should be good to go.
... View more
05-09-2011
07:51 AM
|
0
|
0
|
2431
|
|
POST
|
Thanks for the help. I got this working and hooked it up to a query function to get the result to show on a map. But I don't think I'm sending the value from the OnChange event to the query correctly. The code below is the closest I've come. (I actually don't care about the datagrid part of the code, I just want the result to show on the map, but if you look at the results in the datagrid you'll see that the value from the dropdown isn't being passed correctly. Can you tell me how I should pass the variable? ______________________________________________ ... //create find task with url to map service findTask = new esri.tasks.FindTask("http://dingo.gapanalysisprogram.com/ArcGIS/rest/services/PADUS/PADUS_status/MapServer"); //create find parameters and define known values findParams = new esri.tasks.FindParameters(); findParams.returnGeometry = true; findParams.layerIds = [0]; //these need to be exact field names findParams.searchFields = ["P_Des_Nm", "Category", "Own_Name","Mang_Name"]; //findParams.searchFields = ["P_Des_Nm"]; findParams.outSpatialReference = map.spatialReference; var queryTask = new esri.tasks.QueryTask("http://dingo.gapanalysisprogram.com/ArcGIS/rest/services/PADUS/PADUS_status/MapServer/0"); dojo.connect(queryTask, "onComplete", initLineID); var query = new esri.tasks.Query(); query.outFields = ["P_Des_Nm", "OBJECTID","State_Nm", "Category", "Mang_Name" ]; //query.text = "011"; query.where = "OBJECTID >=0"; query.returnGeometry = false; queryTask.execute(query); //resize the map when the browser resizes - view the 'Resizing and repositioning the map' section in //the following help topic for more details http://help.esri.com/EN/webapi/javascript/arcgis/help/jshelp_start.htm#jshelp/inside_guidelines.htm var resizeTimer; dojo.connect(map, 'onLoad', function(theMap){ dojo.connect(dijit.byId('map'), 'resize', function(){ //resize the map if the div is resized clearTimeout(resizeTimer); resizeTimer = setTimeout(function(){ map.resize(); map.reposition(); }, 500); }); }); } //+++++++++++++ filtering select functions ++++++++++++++++++++++// function initLineID(features) { var lineIdObjects = []; dojo.forEach(features.features, function(feature) { lineIdObjects.push({ "name": feature.attributes.P_Des_Nm, "paId":feature.attributes.OBJECTID }); }); var data = { //"identifier": "OBJECTID", // identifier needs to be unique, results returned from the server are not unique so omit this property "items": lineIdObjects }; //bind the data object to the datastore var lineDataStore = new dojo.data.ItemFileReadStore({ data: data }); //bind the data store to the FilteringSelect component dijit.byId("lineid").store = lineDataStore; } function execute(searchText) { //set the search text to find parameters findParams.searchText = searchText; findTask.execute(findParams, showResults); } function showResults(results) { map.graphics.clear(); //symbology for graphics var markerSymbol = 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])); var lineSymbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH, new dojo.Color([255, 0, 0]), 1); var polygonSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_NONE, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASHDOT, new dojo.Color([255, 0, 0]), 2), new dojo.Color([255, 255, 0, 0.25])); var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([98,194,204]), 2), new dojo.Color([98,194,204,0.5])); //find results return an array of findResult. var dataForGrid = []; //all items to be stored in data store //Build an array of attribute information and add each found graphic to the map //dojo.forEach(results, function(result) { for (var i=0, il=results.length; i<il; i++) { dataForGrid.push(results.feature.attributes); //append each attribute list as item in store var graphic = results.feature; graphic.setSymbol(symbol); map.graphics.add(graphic); } var data = { identifier: "OBJECTID", //This field needs to have unique values label: "OBJECTID", //Name field for display. Not pertinent to a grid but may be used elsewhere. items: dataForGrid }; var store = new dojo.data.ItemFileReadStore({ data: data }); grid.setStore(store); grid.setQuery({ OBJECTID: '*' }); //Zoom back to the initial map extent map.setExtent(initExtent); } //Zoom to the parcel when the user clicks a row function onRowClickHandler(evt){ // var currentGraphic = map.graphics.graphics; var clickedareaId = grid.getItem(evt.rowIndex).OBJECTID; var selectedArea; /* for (var i=0, il=map.graphics.graphics.length; i<il; i++) { var currentGraphic = map.graphics.graphics; if ((currentGraphic.attributes) && currentGraphic.attributes.PARCELID == clickedTaxLotId){ selectedTaxLot = currentGraphic; break; } }*/ dojo.forEach(map.graphics.graphics,function(graphic){ if((graphic.attributes) && graphic.attributes.OBJECTID === clickedareaId){ selectedArea = graphic; return; } }); var areaExtent = selectedArea.geometry.getExtent(); map.setExtent(areaExtent); } dojo.addOnLoad(init); </script> </head> <body class="claro"> <div dojotype="dijit.layout.BorderContainer" style="width:100%;height:100%;margin:0" design="headline" gutters="true "> <div class="details" dojotype="dijit.layout.BorderContainer" region="top" style="height: 130px;"> Find Protected Area: <input dojoType="dijit.form.FilteringSelect" id="lineid" searchAttr="name" name="widgetName" onChange="execute(dijit.byId('lineid').value);"></div> <div id="map" dojotype="dijit.layout.ContentPane" region="center" style="border:1px solid #000;"></div> <br /> <div dojotype="dijit.layout.ContentPane" region="left" style="width:300px;"> <!--Refer to field by the position id, since the data doesn't have field names--> <table dojotype="dojox.grid.DataGrid" jsid="grid" id="grid" > <thead> <tr> <th field="OBJECTID">OBJECTID</th> <th field="Primary Designation Name">Name</th> <th field="Primary Designation Type">Park type</th> <th field="GIS Acres">Acres</th> </tr> </thead> </table> </div> </div> </body> </html> If you set identifier: "OBJECTID", then your "dijit.byId('lineid').value" statement will return objectid value. Is the OBJECTID value your find task is searching for? if not, you might have to change your onchange event to onChange="execute(dijit.byId('lineid').getDisplayedValue()); Your data object should look like (so your searchtext would be your P_Des_Nm field): var data = { identifier: "paId", label: "name", //Name field for display. "items": lineIdObjects };
... View more
05-09-2011
06:08 AM
|
0
|
0
|
2074
|
|
POST
|
I'm trying to build some logic which will switch layers on/off based on feature count (rather than scale thresholds). After each map extent change, I'm running queryTask.executeForCount to see how many features are present in the new view extent. This works correctly, but causes a problem when the user changes extent many times in quick succession. See the sample below for an example. Open FireBug and pan/zoom the map, and note that the number of features in the current map extent is listed in the Console tab. Now hit the zoom-in button about 10 times in rapid succession. I'm seeing time-out error messages. Is this a limitation of the queryTask, which presumably batches all of the jobs to run asynchronously? Any ideas on how to resolve the problem? Thanks, Steve
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<!--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>FeatureLayer with count</title>
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.2/js/dojo/dijit/themes/claro/claro.css">
<style>
html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
</style>
<script type="text/javascript">djConfig = { parseOnLoad:true };</script>
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.2"></script>
<script type="text/javascript">
dojo.require("esri.map");
dojo.require("esri.layers.FeatureLayer");
dojo.require("dijit.form.Button");
dojo.require("dijit.Dialog");
var query;
var queryTask;
function init() {
var extent = new esri.geometry.Extent({"xmin":-96.6063,"ymin":38.3106,"xmax":-96.4764,
"ymax":38.3689,"spatialReference":{"wkid":4269}});
var map = new esri.Map("map", { extent: esri.geometry.geographicToWebMercator(extent)});
veTileLayer = new esri.virtualearth.VETiledLayer({
bingMapsKey: 'AmtpLvkTJh3qNOm_vTV4DIXQ0ucCWYI0hrcO4wARRegSC79rstkDrYghY70pjoxY',
mapStyle: esri.virtualearth.VETiledLayer.MAP_STYLE_ROAD
});
map.addLayer(veTileLayer);
var content = "<b>Type</b>: ${ftype}" + "<br /><b>Code</b>: ${fcode}";
var infoTemplate = new esri.InfoTemplate("Rivers", content);
featureLayer = new esri.layers.FeatureLayer("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Hydrography/Watershed173811/FeatureServer/1",{
mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
outFields: ["*"],
infoTemplate: infoTemplate
});
map.addLayer(featureLayer);
dojo.connect(map, "onExtentChange", afterExtentChange);
query = new esri.tasks.Query();
}
function afterExtentChange(extent){
//Count the SLAs
query.geometry = extent;
query.maxAllowableOffset = 100000;
queryTask = new esri.tasks.QueryTask("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Hydrography/Watershed173811/FeatureServer/1");
queryTask.executeForCount(query,function(count){
console.log(count);
},function(error){
console.log(error);
});
}
dojo.addOnLoad(init);
</script>
</head>
<body class="claro">
<div style="position:relative;width:100%;height:100%;">
<div id="map" style="border:1px solid #000;width:100%;height:100%;">
</div>
</div>
</body>
</html>
There are scenarios that you will get such messages. One example: suppose you set up 4 pooled instances for your map services, and the maximum time a client will wait to get a service is 60 seconds (default). When 4 pooled instances are being used, the next query request has to wait until one instance are free for use. So chance is increasing that waiting time for one or more query request will exceed 60 seconds when so many panning (request) are going on... Besides, request timeout via JS API itself is set up 60 second as default... Other consideration would be network traffic or SDE etc. So you have to weigh in these factors to either adjust your settings or change a code logic..
... View more
05-06-2011
05:44 AM
|
0
|
0
|
872
|
|
POST
|
Hello, I'm trying to build a measuring toolbar that allows the user to measure a distance or an area by using the freehand tool. Currently, there is a button with a dynamically-created menu and the properties are being set inside an array before being created. Everything works fine except for one part: When the user selects and uses the "Measure by distance" tool initially, and then uses the "Measure by area" tool, you cannot go back to using the distance tool. However, if you select and use the "Measure by area" tool first, you cannot use the distance tool, the drawing shape is still a polygon. How would I clear the session so the two tools won't get intertwined? This is my first attempt at building an application and using javascript, so sorry for any dumb questions. Code is below: measureTools = [{label:"Measure an area",
onClick: dojo.hitch(function(){
dijit.byId("measureButton").set("label","Measure an area");
tb = new esri.toolbars.Draw(map);
dojo.connect(tb, "onDrawEnd", getAreaAndLength)
map.graphics.clear();
//tb.deactivate();
tb.activate(esri.toolbars.Draw.FREEHAND_POLYGON);
})},
{label: "Measure a distance",
onClick: dojo.hitch(function(){
dijit.byId("measureButton").set("label","Measure a distance");
tb = new esri.toolbars.Draw(map);
lengthParams = new esri.tasks.LengthsParameters();
dojo.connect(tb, "onDrawEnd", function(geometry) {
map.graphics.clear();
lengthParams.polylines = [geometry];
lengthParams.lengthUnit = esri.tasks.GeometryService.UNIT_METER;
lengthParams.geodesic = true;
geometryService.lengths(lengthParams);
var graphic = map.graphics.add(new esri.Graphic(geometry, new esri.symbol.SimpleLineSymbol()));
})
//tb.deactivate();
tb.activate(esri.toolbars.Draw.FREEHAND_POLYLINE);
})}]; Thanks, Andrew I think a better solution would be to use a delegate to handle onDrawEnd event. I would do like this: var tb, btnMeasure, measureMode; function init() { ....... tb = new esri.toolbars.Draw(map); btnMeasure =dijit.byId("measureButton"); dojo.connect(tb, "onDrawEnd", getMeasurement); ...... measureTools = [{label:"Measure an area", onClick: dojo.hitch(function(){ tb.deactivate(); //deactivate the previous draw measureMode ="Area"; // reset the measure mode dijit.byId("measureButton").set("label","Measure an area"); tb.activate(esri.toolbars.Draw.FREEHAND_POLYGON); //reactive with freehand })}, {label: "Measure a distance", onClick: dojo.hitch(function(){ tb.deactivate(); //deactivate the previous draw measureMode ="Length"; // reset the measure mode dijit.byId("measureButton").set("label","Measure a distance"); tb.activate(esri.toolbars.Draw.FREEHAND_POLYLINE); })}]; ........... } function getMeasurement(geometry) { map.graphics.clear(); switch (measureMode) // or use geometry.type { case "Area": //measure area goes here // whatever your getAreaAndLength code ...... break; case "Length": var lengthParams = new esri.tasks.LengthsParameters(); lengthParams.polylines = [geometry]; lengthParams.lengthUnit = esri.tasks.GeometryService.UNIT_METER; lengthParams.geodesic = true; geometryService.lengths(lengthParams); var graphic = map.graphics.add(new esri.Graphic(geometry, new esri.symbol.SimpleLineSymbol())); break; } } ....
... View more
05-05-2011
11:27 AM
|
0
|
0
|
572
|
|
POST
|
Hi, We are creating an application using the compact version and a cached background service, and in some cases we would like to cancel the "zoom in" event. If the user has turned on a certain layer, it should be possible to zoom in a few more levels than if this layer is not on. I have looked at dojo stopEvent and jQuery event.preventDefault, but in the map.onZoomStart event there is no event object available to cancel. We are limiting the zoom levels using the lod property when creating the map. But it doesn't seem to be a good way of changing the lods in "run time". Today we are checking the zoom level in the "onZoomEnd" event, and then setting a different level if the user is zoomed in too far. But thats not very elegant (extra traffic, and the map popping out looks strange). Any ideas? If you use navigation tool, you can use esri.toolbars.Navigation.activate(navType) and deactivate() to handle. If not, use disableMapNavigation() and enableMapNavigation(). There are a couple of things to be aware and refer JS API for more detail.
... View more
05-05-2011
09:36 AM
|
0
|
0
|
837
|
|
POST
|
Thanks for the excellent suggestions, the code is working now. One more question, how can I tweak the code so that no results are returned until the user types in 3 characters? maxwell, this is a very interesting and useful question so i digged in a little more on dojo API. it is similiar to AJAX AutoCompleteExtender's MinimumPrefixLength="3". Eventhough there is no such property in dijit.Form.FilteringSelect. You could work around by the following: function (value) { var select = dijit.byId('inlineid'); if (select.displayedValue.length < 3) { // delay query search indefinitely so it never happen select.searchDelay = 60000; // or more return; } else { // reactivate the query search select.searchDelay = 600; } } <input dojoType="dijit.form.FilteringSelect" id="lineid" searchAttr="name" name="widgetName" onKeyPress="getItem" > <!-- not this event: onChange="doSomething(this.value)" --> Hope it will help
... View more
05-05-2011
09:15 AM
|
0
|
0
|
2074
|
|
POST
|
I'm having some problems with the datagrid. When I try to add a datagrid to my page, it breaks and nothing displays after the header and the init function never gets called. however, if I comment out the dojox.mobile.parser and instead use dojo.parser, then the page displays just fine, except the button event handler gets called two times. This is really rudimentary, but I can't seem to figure out what I've got wrong here. Any help would be appreciated. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<!--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>Test</title>
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.2/js/dojo/dijit/themes/claro/claro.css">
<link rel='stylesheet' type="text/css" href='http://serverapi.arcgisonline.com/jsapi/arcgis/2.2/js/dojo/dojox/mobile/themes/iPhone/iPhone.css' >
<link rel='stylesheet' type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.2/js/dojo/dojox/mobile/themes/buttons.css">
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.2/js/dojo/dojox/grid/resources/Grid.css">
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.2/js/dojo/dojox/grid/resources/claroGrid.css">
<!-- ArcGIS API for JavaScript -->
<script type="text/javascript">
var djConfig = {
parseOnLoad: true
}
</script>
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.2compact"></script>
<script type="text/javascript">
/*************
* Dojo stuff
*************/
dojo.require("dojox.mobile");
dojo.require("esri.map");
// Works without datagrid
dojo.require("dojox.mobile.parser");
// Works with datagrid, but button event triggers 2x
//dojo.require("dojo.parser");
// this breaks things
dojo.require("dojox.grid.DataGrid");
// Initilize the map
dojo.addOnLoad(init);
// Setup and configure global variables
var map, initExtent;
initExtent = new esri.geometry.Extent({ "xmin": 244598, "ymin": 6241389, "xmax": 278995, "ymax": 6264320, "spatialReference": { "wkid": 102100} });
function init() {
map = new esri.Map("map", { extent: initExtent });
tiledLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer", { id: "Base", opacity: 1, visible: true });
map.addLayer(tiledLayer);
var resizeTimer;
dojo.connect(dijit.byId('map'), 'onLoad', function (theMap) {
dojo.connect(dijit.byId('map'), 'resize', function () {
//resize the map if the div is resized
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function () {
map.resize();
map.reposition();
}, 500);
});
});
}
function TestButton() {
alert("test.");
}
</script>
</head>
<body class="claro">
<div id="vwMap" dojoType="dojox.mobile.View" selected="true" style="width:100%; height:100%;">
<h1 dojoType="dojox.mobile.Heading" id="mapHeading" back="Search Results" moveTo="vwSearchResults"></h1>
<div style="position:absolute; right:5px; top:48px; z-index:999">
<button dojoType="dojox.mobile.Button" onClick="TestButton();" id="btnMapToggle">Button</button>
</div>
<div id="map" style="width:100%; height:80%;"></div>
</div>
</body>
</html>
Since you are using dojox.mobile.parser. I would put dojox.mobile.parser.parse(); in the beginning of the init() to explicitly dojox.mobile.paser to parse the page and comment out the following portion: <script type="text/javascript"> var djConfig = { parseOnLoad: true } </script> It should solve the issue.
... View more
05-05-2011
06:22 AM
|
0
|
0
|
642
|
|
POST
|
Hzhu, Thank you for you prompt response. I tried something similar to this but I only want the lines that the user has selected and not others around in and around them, is there a way that I can remove the unwanted lines from the selection, without the process being too time consuming? As I have over 8000 lines and the cart only has a capacity of 25 lines. Hopefully this makes sense and you can help me further. Many thanks, Ben Create a graphic array and push only the selected line into it. And then apply what i said. something like var lines =[]; for (line in your cart...){ lines.push[line];}
... View more
05-04-2011
01:23 PM
|
0
|
0
|
1035
|
|
POST
|
Hello, I am trying to create a variation of the 'Clip and Ship' Extract Data task that instead of having an AOI being passed in the params has a list of the Unique Feature Values. The idea behind what I am try to do is to implement and kind of cart system where users add lines to the cart (JQuery table) from over a wide geographic area and then when they have collected all of the lines they are interested in, they simply click download and the Extract Data Geoprocessing Task runs on the server and clips and ships a zip file containing a shapefile of the lines they had in the cart. Can anyone give me any ideas as to how to edit the python script or the Extract Data model to allow this? Many thanks, Ben Sayers You can achieve this without modify Extract Data Model. Here is the idea: Once you collected all the lines, create a extent that covers all the lines ( var extent =esri.graphicsExtent(lines);). Use this extent as a geometry to create a graphic. Push this graphic into a featureSet as your AOI parameter -somthing like the following: /* parameter AOI - clipFeatureSet*/ var clipFeature = []; clipFeature.push(graphic); var clipFeatureSet = new esri.tasks.FeatureSet(); clipFeatureSet.features = clipFeature; After that, call your GP task. Does it make sense?
... View more
05-04-2011
10:16 AM
|
0
|
0
|
1035
|
|
POST
|
I need a little help with the filtering select. It's not returning any values, and when I enter text into the selectbox I get a "the value entered is not valid". Any help is appreciated. Thanks--the code is below ____________________________________ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta http-equiv="X-UA-Compatible" content="IE=7" /> <title>FilterSelect Query</title> <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.0/js/dojo/dijit/themes/tundra/tundra.css"> <script type="text/javascript">djConfig = { parseOnLoad:true };</script> <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.0"></script> <script type="text/javascript"> //Be sure to define you dojo components dojo.require("dijit.form.FilteringSelect"); dojo.require("dojo.data.ItemFileReadStore"); //Our main initialization function, called at just the right time function init () { //Create your query //var queryTask = new esri.tasks.QueryTask("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSFields/MapServer/0"); // var queryTask = new esri.tasks.QueryTask("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSFields/MapServer/0"); var queryTask = new esri.tasks.QueryTask("http://dingo.gapanalysisprogram.com/ArcGIS/rest/services/PADUS/PADUS_status/MapServer/0"); //set the onComplete event handler, in this case, when the query is complete, call initLineID, //production code would handle handle the error callback as well dojo.connect(queryTask, "onComplete", initLineID); //build and execute your query var query = new esri.tasks.Query(); //query.outFields = ["field_name"]; query.outFields = ["P_Des_Nm"]; query.text = "all"; query.returnGeometry = true; queryTask.execute(query); } function initLineID(features) { var lineIdObjects = []; dojo.forEach(features.features, function(feature) { lineIdObjects.push({"name": feature.attributes.P_Des_Nm});; }); //Build the appropriate data object for our data component var data = { "identifier": "name", "items": lineIdObjects } //bind the data object to the datastore var lineDataStore = new dojo.data.ItemFileReadStore({data: data}); //bind the data store to the FilteringSelect component dijit.byId("lineid").store = lineDataStore; } function doSomething(v) { alert(v); } dojo.addOnLoad(init); </script> <body class="tundra"> <input dojoType="dijit.form.FilteringSelect" id="lineid" searchAttr="name" name="widgetName" onChange="doSomething(this.value)"> </body> </html> Maxwell, I looked at your query layer, its Display Field is Own_Name. Since your stated: query.text = "all", it will interpreate into query.where ="Own_Name like '%all%'.(look api for reference). I tested it and it will not return any records. If you do want to retrive all the record, i suggested that you use the following: //build and execute your query var query = new esri.tasks.Query(); //query.outFields = ["field_name"]; query.outFields = ["P_Des_Nm", "OBJECTID"]; //query.text = "all"; query.where ="OBJECTID >=0"; query.returnGeometry = false; queryTask.execute(query);
... View more
05-04-2011
05:56 AM
|
0
|
0
|
2074
|
|
POST
|
hihi i am currently doing a project and meet this problem is How to style the dijit.form.button ? i programmatic the button and i try to style in this function, but the button did not change the background color to transparent and the border i put 0px it also did not make changes to it so i was wondering how should i do?? var linkNote = new dijit.form.Button({ label: "Grab me!!" }) thanks...reply asap!!!! Do you use something like this?: linkNote = new dijit.form.Button({ label: "Grab me!!", style: "background-color:Transparent; border:0px" })
... View more
05-04-2011
05:29 AM
|
0
|
0
|
600
|
|
POST
|
I have XY data in SQL that I have added as an event layer to a map document. That .mxd was then used to create a map service. I can sucessfully use the Find Task in the REST services directory to find a specific record, but when I try to execute the find task using the Javascript API, it fails. I exported my data to a personal geodatabase and created a map service off of the new feature class. The Find Task worked perfectly. It works if the source data of the map service is a feature class, but fails if it is an XY event layer. Can the Find Task be used on XY events or that a limitation of the task? Perhaps it is just a syntax error when defining my find parameters? findParams = new esri.arcgis.gmaps.FindParameters();
findParams.returnGeometry = true;
findParams.layerIds = [0];
findParams.searchFields = ["REQUESTID"];
findParams.searchText = requestID;
findParams.contains = true;
findTask.execute(findParams, zoomToRecord); Any help would be much appreciated. Thanks! ~Stephanie XY Event layer is a temorary feature layer stored in memory or system "temp" folder. It is not persisent. Most likely your none local ArcGIS accounts (SOM, SOC, ArcGISWebServices) has no access to it and no surprise that you failed in getting findTask. Exported as permanent feature class is the right thing to do.
... View more
04-28-2011
10:45 AM
|
0
|
0
|
2939
|
|
POST
|
I would like my point symbols to have a shadow effect. I am using esri.symbol.PictureMarkerSymbol to display an png image. In Flex, I was able to create a shadow effect using com.esri.graphics.Graphic.filters and flash.filters.DropShadowFilter. Can something similar be done in Javascript? I have tried that on JS API. As far as i know there is no property or method to do that. I ended it up adding a shadow on my image itself.
... View more
04-28-2011
10:19 AM
|
0
|
0
|
990
|
|
POST
|
I had some time today and just wanted to comment. Hopefully the following will help resolve any unsettled issues regarding visible layers and how to control them. I did some fact checking and as expected visibleLayers returns an array of visible layer index values and does not return group layer index values. See my screen shots. The key way to dynamically manipulate what's visible is by adding or subtracting layer index values in an array which gets passed into setVisibleLayers(). This can be done by using native splice and push JavaScript methods. See this Esri sample, specifically the toggle function. http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/widget_legendvisiblelayers.html As for a limit to the number of layers which can be passed into setVisibleLayers, I am not aware of any. Hopefully this helps. Regards, Doug Carroll, ESRI Support Services SDK Team, Technical Lead http://support.esri.com/ Doug, I respect what you said, but that is not what i got when i test on http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/. It cleared show that layer.visibleLayers =[0,1,2,3,4,5]. among them 2 is a group layer. Do i missed something?
... View more
04-28-2011
05:06 AM
|
0
|
0
|
4004
|
| 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
|