|
POST
|
Below a small example of a POST request. This did not work on my computer due to an authentication error, but that just might be my proxy (the server supposedly does not require a token (but you may in your case). More on getting a token here (include it in the params dictionary): ArcGIS Help 10.1
import urllib
import urllib2
# a list of non existing object id's (to avoid deletion of features)
oids = [37,101,462]
ids = ",".join([str(oid) for oid in oids])
print ids
# encode the parameters, only specifying the list of objectids (simple case)
params = urllib.urlencode({'f': 'json', 'objectIds':ids})
print params
# taking the sample HomelandSecurity URL (hoping this doesn't affect my visit to the DevSummit next year)
queryURL = "https://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/FeatureServer/0/deleteFeatures"
# use the request method on the urllib2 library
req = urllib2.Request(queryURL, params) # forces POST request (deleteFeatures can only be done with a POST request)
# get the response
response = urllib2.urlopen(req)
# assuming this query URL
jsonResult = json.load(response)
# do something with the response
print jsonResults
This will return a json list indicating the result of the deletion for each object id:
{
"deleteResults" : [
{
"objectId" : 37,
"globalId" : null,
"success" : false,
"error" :
{
"code" : -1,
"description" : "Delete for the object was not attempted. Object may not exist."
}
},
{
"objectId" : 101,
"globalId" : null,
"success" : false,
"error" :
{
"code" : -1,
"description" : "Delete for the object was not attempted. Object may not exist."
}
},
{
"objectId" : 462,
"globalId" : null,
"success" : false,
"error" :
{
"code" : -1,
"description" : "Delete for the object was not attempted. Object may not exist."
}
}
]}
Kind regards, Xander
... View more
11-11-2014
04:57 AM
|
1
|
4
|
2012
|
|
POST
|
Maybe it has something to do with this issue: Text data type and Length size problem Kind regards, Xander
... View more
11-10-2014
09:49 AM
|
0
|
1
|
4280
|
|
POST
|
ephem is a python module that doesn't come with ArcGIS: pyephem 3.7.5.3 : Python Package Index Welcome! — PyEphem home page The SunSkyMap tool you are running assumes the module is installed. Try installing the module and run the tool again. I assume the tool should come with some sort of documentation on prerequisites. Kind regards, Xander
... View more
11-09-2014
08:45 AM
|
1
|
0
|
1231
|
|
POST
|
Did you get any error message? How are your geoprocessing environments set? What spatial reference are you using, and what did you define as cell size? A little more info could help... Kind regards, Xander
... View more
11-09-2014
08:36 AM
|
0
|
2
|
860
|
|
POST
|
This is a very good suggestion (+1 for that), if you are the "owner" of the data and have administrative right on the service... Kind regards, Xander
... View more
11-07-2014
03:59 AM
|
0
|
0
|
2793
|
|
POST
|
Hi Brandon, You can use python and the REST API to execute a delete command: ArcGIS REST API This PDF provides some more info on interacting with the server using Python: http://proceedings.esri.com/library/userconf/proc14/tech-workshops/tw_187.pdf Kind regards, Xander
... View more
11-06-2014
06:29 PM
|
0
|
6
|
2012
|
|
POST
|
Normally services are configured by default to return only the first 1000 records. You can change the configuration of the service to return more features or if you don't have access to this configuration you can use for instance the REST interface to query records based on for instance the ObjectID: objectid > the highest objectid from the previous query. The query below queries the features starting from a certain objectid: Query Features (Earthquakes from last 7 days - Earthquakes/EarthquakesFromLastSevenDays) Using some Python code you can translate the url query to a featureclass:
import arcpy
fcout = r'path to your output featureclass'
url = 'http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/EarthquakesFromLastSevenDays/FeatureServer/0/query?objectIds=&where=objectid+%3E+224354126&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&relationParam=&outFields=*&returnGeometry=true&outSR=&returnIdsOnly=false&f=pjson'
fs = arcpy.FeatureSet()
fs.load(url)
arcpy.CopyFeatures_management(fs, fcout)
You should start with querying the entire service, store the result as featureclass, determine the highest objectid, and use that objectid in the next query. At the end merge the featureclasses... Kind regards, Xander
... View more
11-06-2014
11:00 AM
|
0
|
1
|
2793
|
|
POST
|
Hi Victoria, Sounds like an Esri grid... You can read more on Esri Grid formats here: ArcGIS Help (10.2, 10.2.1, and 10.2.2) Please note that a raster in Esri Grid format consists of various files and folders. There will normally be a folder with the name of the raster, which contains like 5-7 ADF files and you will have an info folder with arc*.* files. If there are not complete it is possible that you don't have all the files required for ArcGIS to recognize it as a raster. Kind regards, Xander
... View more
11-06-2014
10:10 AM
|
0
|
0
|
1880
|
|
POST
|
Hi Rosa Maria, Primero que todo, bienvenida a GeoNet y seguramente vas a aprender mucho en tu curso de SIG... Now back to English, this discussion that you posted sound like something you could post on your profile page by completing your profile:rosa maria cadena Kind regards, Xander Bakker Esri Colombia
... View more
11-06-2014
05:41 AM
|
0
|
0
|
458
|
|
POST
|
I don't have the parameters for you, but maybe this site helps you in defining the parameters: WGS 84 / UTM zone 16N - EPSG:32616 Kind regards, Xander
... View more
11-06-2014
05:30 AM
|
1
|
1
|
853
|
|
POST
|
Can you indicate what version and SP of ArcGIS you are using and indicate how large (how many features) the featureclasses are that you're using? Where and in what format is your input data stored? Are you using Background Processing (See Geoprocessing\Geoprocessing options)? Kind regards, Xander
... View more
11-06-2014
05:21 AM
|
0
|
2
|
1562
|
|
POST
|
What format is you DEM in? Could you specify the file name, format and source of the information? Kind regards, Xander
... View more
11-06-2014
05:15 AM
|
0
|
3
|
1880
|
|
POST
|
I suppose you are using the "Delete Features (Data Management)" tool to delete the features and the expression you showed is the one specified in that tool. When you use python the syntax can be different for the expression than the one you use in the dialog manually. In this case you specify "!LAST_EDITED_ON!" as the field. This produces an invalid syntax in Python. If you look at the Help, and scroll down to the second code sample, you see that the field is specified differently. They also use the arcpy.AddFieldDelimiters(FeatureClassOrTable, FieldName), to make sure that the field is addressed correctly. Since you didn't specify the rest of the script it is impossible to verify if the error is indeed caused by this. You could try changing the code to:
fc = r"Path to your featureclass or table"
fld = "LAST_EDITED_ON"
fld_ok = arcpy.AddFieldDelimiters(fc, fld)
expression = long(float((arcpy.CalculateValue_management(time.mktime((datetime.datetime.now()
+ relativedelta(years=-10)).timetuple())))[0])) - long(float((
arcpy.CalculateValue_management(time.mktime(time.strptime(fld_ok, "%x %X"))))[0])) > 0
Not sure if this will work though... Kind regards, Xander
... View more
11-06-2014
05:12 AM
|
1
|
3
|
2270
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-09-2020 09:26 AM | |
| 6 | 12-20-2019 08:41 AM | |
| 1 | 01-21-2020 07:21 AM | |
| 2 | 01-30-2020 12:46 PM | |
| 1 | 05-30-2019 08:24 AM |
| Online Status |
Offline
|
| Date Last Visited |
a week ago
|