public static string UpdateFeatureService(Update update, string url)
        {
            //url something like this:
              //http://startups.maps.arcgis.com/sharing/content/users/edan/items/5570ba82478a4a2c994d7919a047b9fa/update

              JavaScriptSerializer jScriptSerializer = new JavaScriptSerializer();
              string transmissionString = jScriptSerializer.Serialize(update.text);

              string outString = string.Empty;
              string JSON = HttpWebRequestHelper(url, transmissionString, "http://startups.maps.arcgis.com/", out outString);
              return JSON;
        }
Ejemplo n.º 2
0
        private void UpdateData()
        {
            FieldInfo[] fldInfos = new FieldInfo[1]{new FieldInfo()
              {
            isEditable = false,
            stringFieldOption = "textbox",
            tooltip = "Field values pertaining to unique color ranges",
            label = "Unique Values",
            visible = true,
            fieldname = cboFields.Text
              }};

              UpdateLayer layer = new UpdateLayer()
              {
            id = 0,
            popupInfo = new PopupInfo()
            {
              showAttachments = false,
              fieldInfos = fldInfos,
              description = null,
              label = "Unique value renderer",
            }
              };

              Extent extent = new Extent()
              {
            xmin = -14999999.999999743,
            ymin = 1859754.5323447795,
            xmax = -6199999.999999896,
            ymax = 7841397.327701188,
            spatialReference = new SpatialReference() { wkid = 102100 },
              };

              Part part = new Part()
              {
            extent = extent,
            frameids = new int[] { 0 }
              };

              AnalysisInfo analysisInfoTEST = new AnalysisInfo()
              {
            toolName = "",
            jobParams = new JobParams()
            {
              InputLayer = new InputLayer()
              {//TODO input layer endpoint
            url = _arcgGISOnlineFeatureServiceURL + "/0", //"http://services.arcgis.com/q7zPNeKmTWeh7Aor/arcgis/rest/services/nyvoters_Party/FeatureServer/0",
            serviceToken = _arcgGISOnlineOrganizationToken
              },
              OutputName = new OutputName()
              {
            serviceProperties = new ServiceProperty()
            {
              name = "Unique_Values"
            },
            itemProperties = new ItemProperties()
            {
              itemID = _featureServiceCreationResponse.ServiceItemId,
            }
              },
              context = new Context()
              {
            extent = extent,
            parts = new Part[1] { part }
              }
            }
              };

              Update update = new AGOLRestHandler.Update()
              {
            title = txtFeatureServiceName.Text,
            description = string.Empty,
            tags = "",
            extent = extent,
            thumbnailURL = "http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/export?size=200,133&bboxSR=4326&format=png24&f=image&bbox=-161.697,-79.691,161.697,85",
            typeKeywords = "ArcGIS Server,Data,Feature Access,Feature Service,jobUrl:http://analysis.arcgis.com/arcgis/rest/services/tasks/GPServer/CreateBuffers/jobs/j6a67709cac1e4568a26d32568d01a695,Service,Hosted Service",
            text = new AGOLRestHandler.Text()
            {
              layers = new UpdateLayer[1] { layer },
              analysisInfo = analysisInfoTEST
            }
              };

              //
              string url = "http://startups.maps.arcgis.com/sharing/content/users/edan/items/" + _featureServiceCreationResponse.ServiceItemId + "/update";
              string jsontest = RequestAndResponseHandler.UpdateFeatureService(update, url);

              btnUpdate.Enabled = false;
        }