Cannot use published zonal stats geoprocessing service (Arcgis Java API)


I am primarily following this tutorial.

Here is the signature for the service used in the sample.

It is slightly different than the one I have had any success with, though if I recall correctly the version described below is the only one I could get to ever function.

I have once successfully created my own geoprocessing service that I can utilize no problem. It uses one of my .tif raster layers as input. This image is also published as an Image Service. The signature for this one looks as follows:

Task: CS1
Display Name: CS1

Description: (null)

Category:

Help URL: ……./arcgisoutput/CS1_GPServer/CS1/CS1.htm

Execution Type: esriExecutionTypeAsynchronous

Parameters:

Parameter: inputPoly
Data Type: GPString
Display Name inputPoly
Description: Area to analyze
Direction: esriGPParameterDirectionInput
Default Value: InputPolygonSample
Parameter Type: esriGPParameterTypeRequired
Category:
Choice List: [ InputPolygonSample ]
Parameter: statsSummary
Data Type: GPRecordSet
Display Name statsSummary
Description: Carbon Content of selected polygon
Direction: esriGPParameterDirectionOutput
Default Value:
Fields:
OBJECTID ( type: esriFieldTypeOID , alias: OBJECTID )
ID ( type: esriFieldTypeInteger , alias: ID )
COUNT ( type: esriFieldTypeInteger , alias: COUNT )
AREA ( type: esriFieldTypeSingle , alias: AREA )
MIN ( type: esriFieldTypeSingle , alias: MIN )
MAX ( type: esriFieldTypeSingle , alias: MAX )
RANGE ( type: esriFieldTypeSingle , alias: RANGE )
MEAN ( type: esriFieldTypeSingle , alias: MEAN )
STD ( type: esriFieldTypeSingle , alias: STD )
SUM ( type: esriFieldTypeSingle , alias: SUM )
Features: None.

Parameter Type: esriGPParameterTypeRequired
Category:

Supported Operations: Submit Job

When calling this service, I use the following methods successfully:

function initTools(evtObj) {
        gp = new Geoprocessor("..../arcgis /rest/services/CS1/GPServer/CS1");
        gp.setOutputSpatialReference({wkid:102100}); 
        gp.on("execute-complete", displayResults);
        gp.on("error", displayError);
        app.toolbar = toolbar = new Draw(evtObj.map);
        toolbar.on("draw-end", computeZonalStats);
    }

function computeZonalStats(evtObj) {
    var geometry = evtObj.geometry;
    /*After user draws shape on map using the draw toolbar compute the zonal*/
    map.showZoomSlider();
    map.graphics.clear();

    var symbol = new SimpleFillSymbol("none", new SimpleLineSymbol("dashdot", new Color([255,0,0]), 2), new Color([255,255,0,0.25]));
    var graphic = new Graphic(geometry,symbol);

    map.graphics.add(graphic);
    toolbar.deactivate();

    var features= [];
    features.push(graphic);

    var featureSet = new FeatureSet();
    featureSet.features = features;

    var params = { "inputPoly":featureSet };
    $("#calcCarbon").button("option", "label", "Calculation in Process...").button("refresh");
    gp.execute(params);
  }

I can process the results as desired.

Now, I am trying to change the image to be a mosaicked image. I create the same tool in ArcGIS, and as far as I remember (which may be fuzzy) use the exact same methods for publishing it.

The resulting signature looks as follows:

Task: CalculateB
Display Name: CalculateB

Description:

Category:

Help URL: …../arcgisoutput/CalculateB_GPServer/CalculateB/CalculateB.htm

Execution Type: esriExecutionTypeAsynchronous

Parameters:

Parameter: inputPoly
Data Type: GPString
Display Name inputPoly
Description: Area to analyze
Direction: esriGPParameterDirectionInput
Default Value: SampleInputPoly
Parameter Type: esriGPParameterTypeRequired
Category:
Choice List: [ SampleInputPoly ]
Parameter: statsSummary
Data Type: GPRecordSet
Display Name statsSummary
Description: Carbon Content of selected polygon
Direction: esriGPParameterDirectionOutput
Default Value:
Fields:
OBJECTID ( type: esriFieldTypeOID , alias: OBJECTID )
ID ( type: esriFieldTypeInteger , alias: ID )
COUNT ( type: esriFieldTypeInteger , alias: COUNT )
AREA ( type: esriFieldTypeSingle , alias: AREA )
MIN ( type: esriFieldTypeSingle , alias: MIN )
MAX ( type: esriFieldTypeSingle , alias: MAX )
RANGE ( type: esriFieldTypeSingle , alias: RANGE )
MEAN ( type: esriFieldTypeSingle , alias: MEAN )
STD ( type: esriFieldTypeSingle , alias: STD )
SUM ( type: esriFieldTypeSingle , alias: SUM )
Features: None.

Parameter Type: esriGPParameterTypeRequired
Category:

Supported Operations: Submit Job

When I try and run this service, using the exact same code as above simply substituting the URL for the Geoprocessor, I receive the following error almost instantly (it does not even seem to access my server for the error based on the speed of the response).

Error: Error performing execute operation
.cache["esri/request"]/</t/f.load()/3.7/ (line 772)
.cache["dojo/_base/xhr"]/</b._ioSetArgs/<()/3.7/ (line 184)
c()/3.7/ (line 74)
d()/3.7/ (line 74)  
()/3.7/ (line 75)
c()/3.7/ (line 74)
d()/3.7/ (line 74)
()/3.7/ (line 75) 
.cache["dojo/_base/xhr"]/</b.xhr/<()/3.7/ (line 188) 
.cache["dojo/Deferred"]/</l()/3.7/ (line 193)
.cache["dojo/Deferred"]/</r()/3.7/ (line 192)
()/3.7/ (line 195)
.cache["dojo/Deferred"]/</a()/3.7/ (line 193)
.cache["dojo/Deferred"]/</l()/3.7/ (line 193)
.cache["dojo/Deferred"]/</r()/3.7/ (line 192)
()/3.7/ (line 195)
.cache["dojo/Deferred"]/</a()/3.7/ (line 193)
...ost,w=e.crossOrigin):v=!!e);f=p.mixin({},f);f._ssl&&(f.url=f.url.replace(/^http:...

Throughout this process I have recreated and deleted the second service several times. I’ve noticed sometimes, if I didn’t change the name of the service, the signature did not update (I was fiddling with the different input types to try and get the two to match perfectly). I am continuing to test to see if possibly somehow an outdated version is being accessed.

My second mosaicked image is NOT published as an image service (though I think this shouldn’t matter). I also spent a long time working on getting that first service to work, so if the theory about outdated signatures is correct, it may not be exactly what I am being shown. However, previously when I had trouble getting the service to run, I would get a result back from the server stating invalid parameters or something similar, very different from this one which does not even seem to go there.

Does anyone know more specifically in what area I may be going wrong? All leads are greatly appreciated!

Is it possible to have run-time dynamic table updates to visualization using javascript interacting with postgis and geoserver


I have an idea of/have seen implementations, of dynamic map retrieval/updating using wms on openlayers by using updates to a postgis database which was hooked into geoserver and having a refresh policy. I have also seen examples done using cURL with php and python. Is this possible using JavaScript without using openlayers? The reason I don’t want to use openlayers is because my “base map” is a google earth plugin and I’ve heard they don’t really get along well.

In any case how would I update a postgis database which is connected to geoserver so that I can essentially move a point’s coordinates and display this accordingly? And I know that using geowebcache is how geoserver updates the databases it is connected to, but I have heard issues regarding this before as such what was the process for making sure geoserver updates? Preferably I’d like to do this in JavaScript without some kind of wrapper.

Loop – convert layer to raster coming up blank


I am looping through files, selecting out building footprints one by one and converting the selected building footprint to a raster. The script worked fine for about 2 hours this morning then stopped working. Suddenly all the rasters started coming up blank and I can’t figure out why. The script says its running successfully. Thoughts?

import arcpy, os, shutil
from arcpy import env
from arcpy.sa import*

#set workspaces
arcpy.env.workspace = "C:\ArcGIS\SurfCityData\Data" #arcpy.GetParameterAsText(0)
arcpy.env.overwriteOutput = True
outputWorkspace = "C:\ArcGIS\SurfCityData\Data\Scratch"   

# Check out the ArcGIS 3D Analyst extension license
arcpy.CheckOutExtension("3D")
arcpy.CheckOutExtension("Spatial")

#Variables
Year = "2005" #arcpy.GetParameterAsText()
Elevation = "C:\ArcGIS\SurfCityData\Data\LiDAR_DEM_2005\mosiac_2005"     
ObsPts = "C:\ArcGIS\SurfCityData\Data\test_pts2005_prj.shp" 
footprint =  "C:\ArcGIS\SurfCityData\Data\Footprints\BuildingFootprints_SC.shp"
Ocean = "C:\ArcGIS\SurfCityData\Data\AtlanticOcean.shp" #arcpy.GetParameterAsText()

#Set analysis extent to elevation raster
arcpy.env.extent = Elevation
#Create Featue Layers
PointsFL = outName(ObsPts,"_Layer")
footprintFL = outName(footprint,"_FL")
arcpy.MakeFeatureLayer_management(ObsPts, PointsFL)
arcpy.MakeFeatureLayer_management(footprint,footprintFL)

#Select observation points one by one
RangeCount = int(arcpy.GetCount_management(PointsFL).getOutput(0))
for points in range (0,RangeCount):
    FID = "FID=%s" % (points)

   #Change elevation of building footprint to zero for a selected obs. point

   arcpy.SelectLayerByAttribute_management(PointsFL,"NEW_SELECTION",FID)
   print "n", arcpy.GetMessages()
   arcpy.SelectLayerByLocation_management(footprintFL,"INTERSECT",PointsFL,"","NEW_SELECTION")
   print "n", arcpy.GetMessages()
   RastFootprint = outputWorkspace+"\fp_"+str(FID)[4:].split(".")[0]
   arcpy.PolygonToRaster_conversion(footprintFL,"FID",RastFootprint,"MAXIMUM_AREA")
   print "n", arcpy.GetMessages()

I haved tried coping the selected footprint feature to a new feature class and then converting that to a raster as well. The footprint copied to a feautre but still would not produce a raster even though the script says is running fine. I’ve tried this on two different machines, a personal laptop and a work machine with the same results.

I should also add that I’m testing the script on a set of 4 points so nothing that should be bogging down my system.

Clip geodatabase containing vector and raster data


I have a fairly large file geodatabase in ArcGIS 10.1 containing both vector and raster datasets. Generally, I only want to work on a small extent at a time. Is it possible to clip a geodatabase to a smaller extent to reduce its size on disk?

Why is pooled geoprocessing service not available via the ArcGIS Rest API?


I’m using ArcGIS Server 10.0.

I’ve published a pooled asynchronous python geoprocessing service. It works correctly using the Rest API.

When I configure the service not to be pooled, I can’t access it via the Rest API anymore. I get the following error:
Service ‘myService’ of type ‘GPServer’ does not exist or is inaccessible. Error code: 404.

Is this normal?

Below the Pooling tab of my service configuration:
enter image description here

Split polylines at polygon boundaries in QGIS


I have a set of contour lines and a polygon set containing glaciers.
Because I want the glaciers to have blue contours, I need to split the contour lines at the glacier boundaries.

I can achieve this using the following method:

1) Intersect the contours with the glacier polygon to create the glacier contours.
2) Create a spatial difference between the glacier polygon and an extent polygon.
3) Intersect the contours with the spatial difference from (2) to create the blue conoturs.
4) Merge the two results together if I want it in a single data set.

But the following method would be more convenient, and usable for other types of analyses as well.

1) Combine a polyline dataset (or point dataset for that matter) with a polygon dataset. The lines with be split at the polygon boundaries and each output line (or point) will take the attributes from the polygon it is inside.

Such a function would make my problem so much simpler to solve, as I can do it in one single operation.

Is there a function for this in QGIS?

Flex Viewer: How do I return a subset of the input data using the geoprocessing widget?


I have a set of point data (representing crashes) that has been published as a feature service and which I have pulled into a Flex (3.5) application. I want the users to be able to submit a query and create a subset of the original data – for example, to access all the crashes that occurred on a Tuesday, or which were fatal, etc.

To do this I have created a Geoprocessing widget based on a very simple model (Get expression, Select by attribute; copy features) that has been published as a GP service.

However, I haven’t been able to get the GP widget to work properly. Once run, it adds the output ‘Query’ layer to the layer list, but there are no features within that layer (ie, nothing on the map).

Geoprocessing Widget config file:

<?xml version="1.0"?>
<configuration label="Select by Attribute">
    <taskurl>http://ags-dev2:6080/arcgis/rest/services/CAS_Crashes/SelbyAttr/GPServer/SelbyAttr</taskurl>
    <shareresults>true</shareresults>
    <inputparams>
        <param name="Expression"
               label="Expression"
               required="false"
               type="string"
               visible="true">
        </param>
    </inputparams>
    <outputparams>
        <param name="Output"
               label="Query"
               type="featurerecordset"
               visible="true"
               geometrytype="point">
            <simplerenderer>
                <simplemarkersymbol color="0x2D9C49" width="4"/>
            </simplerenderer>
        </param>
    </outputparams>
</configuration>

Does anyone have any ideas about what I might need to change to bring the features through to the output layer?

I’m using ArcGIS Desktop 10.2, ArcGIS Server 10.2, Flex 3.5.

Thanks!

Geoprocessor Execute HRESULT COM Error


Recently, I started having problems with my C# projects running ArcGIS10.1 geoprocessing tools. My tools point to custom scripts in project toolboxes. The code in question has run without issue in the past.

However, something in my environment has changed and even the simplest code throws errors. Please see sample below. The code fails on gp.Execute(). I’ve triple checked, labels, names, paths, parameters etc.

I’ve tried every thing I can think of to track down this problem including re-installing Arc. I’m dead in the water if I can’t solve this nasty problem.

Thanks in Advance

    private void runTool()
    {
        try
        {

            Geoprocessor gp = new Geoprocessor();
            gp.AddToolbox(@"C:_TestTest.tbx");

            IVariantArray parameters = new VarArrayClass();
            parameters.Add(@"MyStringArg");

            // Execute the tool.
            gp.Execute("test", parameters, null);

        }
        catch (Exception ex)
        {
            System.Windows.Forms.MessageBox.Show(ex.Message, "TestGP Error", System.Windows.Forms.MessageBoxButtons.OK);
            return;
        }
    }

How to batch split feature classes using Arcpy?


I want to bath split analysis tool using Arcpy . I have some feature classes in a feature dataset.I want to Split All of feature classes uisng a shapefile but after split two feature classes, the runtime error raised( Runtime error : Failed to execute. Parameters are not valid. ERROR 000728: Field Province does not exist within table Failed to execute (Split)). My input feature has a province field and the result of the split is fine for a feature class but not for all of them .How can i solve the problem ? another qestion is that is there any way to change the output featureclasses? for example province name with underline featreclass name.
thanks for advance

import arcpy 
arcpy.env.workspace = "D:/split_test.gdb/split" 
fcl = arcpy.ListFeatureClasses() 
for fc in fcl:
    arcpy.Split_analysis("province",fc,"province","D:/output_split.gdb","")

What is correct entry to Input Location (GPFeatureRecordSetLayer)*?


I use:

http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Network/ESRI_DriveTime_US/GPServer/CreateDriveTimePolygons/execute

What is correct entry to Input Location (GPFeatureRecordSetLayer) ?

I try:

{"type": "Point","coordinates": [-105.01621,39.57422]}

but I get : “Invalid value for parameter ‘Input_Location’”

Question and Answer is proudly powered by WordPress.
Theme "The Fundamentals of Graphic Design" by Arjuna
Icons by FamFamFam