gp = new esri.tasks.Geoprocessor("http://maps.lynxinfo.co.uk:8080/LIVE/services/UKOGL/UKOGLTools/GPServer/Extract Data Task"); gp.setOutSpatialReference({wkid:27700});
I am also working on same king of application If you find a solution can you please share
Alex,
Did you ever figure out how to use a query to clip the data? I am in need of this too. Thanks.
Alex, you may want to make a new thread for your question. This thread is many years old.
Yes!!! you are on the right track. Use GeometryService's buffer method to create buffer polygons instead. Here is doc you can look at: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/geometryservice.htm
gp = new Geoprocessor("http://sampleserver4.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/Incident_Data_Extraction/GPServer/Extract Data Task"); gp.setOutSpatialReference({wkid:102100}); registry.byId("polygon").on("click", function() { activateTool(this.id); }); registry.byId("freehandpolygon").on("click", function() { activateTool(this.id); }); registry.byId("extract").on("click", extractData); registry.byId("Query").on("click", executeQueryTask); function initSelectionToolbar() { map.graphics.clear(); selectionToolbar = new Draw(map); selectionToolbar.on("draw-end", function(e) { selectionToolbar.deactivate(); var symbol = new SimpleFillSymbol( "solid", new SimpleLineSymbol("dash", new Color([255,0,0]), 2), new Color([255,255,0,0.25]) ); var graphic = new Graphic(e.geometry, symbol); map.graphics.add(graphic); }); } function activateTool(tool) { map.graphics.clear(); // The draw.activate expects a string like "polygon" or "freehand_polygon". selectionToolbar.activate(tool); } function extractData(){ //get clip layers var clipLayers = []; if ( registry.byId("layer1").get("checked") ) { clipLayers.push("Incident Points"); } if ( registry.byId("layer2").get("checked") ) { clipLayers.push("Incident Lines"); } if ( registry.byId("layer3").get("checked") ) { clipLayers.push("Incident Areas"); } if ( clipLayers.length === 0 || map.graphics.graphics.length === 0 ) { alert("Select layers to extract and draw an area of interest."); return; } } function executeQueryTask() { //variable that calls the textbox value var type = document.getElementById("textbox").value; var queryTask = new QueryTask("http://webgisdevint1/arcgis/rest/services/Alex_Try/Counties/MapServer/0"); //Your county feature service var query = new Query(); query.returnGeometry = true; query.outFields = ["FMNAME_UC"]; //Your county name field in your feature service query.where = "FMNAME_UC = 'SISKIYOU COUNTY'"; //If you want a result handler function, just replace that here queryTask.execute(query, function(featureSet){ //This is designed to get the FIRST feature graphic as a JSON in the return because I am assuming you only have one county with that name var params = { "Layers_to_Clip": clipLayers, "Feature_Format": registry.byId("formatBox").get("value") }; if (featureSet.features.length > 0) { params.Area_of_Interest = featureSet.features[0].geometry; } else { params.Area_of_Interest = map.graphics.graphics[0].geometry; } domStyle.set(loading, "display", "inline-block"); gp.submitJob(params, completeCallback , statusCallback, function(error){ alert(error); domStyle.set(loading, "display", "none"); }); }); }
None of the features that I am selecting via the querytask are polygons. They are points and polylines. I think from what I now understand that I need a way of taking these and creating a creating a small buffer around them individually to create polygons, and then using these polygons to create a Multipolygon Ring FeatureSet to pass as the AOI for the ExtractDataTask. Am I correct in thinking this? And if so how can I use the buffer gp task as this too needs a geometry for its input?Many thanks,Ben
If all your graphics in your map.graphics are polygons, all you need to do push every graphic into clipFeatureSet like this:var clipFeatureSet = new esri.tasks.FeatureSet();var clipFeature =[];forEach(map.graphics.graphics, function(graphic)(//if (graphic.geometry.type ="polygon")clipFeature.push (graphic);));clipFeatureSet.features = clipFeature;The most important thing is make sure that each feature (graphic) in AOI featureset has to be a feature with geometry type as "polygon". Usually you either draw or specify certain polygon graphic(s) as your AOI instead of using all the grahics on your map as AOI. You really need to look at the ESRI sample to understand how to set up your AOI parameter. http://help.arcgis.com/en/webapi/jav...clipasync.htmlAdditionally, from what i understand is you add all query results on the map and want to download them. what you should do is to create a extent that cover all the results and then use this extent to create a featureset:var graphic= new esri.Graphic(esri.graphicsExtent(results.features));var clipFeatureSet = new esri.tasks.FeatureSet();var clipFeature =[];clipFeature.push (graphic);clipFeatureSet.features = clipFeature;
Thank you for your explanation. One more quick question:Say I have a group of lines like a tic tac toe grid and I only want the vertical lines by doing what you say won't this also select the horizontal lines too?
what you should do is to create a extent that cover all the results and then use this extent to create a featureset
Sorry to be really basic but I can see how you've taken this from the Tomcat error I have pasted, but how to I get create this using the JavaScript API? IS there a way I can set the featureSet explicitly as a polygon? As this is what is creating the polylinevar clipFeatureSet = new esri.tasks.FeatureSet(); var graphic = new esri.Graphic(); graphic.geometry = esri.graphicsExtent(map.graphics.graphics); clipFeature.push(graphic); clipFeatureSet.features = clipFeature;DO I need to add the Polygon extent to the map.graphics?
var clipFeatureSet = new esri.tasks.FeatureSet(); var graphic = new esri.Graphic(); graphic.geometry = esri.graphicsExtent(map.graphics.graphics); clipFeature.push(graphic); clipFeatureSet.features = clipFeature;
From you code, i create a featureSet json like this:{"features" :[{ "geometry" :{"rings" : [[[125125.00000000006, 856615], [125077.00000000012, 856599.0000000006], [124837.00000000017, 856536.0000000001], [124595.00000000006, 856481.0000000005], [124570.00000000017, 856473.0000000008], [125125.00000000006, 856615]]]}}]}Put it into your AOI parameter at your service url: http://maps.lynxinfo.co.uk:8080/LIVE/services/UKOGL/ClipAndShip/GPServer/Extract%20Data%20Task/submitJob. Test it. if your AOI set up is OK, you should get some results.
Hzhu,I am unable to get a polygon featureSet using esri.graphicsExtent(map.graphics). Is there another way I can try?Many thanks,Ben
your AOI parameter has to be a featureSet with Geometry type as POLYGON!!. Looked at your code and your clipFeature's geometryType is esriGeometryPolyline !! ( {"geometryType":"esriGeometryPolyline","features":[{"geometry":{"paths":[[[125125.00000000006,856615],[125077.00000000012,856599.0000000006],[124837.00000000017,856536.0000000001],[124595.00000000006,856481.0000000005],[124570.00000000017,856473.0000000008]]],"spatialReference":{"wkid":27700}},"attributes":{"UKOGL_LINE_REF":18096,"LINE_NAME":"LB-1A"}}],"sr":{"wkid":27700}} )
I've still not got this working, I feel like I've been banging my head against brick wall for well over a week now. I have tried re-writing my JavaScript Page and I have also re-published the geoprocessing task to the server again but I'm not getting anywhere.The link to my Geoprocessing task is: http://maps.lynxinfo.co.uk:8080/LIVE/services/UKOGL/ClipAndShip/GPServer/Extract%20Data%20TaskThe link to my dataset is:http://maps.lynxinfo.co.uk:8080/LIVE/services/UKOGL/UKOGL_vers3/MapServerThe code I am not rying to run is:function qtResults(fset){ var resultFeatures = fset.features; var fLineSymbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH, new dojo.Color([255, 0, 0]), 3); for (var i = 0, il = resultFeatures.length; i < il; i++) { var graphic = resultFeatures; graphic.setSymbol(fLineSymbol); map.graphics.add(graphic); clipFeature.push(graphic) } clipFeatureSet.features = clipFeature; var dlFormat = 'Shapefile - SHP - .shp'; params2 = { "Layers_to_Clip": clipLayers, "Area_of_Interest": clipFeatureSet, "Feature_Format": dlFormat } } function action(){ esri.show(loading); if (confirm('Ready to Download?')) { gp.submitJob(params2, completeCallback, statusCallback, function(error){ alert(error); esri.hide(loading) }); } } function download(){ var seismicCount = (jQuery("#selectedSeismicTable").getGridParam("reccount")); var wellCount = (jQuery("#selectedWellTable").getGridParam("reccount")); var rpCount = (jQuery("#selectedRPTable").getGridParam("reccount")); if (seismicCount > 0) { clipLayers.push('2D Seismic'); for (i = 1; i < seismicCount + 1; i++) { var ref = $('#selectedSeismicTable').getCell(i, 1); //alert(ref); //doFind(ref); twoDQuery.where = "UKOGL_LINE_REF = "+ref; //alert(twoDQuery.where); twoDQueryTask.execute(twoDQuery,qtResults); } }; if (rpCount > 0) { clipLayers.push('Regional Profiles'); for (i = 1; i < rpCount + 1; i++) { var ref = $('#selectedRPTable').getCell(i, 1); // alert(ref); doFind(ref); } }; if (wellCount > 0) { clipLayers.push('Wells'); for (i = 1; i < wellCount + 1; i++) { var ref = $('#selectedWellTable').getCell(i, 1); // alert(ref); doFind(ref); } }; }The error I am getting from my Tomcat error log is:13-May-2011 16:48:57 com.esri.rest.gpserver.GPUtil a SEVERE: Invalid param value: {"geometryType":"esriGeometryPolyline","features":[{"geometry":{"paths":[[[125125.00000000006,856615],[125077.00000000012,856599.0000000006],[124837.00000000017,856536.0000000001],[124595.00000000006,856481.0000000005],[124570.00000000017,856473.0000000008]]],"spatialReference":{"wkid":27700}},"attributes":{"UKOGL_LINE_REF":18096,"LINE_NAME":"LB-1A"}}],"sr":{"wkid":27700}} com.esri.rest.util.json.JSONException: JSONObject["rings"] not found. at com.esri.rest.util.json.JSONObject.get(JSONObject.java:372) at com.esri.rest.util.json.JSONObject.getJSONArray(JSONObject.java:448) at com.esri.rest.ags.AGSUtil.getGeometry(AGSUtil.java:791) at com.esri.rest.ags.AGSUtil.getGeometry(AGSUtil.java:745) at com.esri.rest.gpserver.GPUtil.a(GPUtil.java:197) at com.esri.rest.gpserver.GPUtil.createGPFeatureRecordSetLayer(GPUtil.java:105) at com.esri.rest.gpserver.GPTaskServlet.a(GPTaskServlet.java:1014) at com.esri.rest.gpserver.GPTaskServlet.a(GPTaskServlet.java:748) at com.esri.rest.gpserver.GPTaskServlet.service(GPTaskServlet.java:118) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:364) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301) at com.esri.rest.gpserver.GPServerServlet.service(GPServerServlet.java:69) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:364) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301) at com.esri.rest.catalog.CatalogServlet.service(CatalogServlet.java:181) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:364) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301) at com.esri.rest.DispatchServlet.service(DispatchServlet.java:117) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.esri.rest.security.SecurityFilter.doFilter(SecurityFilter.java:77) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.esri.rest.RestFilter.doFilter(RestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:393) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689) at java.lang.Thread.run(Unknown Source) 13-May-2011 16:48:57 com.esri.rest.gpserver.GPTaskServlet a SEVERE: Unable to create the GP Value for parameter 'Area_of_Interest'
function qtResults(fset){ var resultFeatures = fset.features; var fLineSymbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH, new dojo.Color([255, 0, 0]), 3); for (var i = 0, il = resultFeatures.length; i < il; i++) { var graphic = resultFeatures; graphic.setSymbol(fLineSymbol); map.graphics.add(graphic); clipFeature.push(graphic) } clipFeatureSet.features = clipFeature; var dlFormat = 'Shapefile - SHP - .shp'; params2 = { "Layers_to_Clip": clipLayers, "Area_of_Interest": clipFeatureSet, "Feature_Format": dlFormat } } function action(){ esri.show(loading); if (confirm('Ready to Download?')) { gp.submitJob(params2, completeCallback, statusCallback, function(error){ alert(error); esri.hide(loading) }); } } function download(){ var seismicCount = (jQuery("#selectedSeismicTable").getGridParam("reccount")); var wellCount = (jQuery("#selectedWellTable").getGridParam("reccount")); var rpCount = (jQuery("#selectedRPTable").getGridParam("reccount")); if (seismicCount > 0) { clipLayers.push('2D Seismic'); for (i = 1; i < seismicCount + 1; i++) { var ref = $('#selectedSeismicTable').getCell(i, 1); //alert(ref); //doFind(ref); twoDQuery.where = "UKOGL_LINE_REF = "+ref; //alert(twoDQuery.where); twoDQueryTask.execute(twoDQuery,qtResults); } }; if (rpCount > 0) { clipLayers.push('Regional Profiles'); for (i = 1; i < rpCount + 1; i++) { var ref = $('#selectedRPTable').getCell(i, 1); // alert(ref); doFind(ref); } }; if (wellCount > 0) { clipLayers.push('Wells'); for (i = 1; i < wellCount + 1; i++) { var ref = $('#selectedWellTable').getCell(i, 1); // alert(ref); doFind(ref); } }; }
13-May-2011 16:48:57 com.esri.rest.gpserver.GPUtil a SEVERE: Invalid param value: {"geometryType":"esriGeometryPolyline","features":[{"geometry":{"paths":[[[125125.00000000006,856615],[125077.00000000012,856599.0000000006],[124837.00000000017,856536.0000000001],[124595.00000000006,856481.0000000005],[124570.00000000017,856473.0000000008]]],"spatialReference":{"wkid":27700}},"attributes":{"UKOGL_LINE_REF":18096,"LINE_NAME":"LB-1A"}}],"sr":{"wkid":27700}} com.esri.rest.util.json.JSONException: JSONObject["rings"] not found. at com.esri.rest.util.json.JSONObject.get(JSONObject.java:372) at com.esri.rest.util.json.JSONObject.getJSONArray(JSONObject.java:448) at com.esri.rest.ags.AGSUtil.getGeometry(AGSUtil.java:791) at com.esri.rest.ags.AGSUtil.getGeometry(AGSUtil.java:745) at com.esri.rest.gpserver.GPUtil.a(GPUtil.java:197) at com.esri.rest.gpserver.GPUtil.createGPFeatureRecordSetLayer(GPUtil.java:105) at com.esri.rest.gpserver.GPTaskServlet.a(GPTaskServlet.java:1014) at com.esri.rest.gpserver.GPTaskServlet.a(GPTaskServlet.java:748) at com.esri.rest.gpserver.GPTaskServlet.service(GPTaskServlet.java:118) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:364) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301) at com.esri.rest.gpserver.GPServerServlet.service(GPServerServlet.java:69) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:364) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301) at com.esri.rest.catalog.CatalogServlet.service(CatalogServlet.java:181) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:364) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301) at com.esri.rest.DispatchServlet.service(DispatchServlet.java:117) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.esri.rest.security.SecurityFilter.doFilter(SecurityFilter.java:77) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.esri.rest.RestFilter.doFilter(RestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:393) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689) at java.lang.Thread.run(Unknown Source) 13-May-2011 16:48:57 com.esri.rest.gpserver.GPTaskServlet a SEVERE: Unable to create the GP Value for parameter 'Area_of_Interest'
I tried that and unfortunately I still can't get this working. I know have a layer in my MXD called AOI with the SRID 27700 and I have used this as the Import schema and symbology from part of the Extract Data Task model.Using Firebug, I think the problem is with passing the AOI geometry from the graphics. Is this the way to do it: function showTResults(results){ dojo.forEach(results, function(result) { var graphic = result.feature; var fMarkerSymbol = 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 fLineSymbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH, new dojo.Color([255, 0, 0]), 3); var fPolygonSymbol = 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])); switch (graphic.geometry.type) { case "point": graphic.setSymbol(fMarkerSymbol); break; case "polyline": graphic.setSymbol(fLineSymbol); break; case "polygon": graphic.setSymbol(fPolygonSymbol); break; } map.graphics.add(graphic); }) ext = esri.graphicsExtent(graphics); function doFind(textSearch) { params.searchText = textSearch; find.execute(params, showTResults); } function download(){ var clipLayers = []; var seismicCount = (jQuery("#selectedSeismicTable").getGridParam("reccount")); var wellCount = (jQuery("#selectedWellTable").getGridParam("reccount")); var rpCount = (jQuery("#selectedRPTable").getGridParam("reccount")); if (seismicCount > 0) { clipLayers.push('2D Seismic'); for (i = 1; i < seismicCount + 1; i++) { var ref = $('#selectedSeismicTable').getCell(i, 1); //alert(ref); doFind(ref); } }; if (rpCount > 0) { clipLayers.push('Regional Profiles'); for (i = 1; i < rpCount + 1; i++) { var ref = $('#selectedRPTable').getCell(i, 1); // alert(ref); doFind(ref); } }; if (wellCount > 0) { clipLayers.push('Wells'); for (i = 1; i < wellCount + 1; i++) { var ref = $('#selectedWellTable').getCell(i, 1); // alert(ref); doFind(ref); } }; var dlFormat = 'Shapefile - SHP - .shp'; var params2 = { "Layers_to_Clip": clipLayers, "Area_of_Interest": ext, "Feature_Format": dlFormat } esri.show(loading); gp.submitJob(params2, completeCallback, statusCallback, function(error){ alert(error); esri.hide(loading) }); } Thank you for your continued help. I know I'm so close to getting this working but somethings not quite right.
function showTResults(results){ dojo.forEach(results, function(result) { var graphic = result.feature; var fMarkerSymbol = 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 fLineSymbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASH, new dojo.Color([255, 0, 0]), 3); var fPolygonSymbol = 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])); switch (graphic.geometry.type) { case "point": graphic.setSymbol(fMarkerSymbol); break; case "polyline": graphic.setSymbol(fLineSymbol); break; case "polygon": graphic.setSymbol(fPolygonSymbol); break; } map.graphics.add(graphic); }) ext = esri.graphicsExtent(graphics); function doFind(textSearch) { params.searchText = textSearch; find.execute(params, showTResults); } function download(){ var clipLayers = []; var seismicCount = (jQuery("#selectedSeismicTable").getGridParam("reccount")); var wellCount = (jQuery("#selectedWellTable").getGridParam("reccount")); var rpCount = (jQuery("#selectedRPTable").getGridParam("reccount")); if (seismicCount > 0) { clipLayers.push('2D Seismic'); for (i = 1; i < seismicCount + 1; i++) { var ref = $('#selectedSeismicTable').getCell(i, 1); //alert(ref); doFind(ref); } }; if (rpCount > 0) { clipLayers.push('Regional Profiles'); for (i = 1; i < rpCount + 1; i++) { var ref = $('#selectedRPTable').getCell(i, 1); // alert(ref); doFind(ref); } }; if (wellCount > 0) { clipLayers.push('Wells'); for (i = 1; i < wellCount + 1; i++) { var ref = $('#selectedWellTable').getCell(i, 1); // alert(ref); doFind(ref); } }; var dlFormat = 'Shapefile - SHP - .shp'; var params2 = { "Layers_to_Clip": clipLayers, "Area_of_Interest": ext, "Feature_Format": dlFormat } esri.show(loading); gp.submitJob(params2, completeCallback, statusCallback, function(error){ alert(error); esri.hide(loading) }); }
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.
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
var clipFeatureSet = new esri.tasks.FeatureSet(); clipFeatureSet.setSpatialReference(27700)
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 Data Task"); gp.setOutSpatialReference({wkid:27700});Does anyone have any idea what I need to do to fix this?
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.