POST
|
I'm using Python 2.7 with a stand-alone server running ArcGIS Server 10.7. I would like to be able to delete an image service in my Python code and I saw that one can do this with a POST request to the ArcGIS REST API. I've never used this before so I'm not familiar with the syntax. I'm trying the code below to delete an image service "test2" - it runs successfully but the service is not deleted. However I can delete the service manually. Does anyone know why the code doesn't work? Thanks! import requests
data = {
'username': 'my username here',
'password': 'my password here'
}
requests.post(url="http://mobjack.vims.edu:6080/arcgis/admin/services/VIMS_CCRM/test2.ImageServer/delete", data=data)
... View more
10-18-2019
08:01 AM
|
0
|
0
|
442
|
POST
|
I'm having the same issue (trying to label axes with a multiple series chart). I tried Ben's method above using overrides. The x-axis was labeled from the categoryAxis setting but not the y-axis from the valueAxis setting. Is there a problem with my syntax? Thanks! var datasets = [
{
"data": table,
"name": "water elevation series"
}
];
var series = [
{
"category": {"field": "timeTable"},
"value": {"field": "waterElevationTable", "label": "Water elevation (feet"},
"source": "water elevation series"
},
{
"category": {"field": "timeTable"},
"value": {"field": "landElevationTable", "label": "Land elevation (feet)"},
"source": "water elevation series"
}
];
var overrides = {
"categoryAxis": {"title": "Time (hours)"},
"valueAxis": {"title": "Elevation (feet)"}
}
... View more
04-23-2019
10:32 AM
|
0
|
0
|
1680
|
POST
|
Thanks Evelyn, I overlooked this, hopefully it's what I need!
... View more
03-18-2019
07:03 AM
|
1
|
0
|
505
|
POST
|
hi all, I need to a extract the value for a particular field in a feature layer when a user clicks on a given feature. I don't need to display the field value in a popup but just to use that value elsewhere in my code. I'm assuming I need to define a feature layer but not sure on the rest. I see examples extracting field values using a (feature layer).on { } event listener and then displaying the values in a popup with this "$" notation. But I don't think this is what I'm looking for. I also see there's a QueryTask object that returns a FeatureSet and presumably I can extract the value from that, but I can't find an example that shows the precise syntax. Appreciate any help, thanks! Dan
... View more
03-15-2019
08:56 AM
|
0
|
2
|
578
|
POST
|
thanks Earl, I was able to find a work-around because testing revealed that the alert pops up right after the UploadServiceDefinition (publishing line) so the service is still being published. Then I can kill the popup by killing the automated task after a set period. But it would be nice to know why it happens, I'll try the 6443. Thanks again..
... View more
07-25-2018
11:33 AM
|
0
|
0
|
501
|
POST
|
hi all, I have a Python script that publishes an image service. I want to automate it to run daily but when it gets to the line that actually publishes the service it gives a popup alert as follows: "A secure connection with this site cannot be verified. Would you still like to proceed? The certificate you are viewing does not match the name of the site you are trying to view" I need to manually click the "Yes" button to finish the publication and continue the code, and this prevents the automation I'm trying to accomplish. The name of the ArcGIS Server I'm publishing to is "arcgis on mobjack.vims.edu_6080 (publisher)" and the certificate is issued to: *.vims.edu. Don't know if the _6080 suffix has anything to do with it but I don't know if it's possible to change that anyway. Does anyone know how to resolve this? Thanks!
... View more
07-13-2018
11:33 AM
|
0
|
2
|
664
|
POST
|
This is basically a repost of a previous question. I thought I resolved it but I did not. In one large script, I am generating a floating point TIF raster through a couple of raster operations. I do this multiple times to generate multiple TIF floating point rasters. I then create a file geodatabase and try to copy these TIF rasters into that file geodatabase with RasterToGeodatabase. Basically the output rasters are becoming the input of the RasterToGeodatabase. But the copied rasters in the file geodatabase are corrupted - no cell size or extent or range, and nothing is displayed. . If I close and re-open the Python session and just create the file geodatabase and use the RasterToGeodatabase command (without running the whole script), those TIF rasters copy just fine into the file geodatabase. So I'm thinking it has something to do with the larger Python script locking on to the TIF rasters that were just created in the script, so I can't operate on them. Thanks for any help.. outFilePath = "C:/SCHISM_project/output_test_FGDB"
outFile = "Final_" + rasterTimeString + ".tif"
# Generate final rasters by mosaicing rasters and then Con to extract non-zero values
arcpy.MosaicToNewRaster_management(rastersListString, outFilePath, outFile, "#", "32_BIT_FLOAT", "#", "1", "LAST", "FIRST")
testMosaic = Raster(outFilePath + "/" + outFile)
testMosaicCon = Con(testMosaic <> 0, testMosaic)
testMosaicCon.save("C:/SCHISM_project/output_test_FGDB/Final_" + rasterTimeString + "_Con.tif")
# Create file geodatabase
todaysDateString = datetime.date.today().strftime("%Y%m%d")
out_folder_path = "Y:/SCHISM_Data"
out_name = "SCHISM_Data_" + todaysDateString + ".gdb"
arcpy.CreateFileGDB_management(out_folder_path, out_name)
# Create list of rasters
arcpy.env.workspace = "C:/SCHISM_project/output_test_FGDB"
rasterList = arcpy.ListRasters("*Con*")
rasterPathList = []
for eachRaster in rasterList:
rasterPathList.append(eachRaster)
finalRasterPathList = (";".join((i for i in rasterPathList)))
# Copy final rasters into file geodatabase on mobjack..."
arcpy.RasterToGeodatabase_conversion(finalRasterPathList, out_folder_path + "/" + out_name)
... View more
03-21-2018
08:06 AM
|
0
|
1
|
442
|
POST
|
The issue seems to have been with this particular machine, don't know if it was a memory issue maybe?. I simply restarted and now that's working fine...just hope this is a one-off. Thanks for your time Dan..
... View more
03-20-2018
12:32 PM
|
1
|
0
|
162
|
POST
|
I tried it on another machine and it works. So there's something peculiar going on with this particular machine.
... View more
03-20-2018
12:19 PM
|
0
|
3
|
1130
|
POST
|
Single band, just tried to copy another TIF, same bad result. I'll try the different path notation and get back to you. Thanks!
... View more
03-20-2018
12:01 PM
|
0
|
1
|
1130
|
POST
|
Thanks Dan, I've crystallized the problem much more. Now, as a test, I'm simply trying to get a floating point TIF raster into a file geodatabase : import arcpy
arcpy.RasterToGeodatabase_conversion("C:/SCHISM_project/output_test_FGDB/test_Manual.tif", "C:/test.gdb") The resulting flie geodatabase raster is corrupted as described above. But I can import it manually just fine. I'm stumped.
... View more
03-20-2018
11:42 AM
|
0
|
7
|
1130
|
POST
|
hi, I'm just trying to copy TIF rasters into a file geodatabase that I create. But the copied rasters in the new file geodatabase are corrupted. The corrupted rasters have no cell size in the properties and no statistics and they show that default range of -3.4e+038 to 3.4e+038. Calculating statistics on them gives an error. At first I thought the input list to the RasterToGeodatabase tool might be the problem but it looked looked fine (raster names separated by semicolons). But even when I try to copy a single raster, it gets corrupted. This seems pretty straightforward, can't imagine what I'm doing wrong. Thanks for any help... import arcpy
from arcpy.sa import *
import datetime
arcpy.CheckOutExtension("Spatial")
todaysDateString = datetime.date.today().strftime("%Y%m%d")
out_folder_path = "Y:\\SCHISM_Data"
out_name = "SCHISM_Data_" + todaysDateString + "_test_FGDB_extractCode.gdb"
arcpy.CreateFileGDB_management(out_folder_path, out_name)
arcpy.env.workspace = "C:\\SCHISM_project\\output_test_FGDB"
rasterList = arcpy.ListRasters("*Con*")
rasterPathList = []
for eachRaster in rasterList:
rasterPathList.append(eachRaster)
finalRasterPathList = (";".join((i for i in rasterPathList)))
arcpy.RasterToGeodatabase_conversion(finalRasterPathList, out_folder_path + "\\" + out_name)
... View more
03-19-2018
09:07 AM
|
0
|
10
|
1787
|
POST
|
I'm using the code below to publish an image service, works fine. But I need to be able to delete the existing service before creating the new one with the same name (or alternatively I'd like to overwrite the existing one with the new one). Does anyone know the proper code to delete an image service, or else the required adjustment to have this overwrite the existing image service? Thanks! Dan import arcpy
import os
# Define local variables:
MDWorkspace = "K:\Image Server Cache\VIMS\CCRM" # the folder for mosaic dataset and the service defintion draft file
ConnectionFileWorkspace = "C:\Users\dschatt\AppData\Roaming\ESRI\Desktop10.5\ArcCatalog"
GdbName="SCHISM_Data.gdb"
GDBpath = os.path.join(MDWorkspace,GdbName) #File geodatabase used to store a mosaic dataset
Name = "SCHISM_Data"
Md = os.path.join(GDBpath, Name)
Sddraft = os.path.join(MDWorkspace, Name + ".sddraft")
Sd = os.path.join(MDWorkspace, Name + ".sd")
con = os.path.join(ConnectionFileWorkspace, "arcgis on mobjack.vims.edu_6080 (publisher).ags")
print "Creating SD draft"
arcpy.CreateImageSDDraft(Md, Sddraft, "SCHISM_48HoursData", 'ARCGIS_SERVER', con, False, "VIMS_CCRM", None, "SCHISM, 48HoursData")
arcpy.StageService_server(Sddraft, Sd)
arcpy.UploadServiceDefinition_server(Sd, con)
print "Service successfully published"
... View more
02-22-2018
01:19 PM
|
1
|
0
|
467
|
Title | Kudos | Posted |
---|---|---|
1 | 02-13-2018 01:31 PM | |
1 | 03-18-2019 07:03 AM | |
1 | 03-20-2018 12:32 PM | |
1 | 02-22-2018 01:19 PM | |
1 | 09-14-2017 07:51 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|