|
POST
|
Thanks for taking a look at it, unfortunately I still get the same error. Could the issue also be in- var ResultEnv = query.geometry.getExtent().expand(10.0); ?? Yes, you need to change make similiar changes on you showResults function.
... View more
03-02-2012
10:02 AM
|
0
|
0
|
1220
|
|
POST
|
Thanks again for the reply! I am trying to set-up a situation where if the user of the map manually selects overlapping features using the Identify task, both results will display in seperate datagrids at the bottom of the screen. I have it working if only one layer is selected, results are displayed in the datagrid. I also have it working where if two layers are selected, they highlight as such on the map. I am just stuck on how to show the results of the selection in 2 datagrids at the bottom of the page. I am also open to having a propmt that allows the user to chose which results to show after selecting both layers. I hope that makes sense. The part that seems to be broken is where I try and get results for both layers using the && operator. The alert does not even display in the section of code.Below is the relevant code. I really appreciate any advice you have!! Sorry to be such a newbie.:confused:
//SELECT STUFF
dojo.connect(map, 'onLoad', function(theMap) {
navToolbar.deactivate();
identifyTask = new esri.tasks.IdentifyTask("http://slcarcgisdev1/SLCOGIS/rest/services/public/Surveyor/MapServer");
identifyParams = new esri.tasks.IdentifyParameters();
identifyParams.tolerance = 3;
identifyParams.returnGeometry = true;
identifyParams.layerIds = [0,2];
identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL;
identifyParams.width = map.width;
identifyParams.height = map.height;
//initialize the toolbar
toolBar = new esri.toolbars.Draw(map);
dojo.connect(toolBar, "onDrawEnd",onDrawEnd);
navToolbar.deactivate();
//resize the map when the browser resizes
dojo.connect(dijit.byId('map'), 'resize', map,map.resize);
});
function onDrawEnd(extent){
navToolbar.deactivate();
executeIdentifyTask(extent);
}
function executeIdentifyTask(geom) {
//clear the graphics layer
map.graphics.clear();
var polygonSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DOT, new dojo.Color([151, 249,0,.80]), 3), new dojo.Color([151, 249, 0, 0.45]));
var markerSymbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE, 20, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0, 0, 0]), 1), new dojo.Color([25,50,225,0.3]));
identifyParams.geometry = geom;
identifyParams.mapExtent = map.extent;
identifyTask.execute(identifyParams,function(response){
var controlItems = [];
var surveyItems = [];
dojo.forEach(response,function(result){
var feature = result.feature;
//add selected feature to graphics layer
feature.setSymbol(polygonSymbol);
feature.setSymbol(markerSymbol);
map.graphics.add(feature);
if (result.layerName === 'surveys' && result.layerName === 'Control Points'){
alert(result.layerName);
showSurveysNameGrid();
surveyItems.push(feature.attributes);
showPointNameGrid();
controlItems.push(feature.attributes);
var surveysStore = new dojo.data.ItemFileReadStore({data:{identifier:'DOCUMENT',items:surveyItems}});
var grid = dijit.byId('grid5');
grid.setStore(surveysStore);
var controlStore = new dojo.data.ItemFileReadStore({data:{identifier:'POINT_NAME',items:controlItems}});
var grid = dijit.byId('grid4');
grid.setStore(controlStore);
}else if(result.layerName === 'Control Points'){
alert(result.layerName);
showPointNameGrid();
controlItems.push(feature.attributes);
searchType = "selControl";
//update the data grid
var controlStore = new dojo.data.ItemFileReadStore({data:{identifier:'POINT_NAME',items:controlItems}});
var grid = dijit.byId('grid4');
grid.setStore(controlStore);
}else if(result.layerName === 'surveys'){
alert(result.layerName);
showSurveysNameGrid();
surveyItems.push(feature.attributes);
searchType="selSurveys2";
var surveysStore = new dojo.data.ItemFileReadStore({data:{identifier:'DOCUMENT_N',items:surveyItems}});
var grid = dijit.byId('grid5');
grid.setStore(surveysStore);
}
});
});
} You might want to change you logic flow in your function. Here is the example:
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_DOT, new dojo.Color([151, 249,0,.80]), 3), new dojo.Color([151, 249, 0, 0.45]));
var markerSymbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE, 20, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0, 0, 0]), 1), 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"){
//alert(result.layerName);
feature.setSymbol(polygonSymbol);
surveyItems.push(feature.attributes);
else{
feature.setSymbol(markerSymbol);
controlItems.push(feature.attributes);
}
//add selected feature to graphics layer
map.graphics.add(feature);
});
if(surveyItems.length >0){
var surveysStore = new dojo.data.ItemFileReadStore({data:{identifier:'DOCUMENT',items:surveyItems}});
var grid = dijit.byId('grid5');
grid.setStore(surveysStore);
showSurveysNameGrid();
}
if(controlItems.length >0){
var controlStore = new dojo.data.ItemFileReadStore({data:{identifier:'POINT_NAME',items:controlItems}});
var grid = dijit.byId('grid4');
grid.setStore(controlStore);
showPointNameGrid();
}
});
}
... View more
03-02-2012
09:25 AM
|
0
|
0
|
1360
|
|
POST
|
Thanks so much for the answer!:) That is what I was trying to accomplish with the code I originally posted. Is it possible to get information for two layers using the following code?
}else if((result.layerName === 'surveys') && (result.layerName === 'Control Points')){
showSurveysNameGrid()
surveyItems.push(feature.attributes);
showPointNameGrid();
controlItems.push(feature.attributes);
var surveysStore = new dojo.data.ItemFileReadStore({data:{identifier:'DOCUMENT',items:surveyItems}});
var grid = dijit.byId('grid5');
grid.setStore(surveysStore);
var controlStore = new dojo.data.ItemFileReadStore({data:{identifier:'POINT_NAME',items:controlItems}});
var grid = dijit.byId('grid4');
grid.setStore(controlStore);
}
});
Without context, I cannot really tell whether your function would work. It should work.
... View more
03-02-2012
07:47 AM
|
0
|
0
|
1360
|
|
POST
|
Hi, I have to display user's location on map also I have to draw route by giving latitude and longitude using javascript API. I have searched lots of on resource center but there are sample example which are displaying location or giving location information of US(North America). I have to plot the pointer on map in all countries. Please guide me. Thanks I don't know whether there is a real good router service out there for all countries. (Try US to China on Google map, they told you "Kayak across the Pacific Ocean" !)
... View more
03-01-2012
11:33 AM
|
0
|
0
|
558
|
|
POST
|
Hi all, I found an app here : http://help.arcgis.com/en/webapi/javascript/arcgis/demos/find/find_map_datagrid.html How do you make the datagrid on this app editable ? Any sample on editing datagrid ? I need guidance Thanks First of all, change the data store from ItemFileReadStore to ItemFileWriteStore. Also make the field (or cell) editable - editable ="true". If you want the data changed in Database, you also need to make the layer as a featurelayer to allow data editing such that you could use applyEdits...
... View more
03-01-2012
11:18 AM
|
0
|
0
|
970
|
|
POST
|
I'm trying to use the code sample here to use URL parameters to select one or more POINT features and zoom the map to those features. I have configured it using one of my polygon features and it works but I'm trying to use it for a point feature. When I try passing this URL parameter the symbol appears around the point but the map does not zoom in or display the points information. Also I get this error- TypeError: query.geometry is null Does anyone know what I need to add to my code to allow this to work properly? I've tried a few different ways but not having much luck. From the error message, I think the problem lies in the queryExtent in your executeQueryTask(evt) function. Try this to see if it works:
function executeQueryTask(evt)
{
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;
queryTask.execute(query, showResults);
}
... View more
03-01-2012
09:33 AM
|
0
|
0
|
1220
|
|
POST
|
I've fiddled around with dojo's content panes and I'm pretty sure that need to be defined a region where they are supposed to be located (top, left, center, right & bottom). BTW, can a width be inherited from a parent style that easily with just style="width: inherit;"? Since your two map panels are all within another div. I would try this: div.mappingTab #mapM { position:absolute; width:100%; height:99%; padding:0; } div. analysisTab #mapA { position:absolute; width: 800px; height: 300px; right:10px; top:10px; box-shadow:1px 1px 10px black; }
... View more
03-01-2012
07:50 AM
|
0
|
0
|
2463
|
|
POST
|
Hi all, I have a Javascript web map in which the user manually selects layers by dragging a box, using the Identify Task. I have it working where if features from one layer are selected, the results are displayed in a datagrid. The problem I am having is if two layers overlap and the user selects them both, I can't figure out how to display results for both. I have tried multiple things and am yet to come up with a solution. I am open to either having both datagrids displayed at the bottom, or giving the user a choice through a pop-up window of which grid results to show. The last chunk of the else/if statement where I try to put both the layers together does not seem to be working....any ideas???? Thanks so much!!!
dojo.connect(map, 'onLoad', function(theMap) {
navToolbar.deactivate();
identifyTask = new esri.tasks.IdentifyTask("http://slcarcgisdev1/SLCOGIS/rest/services/public/Surveyor/MapServer");
identifyParams = new esri.tasks.IdentifyParameters();
identifyParams.tolerance = 3;
identifyParams.returnGeometry = true;
identifyParams.layerIds = [0,2];
identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL;
identifyParams.width = map.width;
identifyParams.height = map.height;
//initialize the toolbar
toolBar = new esri.toolbars.Draw(map);
dojo.connect(toolBar, "onDrawEnd",onDrawEnd);
navToolbar.deactivate();
//resize the map when the browser resizes
dojo.connect(dijit.byId('map'), 'resize', map,map.resize);
});
function onDrawEnd(extent){
navToolbar.deactivate();
executeIdentifyTask(extent);
}
function executeIdentifyTask(geom) {
//clear the graphics layer
map.graphics.clear();
var polygonSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DOT, new dojo.Color([151, 249,0,.80]), 3), new dojo.Color([151, 249, 0, 0.45]));
var markerSymbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE, 20, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0, 0, 0]), 1), new dojo.Color([25,50,225,0.3]));
identifyParams.geometry = geom;
identifyParams.mapExtent = map.extent;
identifyTask.execute(identifyParams,function(response){
var controlItems = [];
var surveyItems = [];
dojo.forEach(response,function(result){
var feature = result.feature;
//add selected feature to graphics layer
feature.setSymbol(polygonSymbol);
feature.setSymbol(markerSymbol);
map.graphics.add(feature);
if(result.layerName === 'Control Points'){
showPointNameGrid();
controlItems.push(feature.attributes);
searchType = "selControl";
var controlStore = new dojo.data.ItemFileReadStore({data:{identifier:'POINT_NAME',items:controlItems}});
var grid = dijit.byId('grid4');
grid.setStore(controlStore);
}else if(result.layerName === 'surveys'){
showSurveysNameGrid();
surveyItems.push(feature.attributes);
searchType="selSurveys";
var surveysStore = new dojo.data.ItemFileReadStore({data:{identifier:'DOCUMENT_N',items:surveyItems}});
var grid = dijit.byId('grid5');
grid.setStore(surveysStore);
}else if((result.layerName === 'surveys') && (result.layerName === 'Control Points')){
showSurveysNameGrid()
surveyItems.push(feature.attributes);
showPointNameGrid();
controlItems.push(feature.attributes);
var surveysStore = new dojo.data.ItemFileReadStore({data:{identifier:'DOCUMENT',items:surveyItems}});
var grid = dijit.byId('grid5');
grid.setStore(surveysStore);
var controlStore = new dojo.data.ItemFileReadStore({data:{identifier:'POINT_NAME',items:controlItems}});
var grid = dijit.byId('grid4');
grid.setStore(controlStore);
}
});
});
}
One approach I would try is to store the identify results in seperate data stores, and then dynamically build/rebuild the datagrid(s) based on users choice (one or both)...
... View more
03-01-2012
07:31 AM
|
0
|
0
|
1360
|
|
POST
|
i've the same problem, I try to execute my script embebed into Arcgis and it run perfectly, but when I try to run *.py i receive this message ERROR 000824: The tool is not licenced. I included into my script this: import arcview import arcpy arcpy.CheckOutExtension("Spatial") I dont understand what is happening i'm so confused. Can you help me? Thanks a lot. Add this line making sure your session is running under ArcInfo license (spatial runs under ArcInfo license). os.environ['ESRI_SOFTWARE_CLASS']='Professional'
... View more
01-06-2012
08:34 AM
|
0
|
0
|
3654
|
|
POST
|
Thanks Angela. I can definitely accomplish this, however I don't know how I can ensure that I am measuring straight line distance from end point to end point (Shortest route?) as opposed to distance along the polyline. XYToLine_management will create a featureclass containing geodetic two-point features from start and end points (no matter what the unit the points are in).
... View more
01-04-2012
04:50 AM
|
0
|
0
|
1463
|
|
POST
|
I've seen some hiccups with the overwriteOutput command after scripts have been executed and then it's added. Try deleting the table, restarting Pythonwin/IDLE, and then re-execute the script. env.overwriteOutput =true has no impact on arcpy.FeatureClassToFeatureClass_conversion. Either use arcpy.CopyFeatures_management, or delete feature class prior to arcpy.FeatureClassToFeatureClass_conversion. Something like this:
outFC =outLocation +os.sep + outFeatureClass
#need import os. (or use out FC =outLocation +"\\"+ outFeatureClass)
if arcpy.Exists(outFC)==True:
arcpy.Delete_management(outFC)
... View more
01-03-2012
12:12 PM
|
0
|
0
|
424
|
|
POST
|
I have quite a few scheduled tasks which start a batch file and then start a python script from there. You may have a quirk that the python script encounters which causes it to bail immediately. Sometimes what helps is to add a line (in the batch file itself) that will write the processing output to a text file. Something like... PythonScript.py > C:\Log\LogFile.txt 2>&1 I also have the Python script itself write out a log file in case there are any errors I can't see in the command line log file. Something like ... import arcpy, os
outtable = open(r"C:\Log\PythonLog.txt", "w")
...
((((variables here))))
try:
((((indented code here))))
outtable.write("Some sort of text string here to let you it worked")
except arcpy.ExecuteError:
outtable.write(arcpy.GetMessages())
outtable.close() If the Python script succeeds you'll get that 'success text.' If not it may give you an idea on what the error is. Depending on if and when an error occurs makes the difference on which file you will find it in. Hope this helps! Did you specify the path of python.exe in your batch file?
... View more
01-03-2012
08:35 AM
|
0
|
0
|
993
|
|
POST
|
Hi, and happy new year everyone! Thanks for your reply Heming, but now I have an error using the Generalize task: "Nullable object must have a value." when using 4 geometries. "'geometries' parameter is invalid." when using 5 geometries. The second one I think it's related with the previous problem, but the first one I have no idea. I think its something simple, but I don't get what... The link on your post works on my machine...
... View more
01-03-2012
08:10 AM
|
0
|
0
|
325
|
|
POST
|
Thanks Heming. I applied your code to my js file. I think everything is good above the start of function extractData(). Nothing happens when I use Chrome to click the "Extract" button. At least IE gave the following error: Message: 'spatialReference.wkid' is null or not an object Line: 48 Char: 427431 Code: 0 URI: http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.6 Boy, this is going to ruin my new year's eve weekend 😞 Question: for the line that reads "var outSR = new esri.SpatialReference ( { wkid : 2236});" does wkid need to be quoted so it is written ad "wkid"? Thanks again for your help. I'll do some research over the weekend while following the path you set out. At the same time, if something jumps out at you I would appreciate feedback. Here is my code at the moment: dojo.require("dijit.dijit");
// optimize: load dijit layer
dojo.require("dijit.layout.BorderContainer");
dojo.require("dojox.layout.FloatingPane");
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.form.CheckBox");
dojo.require("dijit.form.ComboBox");
dojo.require("esri.map");
dojo.require("esri.dijit.Popup");
dojo.require("esri.geometry");
/*------------------------------------*/
// GLOBAL VARIABLES
/*-----------------------------------*/
var gp, map;
var loading;
var selectionToolbar;
//hzhu added
var gsvc;
function init() {
//configure map zoom animation to be slower (Gives a cool effect, almost similar to the Flex Viewer zoom)
//The default for zoomDuration in milliseconds is 250
//Default for zoomRate is 25
esri.config.defaults.map.zoomDuration = 1000;
esri.config.defaults.map.zoomRate = 50;
//configure map pan animation to be slower
//time in milliseconds; default panDuration:250
//refresh rate of zoom animation; default panRate:25
esri.config.defaults.map.panDuration = 1000;
esri.config.defaults.map.panRate = 50;
//esri.config.defaults.io.proxyUrl = "/arcgisserver/apis/javascript/proxy/proxy.ashx";
esri.config.defaults.io.proxyUrl = "/arcgisserver/apis/javascript/proxy/proxy.ashx";
loading = dojo.byId("loadingImg");
var initialExtent = new esri.geometry.Extent({"xmin":-8931399.85128929,"ymin":3006918.03708705,"xmax":-8913140.86444157,"ymax":3026297.04737907,"spatialReference":{"wkid":102100}});
map = new esri.Map("map", {
extent: initialExtent
});
dojo.connect(map, 'onLoad', function(map) {
initSelectionToolbar();
//resize the map when the browser resizes
dojo.connect(dijit.byId('map'), 'resize', map, map.resize);
});
var basemapUrl = "http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer";
var basemap = new esri.layers.ArcGISTiledMapServiceLayer(basemapUrl);
map.addLayer(basemap);
//var FortLaudMapLayers = new esri.layers.ArcGISDynamicMapServiceLayer("http://gis.fortlauderdale.gov/ArcGIS/rest/services/AppsITS/DataExtractionDownloads/MapServer");
var FortLaudMapLayers = new esri.layers.ArcGISDynamicMapServiceLayer("http://gis.fortlauderdale.gov/ArcGIS/rest/services/AppsITS/DataExtraction/MapServer");
map.addLayer(FortLaudMapLayers);
//hzhu added
gsvc = new esri.tasks.GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
//gp = new esri.tasks.Geoprocessor("http://gis.fortlauderdale.gov/ArcGIS/rest/services/AppsITS/DataExtractionDownloads/GPServer/Extract%20Data%20Task");
gp = new esri.tasks.Geoprocessor("http://gis.fortlauderdale.gov/ArcGIS/rest/services/AppsITS/DataExtraction/GPServer/Extract%20Data%20Task");
}
function initSelectionToolbar(myMap) {
selectionToolbar = new esri.toolbars.Draw(map);
dojo.connect(selectionToolbar, "onDrawEnd", function(geometry) {
selectionToolbar.deactivate();
var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, 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 graphic = new esri.Graphic(geometry, symbol);
map.graphics.add(graphic);
});
}
function activateTool(type) {
selectionToolbar.activate();
}
function extractData() {
//hzhu added
var outSR = new esri.SpatialReference({
wkid : 2236
});
//hzhu added
gsvc.project([map.graphics.graphics[0]], outSR, function(graphics) {
//hzhu added
var graphic = graphics[0];
//get clip layers
var clipLayers = [];
if(dijit.byId('layer0').checked) {
clipLayers.push('Bridges (Moveable)');
}
if(dijit.byId('layer1').checked) {
clipLayers.push('Building Permits');
}
if(dijit.byId('layer2').checked) {
clipLayers.push('Businesses');
}
if(dijit.byId('layer3').checked) {
clipLayers.push('Fire Stations');
}
if(dijit.byId('layer4').checked) {
clipLayers.push('Lifeguard Towers');
}
if(dijit.byId('layer5').checked) {
clipLayers.push('Ocean Buoys');
}
if(dijit.byId('layer6').checked) {
clipLayers.push('Section Points (Florida PLSS)');
}
if(dijit.byId('layer7').checked) {
clipLayers.push('Survey Benchmarks');
}
if(dijit.byId('layer8').checked) {
clipLayers.push('City Limits (Fort Lauderdale)');
}
//hzhu modified
if(clipLayers.length === 0 || graphics.length === 0) {
alert('Select layers to extract and area of interest');
return;
}
var features = [];
features.push(graphic);
var featureSet = new esri.tasks.FeatureSet();
featureSet.features = features;
var params = {
"Layers_to_Clip" : clipLayers,
"Area_of_Interest" : featureSet,
"Feature_Format" : dijit.byId('formatBox').value
}
esri.show(loading);
gp.submitJob(params, completeCallback, statusCallback, function(error) {
alert(error);
esri.hide(loading);
});
});
}
function completeCallback(jobInfo) {
if(jobInfo.jobStatus !== "esriJobFailed") {
gp.getResultData(jobInfo.jobId, "Output_Zip_File", downloadFile);
}
}
function statusCallback(jobInfo) {
var status = jobInfo.jobStatus;
if(status === "esriJobFailed") {
alert(status);
esri.hide(loading);
} else if(status === "esriJobSucceeded") {
esri.hide(loading);
}
}
function downloadFile(outputFile) {
map.graphics.clear();
var theurl = outputFile.value.url;
window.location = theurl;
}
//show map on load
dojo.addOnLoad(init);
You could try add "" on wkid. Theoretically { wkid : 2236} should be a json and should be written as {"wkid": 2236}. I just copy the outSR statement from one of my project and it does not cause any problems for me. I guess i have to take a second look when i add codes on forum!
... View more
01-03-2012
05:10 AM
|
0
|
0
|
1770
|
|
POST
|
Thanks Heming. I think conceptual your idea of projecting the AOI is the way to go. However, I don't know how to go about that from a technical standpoint. It would be easy if my AOI was an already established layer. In this case it is an interactive graphic that only exists once the user draws it. I don't know how to project those as I'm new to developing ArcGIS Server apps. I am including the code for the esri sample I modified to use our data and the online basemap. Note that the MapServer referenced in the code is now in my state plane SR, but that should be irrelevant. I can always re-create it to the SR I need to make the app function with the basemap (wkid:102100 I believe is also wkid: 4326). Thanks again for your generousity. <script type="text/javascript">
dojo.require("dijit.dijit"); // optimize: load dijit layer
dojo.require("dijit.layout.BorderContainer");
dojo.require("dojox.layout.FloatingPane");
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.form.CheckBox");
dojo.require("dijit.form.ComboBox");
dojo.require("esri.map");
var gp, map;
var loading;
var selectionToolbar;
var gsvc;
function init() {
esri.config.defaults.io.proxyUrl = "/arcgisserver/apis/javascript/proxy/proxy.ashx"; //need your own proxy loading = dojo.byId("loadingImg");
var initialExtent = new esri.geometry.Extent({ "xmin": -8931915.50, "ymin": 3011446.77, "xmax": -8914717.17, "ymax": 3022912.32, "spatialReference": { "wkid": 102100} });
map = new esri.Map("map", {
extent: initialExtent
});
map = new esri.Map("map");
dojo.connect(map, 'onLoad', function(map) {
initSelectionToolbar();
//resize the map when the browser resizes
dojo.connect(dijit.byId('map'), 'resize', map,map.resize);
});
//var basemapUrl = "http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer";
//var basemap = new esri.layers.ArcGISTiledMapServiceLayer(basemapUrl);
//map.addLayer(basemap);
var homelandSecurity = new esri.layers.ArcGISDynamicMapServiceLayer("http://gis.fortlauderdale.gov/ArcGIS/rest/services/AppsITS/DataExtractionDownloads/MapServer");
map.addLayer(homelandSecurity);
gsvc = new esri.tasks.GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"); gp = new esri.tasks.Geoprocessor("http://gis.fortlauderdale.gov/ArcGIS/rest/services/AppsITS/DataExtractionDownloads/GPServer/Extract%20Data%20Task");
// don't need if you results are in state plate SR gp.setOutSpatialReference({wkid:102100});
var basemapUrl = "http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer";
var basemap = new esri.layers.ArcGISTiledMapServiceLayer(basemapUrl);
map.addLayer(basemap);
}
function initSelectionToolbar(myMap){
selectionToolbar = new esri.toolbars.Draw(map);
dojo.connect(selectionToolbar, "onDrawEnd", function(geometry) {
selectionToolbar.deactivate();
var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, 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 graphic = new esri.Graphic(geometry, symbol);
map.graphics.add(graphic);
});
}
function activateTool(type){
selectionToolbar.activate();
}
function extractData(){
var outSR = new esri.SpatialReference({ wkid: 2236});
gsvc.project([ map.graphics.graphics[0] ], outSR, function(graphics) {
var graphic =graphics[0]; //get clip layers
var clipLayers = [];
if (dijit.byId('layer0').checked) { clipLayers.push('Bridges (Moveable)'); }
if (dijit.byId('layer1').checked) { clipLayers.push('Building Permits'); }
if (dijit.byId('layer2').checked) { clipLayers.push('Businesses'); }
if (dijit.byId('layer3').checked) { clipLayers.push('Fire Stations'); }
if (dijit.byId('layer4').checked) { clipLayers.push('Lifeguard Towers'); }
if (dijit.byId('layer5').checked) { clipLayers.push('Ocean Buoys'); }
if (dijit.byId('layer6').checked) { clipLayers.push('Section Points (Florida PLSS)'); }
if (dijit.byId('layer7').checked) { clipLayers.push('Survey Benchmarks'); }
if (dijit.byId('layer8').checked) { clipLayers.push('City Limits (Fort Lauderdale)'); }
if(clipLayers.length === 0 || graphics.length === 0){
alert('Select layers to extract and area of interest');
return;
}
var features =[];
features.push(graphic);
var featureSet = new esri.tasks.FeatureSet();
featureSet.features = features;
var params = {"Layers_to_Clip":clipLayers,
"Area_of_Interest": featureSet,
"Feature_Format": dijit.byId('formatBox').value
}
esri.show(loading);
gp.submitJob(params, completeCallback , statusCallback,function(error){
alert(error);
esri.hide(loading);
});
});
}
function completeCallback(jobInfo){
if(jobInfo.jobStatus !== "esriJobFailed"){
gp.getResultData(jobInfo.jobId,"Output_Zip_File", downloadFile);
}
}
function statusCallback(jobInfo) {
var status = jobInfo.jobStatus;
if(status === "esriJobFailed"){
alert(status);
esri.hide(loading);
}
else if (status === "esriJobSucceeded"){
esri.hide(loading);
}
}
function downloadFile(outputFile){
map.graphics.clear();
var theurl = outputFile.value.url;
window.location = theurl;
}
//show map on load
dojo.addOnLoad(init);
</script> I modified part of code to include the logice to transfer your aoi to state plate. you might need to reorginalize or debug you code. Hope it will give you a hint. You might also need to use your own proxy.
... View more
12-30-2011
10:01 AM
|
0
|
0
|
2279
|
| 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
|