|
POST
|
var factor = 0; var xtent =new esri.geometry.Extent(xmin-factor, ymin-factor, xmax+factor, ymax+factor) map.setExtent(xtent); alert(map.extent.xmin + ',' + map.extent.ymin + ',' +map.extent.xmax + ',' + map.extent.ymax ); I got this code, and the xtent of a map differs from the extent of xtent. Any practical reason behind it or is my code just faulty? You might want to add sr parameter. list this: var xtent =new esri.geometry.Extent(xmin-factor, ymin-factor, xmax+factor, ymax+factor, map.spatialReference);
... View more
03-14-2012
08:38 AM
|
0
|
0
|
1238
|
|
POST
|
Heming, Before I use the example you provided, I am trying to use the following sample. I have it working, the problem is that only one result is being exported from the data store. I think it has to do with the feature attributes returning only one result. Does an Identify Task return a Feature Set? http://arcscripts.esri.com/details.asp?dbid=16528
function executeIdentifyTask(geom) {
//clear the graphics layer
map.graphics.clear();
identifyParams.geometry = geom;
identifyParams.mapExtent = map.extent;
identifyTask.execute(identifyParams,function(response){
var polygonSymbol = 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,94,204,0.8]));
var markerSymbol = new esri.symbol.SimpleMarkerSymbol().setColor(new dojo.Color([25,50,225,0.3]));
var controlItems = [];
var surveyItems = [];
dojo.forEach(response,function(result){
var feature = result.feature;
alert(feature.attributes);
if (result.layerName =="surveys"){
showSurveysNameGrid();
feature.setSymbol(polygonSymbol);
//searchType="selSurvey";
//for (var i = 0; i < feature.length; i++) {
//alert(result.feature);
var attributes = feature.attributes;
surveyItems.push(attributes);
var csvTextSurv = "DOCUMENT_N;TOWNSHIP_RANGE;SECTION\n";
csvTextSurv += attributes["DOCUMENT_N"] + ";" +
attributes["TOWNSHIP_RANGE"] + ";" +
attributes["SECTION"] + "\n";
document.getElementById("csvSurv").value = csvTextSurv;
map.graphics.add(feature);
}
Identify task return identifyResults. which is a litttle different from featureSet retured from Query Task. What are common among them is that they all include features. For identifyResults, you have to regroup features based on layer id or name so that you are the same as as QueryTask's featureSet that can be used in a GP service as featureSet (or featureLayer).
... View more
03-13-2012
02:07 PM
|
0
|
0
|
1946
|
|
POST
|
So what should I do if the geometry type is blank in the map service for a point layer? I have some point layers that are set to "esriGeometryPoint", but others are just blank. This causes a problem when trying to work with the ArcGIS Viewer for Silverlight. I cannot use the layer because the geometry type is "unspecified". How do I set the geometry type of an unspecified layer? Here's an example of a point layer with an unspecified geometry type: http://ndep-emap.nv.gov/ArcGIS/rest/services/eMap/MapServer/17 That is causing your featureLayer's geometry being undefined (I tried featureLayer.graphics[0].geometry.type too). That is interesting!!
... View more
03-13-2012
10:18 AM
|
0
|
0
|
3349
|
|
POST
|
Hi Zhu, I changed the line as you suggested to: Change graphic.attributes.OBJECTID === foundItem[0] to graphic.attributes.OBJECTID === foundItem The map does not recenter where the user clicks??? It does not move or recenter??? map.centerAt is only for point. if your graphic's geometry is of polyline or polygon. you might have to use var selectedItemExtent = selectedItem.geometry.getExtent(); map.setExtent(selectedItemExtent);
... View more
03-13-2012
09:48 AM
|
0
|
0
|
2169
|
|
POST
|
Hi, I want the map to centre the map, when the user clicks the map. I have added a line to center the map, is not working?? The code is below, any suggestions??? >>>>>>>>>>>>>>>>>>>>>>>>>>> //Zoom to the parcel when the user clicks a row function onRowClickHandler(evt) { var foundItem = grid.getItem(evt.rowIndex).obj_ID; var selectedItem; dojo.forEach(map.graphics.graphics, function(graphic) { if((graphic.attributes) && graphic.attributes.OBJECTID === foundItem[0]) { selectedItem = graphic; switch (graphic.geometry.type) { case "point": graphic.setSymbol(pictureMarkerSymbol); break; case "polyline": graphic.setSymbol(selectedLineSymbol); break; case "polygon": graphic.setSymbol(selectedPolySymbol); break; } } }); var selectedItemExtent = selectedItem._extent.expand(0.2); map.setExtent(selectedItemExtent); ///map.centerAndZoom(selectedItemExtent, 0.5); map.centerAt(selectedItemExtent); Change graphic.attributes.OBJECTID === foundItem[0] to graphic.attributes.OBJECTID === foundItem
... View more
03-13-2012
08:40 AM
|
0
|
0
|
2169
|
|
POST
|
Hello, I have a grid defined in my widget. for each row, I have an image that I want to act as the remove button. How do I set the html, so that I know when the button/image is clicked. I've tried variations of the commented and uncommented code in DeleteFormatter. Any help would be gladly appreciated Here's a subset of my class startup: function() {
console.log("DisplaySearchGridWidget startup");
this.inherited(arguments);
//grid structure
var layout = {
cells:[
{
field:"value",
name:"Results",
width:'85%',
height:'100%'
},
{
field:"remove",
name:"Delete",
width:'15%',
height:'100%',
formatter:this.DeleteFormater
}
]
};
this._searchGrid.set("structure",layout);
dojo.connect(this._searchGrid,"onRowClick",dojo.hitch(this,this.RowClicked));
dojo.subscribe("displaySearchGridEvent",this,"DisplayCurrentSearch");
},
RowClicked : function(e){
var item = this._searchGrid.getItem(e.rowIndex);
var graphic = this._searchGrid.store.getValue(item,'graphic');
this.DisplayItem(graphic);
this.PublishItem(this._searchGrid.getItem(e.rowIndex).searchPrefix,this._searchGrid.getItem(e.rowIndex).value,graphic);
},
DeleteFormater: function (remove){
"<img src='../assets/images/icons/minimize.png' alt='Ring' 'width='16' height='16'>"
/*var delButton = "<div dojoType=\"dijit.form.Button\"><img src=\"../assets/images/icons/minimize.png\"";
delButton = delButton + " width=\"16\" height=\"16\"";
delButton = delButton + " onClick=\"DeleteItem('"+remove+"')\"></div>";
return delButton; */
var delButton = "<button type=\"button\" data-dojo-type=\"dijit.form.Button\" data-dojo-props=\"iconClass:'DeleteIcon'";
delButton += "onClick:function(){dojo.publish('searchItemClicked', ["+ remove + "]);}\"></button>";
return delButton;
}, Adding formatter on datagrid th is the right choice. The basic idea is to dynamically create a button and passed rowid to its onclick function. Here is the sample i did for POC a while ago. It is a modified version of one of the ESRI sample. Hope it helps.
... View more
03-12-2012
10:26 AM
|
0
|
0
|
950
|
|
POST
|
I am getting close. The problem is that only one result, the last one, from my datagrid is showing up in my text area for export to excel. I think the csv is not getting the full results from the feature selected, for some reason it only gets one. How do I get the full results of the selection ready for csv export?
function executeIdentifyTask(geom) {
//clear the graphics layer
map.graphics.clear();
identifyParams.geometry = geom;
identifyParams.mapExtent = map.extent;
identifyTask.execute(identifyParams,function(response){
var polygonSymbol = 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,94,204,0.8]));
var markerSymbol = new esri.symbol.SimpleMarkerSymbol().setColor(new dojo.Color([25,50,225,0.3]));
var controlItems = [];
var surveyItems = [];
dojo.forEach(response,function(result){
var feature = result.feature;
if (result.layerName =="surveys"){
showSurveysNameGrid();
feature.setSymbol(polygonSymbol);
var attributes = feature.attributes;
surveyItems.push(attributes);
var csvTextSurv = "DOCUMENT_N;TOWNSHIP_RANGE;SECTION\n";
csvTextSurv += attributes["DOCUMENT_N"] + ";" +
attributes["TOWNSHIP_RANGE"] + ";" +
attributes["SECTION"] + "\n";
document.getElementById("csvSurv").value = csvTextSurv;
map.graphics.add(feature);
}else{
showPointNameGrid();
feature.setSymbol(markerSymbol);
var attributes = feature.attributes;
controlItems.push(feature.attributes);
var csvTextMons = "POINT_NAME;SECTION\n";
csvTextMons += attributes["POINT_NAME"] + ";" +
attributes["TOWNSHIP_RANGE"] + ";" +
attributes["SECTION"] + "\n";
}
document.getElementById("csvMons").value = csvTextMons;
map.graphics.add(feature);
});
if(surveyItems.length >0){
showSurveysNameGrid();
var surveysStore = new dojo.data.ItemFileReadStore({data:{identifier:'DOCUMENT_N',items:surveyItems}});
var grid = dijit.byId('grid5');
grid.setStore(surveysStore);
}
if(controlItems.length >0){
showPointNameGrid();
var controlStore = new dojo.data.ItemFileReadStore({data:{identifier:'POINT_NAME',items:controlItems}});
var grid = dijit.byId('grid4');
grid.setStore(controlStore);
}
});
}
<div id="footerPoints" class="roundedCorners" dojotype="dijit.layout.ContentPane" region="bottom" style=" padding-bottom:5%; height:18%; display:none">
<form action="http://surveyor.slco.org/JSAPIExportToExcel/DojoGridToExcel.asmx/CSV2Excel " method="POST">
<textarea name="csv" id="csvMons" style="width: 500px; height:30px"></textarea>
<input type="submit" value="Submit" />
</form>
<table dojotype="dojox.grid.DataGrid" data-dojo-id="grid4" id="grid4" data-dojo-props="rowsPerPage:'5', rowSelector:'20px'">
<thead>
<tr>
<th field="POINT_NAME" width="200px" >
Point Name
</th>
<th field="GRID_ADDRESS" width="200px" >
Address
</th>
<th field='TOWNSHIP_RANGE' width='200px'>Township/Range</th>
<th field="SECTION" width="200px" >
Section
</th>
<th fields="POINT_NAME,LONGITUDE_DD,LATITUDE_DD" formatter="makeLink1" width="200px" >
Monument Reference Sheet
</th>
<th field="MON_NOTES" width="200px" >
Monument Notes
</th>
</tr>
</thead>
</table>
</div>
<div id="footersurvName" class="roundedCorners" dojotype="dijit.layout.ContentPane" region="bottom" style=" padding-bottom:5%; height:18%; display:none">
<form action="http://surveyor.slco.org/JSAPIExportToExcel/DojoGridToExcel.asmx/CSV2Excel " method="POST">
<textarea name="csv" id="csvSurv" style="width: 500px; height:30px"></textarea>
<input type="submit" value="Submit" />
</form>
<table dojotype="dojox.grid.DataGrid" data-dojo-id="grid5" id="grid5" data-dojo-props="rowsPerPage:'5', rowSelector:'20px'">
<thead>
<tr>
<th field="DOCUMENT_NUM" width="200px" >
Survey Number
</th>
<th field="SURVEYOR" width="200px" >
Surveyor
</th>
<th field="ADDRESS_OF_SURVEY" width="200px" >
Address
</th>
<th field='TOWNSHIP_RANGE' width='200px'>
Township/Range
</th>
<th field="SECTION" width="200px" >
Section
</th>
<th fields="subdir,page_id" formatter="makeLink" width="200px" >
PDF
</th>
</tr>
</thead>
</table>
</div>
Are you using the python script tabletoexcel.py that i pointed to? if so, here is how i modified it to fit my use. I added Make Feature Layer (or Make Table View) with the Query Expression (the same as you use query task's where clause). then use the result feature layer or table view (in your case would be data store) as the first input for the tabletoexcel.py and published it as a GP service (i also include a zip module to zip the result).
... View more
03-08-2012
10:34 AM
|
0
|
0
|
1946
|
|
POST
|
I have a task in which I have a table of addresses in a SQL Server 2008 table. I need to display these as referenced points in a map via JavaScript API. The addresses in the table are dynamic and change, so this won't work as a feature class. What is the best method to accomplish this? Thanks! B One approach i would take would be a GP services (Add X, Y as a layer or GeoCode etc. base on your date) with result/event layer on your mxd. There are certain limitations though if your SQL server table does not have OBJECTID field. So I would suggest you registered you table with Geodatabase. It really does not affect non GIS access to the table.
... View more
03-08-2012
04:51 AM
|
0
|
0
|
631
|
|
POST
|
Hello, This is in continuation of my previous two messages..................... I believe all features in the header section of Data Grid should conform to changes made to 'dojoxGridMasterHeader' and 'dojoxGridHeader' but it did not work out that way for me. Can someone propose an alternative, or suggest changes to the css below to set this right? I'll really appreciate any help as I have been struggling with it for sometime now. CSS .dojoxGrid th { height: 30px; } .dojoxGridCell { background-color: #505050; color:white; } .tundra .dojoxGridMasterHeader .dojoxGridHeader { height: 30px; } .tundra .dojoxGridSortNode { background-color:#505050; color: orange; height: 30px; } Thanks Samir Gambhir Samir, have you tried just .dojoxGrid .dojoxGrid-header?
... View more
03-07-2012
04:54 AM
|
0
|
0
|
1912
|
|
POST
|
We are trying to use GPS location in a map with services in wkid 3008 using this code: if (navigator.geolocation){ navigator.geolocation.getCurrentPosition(zoomToLocation, locationError); } function zoomToLocation(location) { var pt = new esri.geometry.Point(location.coords.longitude, location.coords.latitude); var outSR = new esri.SpatialReference({ wkid: 3008}); gsvc.project([ pt ], outSR, function(projectedPoints) { pt = projectedPoints[0]; map.centerAndZoom(pt, 8); }); } But we don't get the expected result, map loads fine but when using position maps zooms in to a out of bounds location. What are we missing? function zoomToLocation(location) { var pt = new esri.geometry.Point(location.coords.longitude, location.coords.latitude, new esri.SpatialReference({ wkid: 4326 })); var outSR = new esri.SpatialReference({ wkid: 3008}); gsvc.project([ pt ], outSR, function(projectedPoints) { pt = projectedPoints[0]; map.centerAndZoom(pt, 8); }); }
... View more
03-06-2012
12:36 PM
|
0
|
0
|
1372
|
|
POST
|
Thanks again for your help!! Do you know if this script works for a Dojo datagrid? Yes, basically the data store for datagrid is either the query, find or identify featureset. I used the script in a Windows Phone 7 app where i convert a query result FeatureSet to csv or .xls based on user choice.
... View more
03-05-2012
01:21 PM
|
0
|
0
|
2558
|
|
POST
|
Hi, Has anyone had luck exporting a dojo datagrid to a csv file? The example above is a bit outdated and I am having trouble getting it to work.:confused: Thanks! There is a python script in http://resources.arcgis.com/gallery/file/geoprocessing/details?entryID=95009B25-1422-2418-7FB5-B8638ECB2FA9. You can easily modify it and use it as a GP Service. I personally used it to convert a query results (FeatureSet) to CSV or .XLS file.
... View more
03-05-2012
09:36 AM
|
0
|
0
|
2558
|
|
POST
|
Hi, I have seen lot's of information on changing the zoom slider using the esri default methods, but I'm looking to do something different and can't see from the API how I should do it. I have several hierachies of boundaries that I want to display. The user selects which Hierarchy from a drop down box. At various zoom levels only a given layer in that hierachy is displayed. For example if the zoom level is 0 to 5 show state borders, when a bit lower show local givernment borders, etc etc. What I can't see how to do is update the zoom slider labels. I can set them before I create the map, but can't see how to change them on the fly afterwards, as the user changes which hierarchy they are looking at. I want to have the labels represent which boundaries are visible at a given zoom level. Does anyone know if this is possible? If so could you show me which object.method(newLabelInfo) to use? Thanks You could build your own zoom slider using dijit.form.slider and tie with the zoom level. Though i have not built it myself, i have use it to tie with the layer's transparency. I think the principle is the same.
... View more
03-02-2012
12:46 PM
|
0
|
0
|
794
|
|
POST
|
To All Python Users That Use Bat Files to Call Python Scripts: I am trying to read in values from a txt file in a bat file that will be used as variables when calling python scripts within the bat file. I have searched the Internet for the proper syntax to accomplish this goal, but I am unable to read from a txt file in the bat file. Does anyone have experience with this task and could provide some sample code so I can see where I am going wrong? Any help or hints are greatly appreciated. Thanks. One approach you could try is to read file directly in python script so you don't have to pass variables from bat file.
... View more
03-02-2012
11:54 AM
|
0
|
0
|
2108
|
|
POST
|
I tried- function showResults(featureSet) //Zoom to the extent of the graphics query.where = ""; var centerPoint = evt.mapPoint; var mapWidth = theMap.extent.getWidth(); var pixelWidth = mapWidth/theMap.width; //Calculate a 10 pixel envelope width (5 pixel tolerance on each side) var tolerance = 5 * pixelWidth; var queryExtent = new esri.geometry.Extent(centerPoint.x -tolerance, centerPoint.y -tolerance, centerPoint.x +tolerance, centerPoint.y +tolerance, theMap.spatialReference); query.geometry = queryExtent; var ResultEnv = query.geometry.getExtent().expand(10.0); theMap.setExtent(ResultEnv); but I get an error: ReferenceError: evt is not defined You will have to use the featureSet's extent not evt. Like this:
var ResultEnv =esri.graphicsExtent(featureSet.features);
theMap.setExtent(ResultEnv);
... View more
03-02-2012
11:33 AM
|
0
|
0
|
1219
|
| 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
|