|
POST
|
I am trying to pass some record data from Javascript to GP Service which accepts one parameter I want to grab this parameter on the python side and parse it to variables. I am missing something here.....Having issues.... I can pass a string to the python script so that part works.... I am just unsure of I have to JSON string formatted properly before I pass it from Javascript or if I am trying to parse it incorrectly on the python side.....these are the steps I am taking... Thoughts? Step 1 Basically I am confused on how to create the JSON file on the javascript side....This will hold 3 records I can format string to look like this and then set to JSON var dict = [ {'Results':
['address': 'some address', 'id': 'sone ID' , 'distance': 'some distance'],
['address': 'some address', 'id': 'sone ID' , 'distance': 'some distance'],
['address': 'some address', 'id': 'sone ID' , 'distance': 'some distance']
} ]
var dictstring = JSON.stringify(dict);
gp.execute(dictstring ); Step 2 I then need to pass this to a GP service I set up with an input parameter called '"Request" Question: When setting up the parameters do I select "STRING" ??? Step 3 import arcpy
import json
jsondata = arcpy.GetParameterAsText(0)
for each in jsondata[Results][0]:
varId = (each['address'])
varAddress = (each['id'])
varDistance = (each['distance'])
# do something with each of these record sets.
... View more
03-28-2020
01:34 PM
|
0
|
2
|
2643
|
|
POST
|
Is there a simple call from arcgis javascript api 4.x to delete all records from a feature class
... View more
03-27-2020
02:15 PM
|
0
|
7
|
2355
|
|
POST
|
I set an output parameter in the python tool and then passed the value as such I had 3 input parameters and set the 4th to an output parameter...dont forget the index starts at 0 so the 4th would be 3 msg =("testing result value")
arcpy.AddMessage(msg)
resultMsg = msg
arcpy.SetParameterAsText(3, resultMsg)
... View more
03-27-2020
12:53 PM
|
0
|
0
|
1399
|
|
POST
|
When the user views the map they will see all the counties assigned to them selected within the main County FC they can select new counties from this main County FC which will add them to the current selected set they can also select already selected features to Un-select them from the current selected set Basically they are redefining the counties that are assigned to them I then need to dissolve this newly defined selection set. Looking for examples for my step 1 above for now...thoughts? Examples?
... View more
03-27-2020
12:21 PM
|
0
|
3
|
1187
|
|
POST
|
descriptive errors from ESRI...hahahaah this is all I get when trying to run from the RestEP but works fine from the GP Tool itself
... View more
03-26-2020
04:36 PM
|
1
|
1
|
2118
|
|
POST
|
This is where I am blowing up......cant figure it out I am trying to use an SDE connection file that I copied to a location on my server... This works when I run from the GP tool on the server, but fails when I run it after publishing.... arcpy.MakeFeatureLayer_management('C:/Work/CountySelection/connection.sde/Counties_1_Dissolved', 'counties_lyr')
arcpy.MakeFeatureLayer_management('C:/Work/CountySelection/connection.sde/Buffer_1', 'buffer_lyr')
results = arcpy.SelectLayerByLocation_management('counties_lyr', 'INTERSECT', 'buffer_lyr')
... View more
03-26-2020
04:18 PM
|
0
|
3
|
2118
|
|
POST
|
not sure if this is the best forum for this question as it leaves the python realm a bit.... I have a python script that does some stuff * this runs fine in the editor I then create a toolbox tool and point it to the python script * i can double click the toolbox enter the parameters and run this with no issues I then publish this to ArcGIS Server after running it I then go to Server and launch the service and enter the parameters.... it fails.... Anyone have any thoughts on what I should check? Cant seem to narrow this down
... View more
03-26-2020
11:56 AM
|
0
|
5
|
2195
|
|
POST
|
think I fixed it....delete the old one and created globalIDs again and it seems to be working....weird
... View more
03-26-2020
08:47 AM
|
1
|
0
|
3400
|
|
POST
|
Yea I figured when I add a new row the GlobalID would be populated automatically
... View more
03-26-2020
08:42 AM
|
0
|
0
|
3400
|
|
POST
|
I get this to work BUT i have a GlobalID in my feature class that does not get written too....how do I create the globalID # GET THE GEOMETRY FROM THE DISSOLVED FC and PASS THAT TO THE INSERT CURSOR BELOW ALONG WITH THE ATTRIBUTE VALUES
geometries = arcpy.CopyFeatures_management('Counties_3_dissolved', arcpy.Geometry())
arcpy.env.overwriteOutput = True
inputFeatureclass = "C:\Work\CountySelection\Data\SelectCounties.gdb\Counties_4_final_append"
## Write feature to new feature class
with arcpy.da.InsertCursor(inputFeatureclass, ['SHAPE@', 'ADDRESS', 'DISTANCE', 'UNIQUEID', 'COUNTYLIST']) as cursor:
cursor.insertRow([geometries[0], searchAddress, searchDistance, searchid, txt_list])
# Delete cursor object
del cursor
... View more
03-26-2020
07:06 AM
|
0
|
3
|
3400
|
|
POST
|
Using geometry objects with geoprocessing tools—ArcPy Get Started | Documentation
... View more
03-25-2020
05:22 PM
|
0
|
1
|
3400
|
|
POST
|
I am trying to read a FC geometry which has one record in it Grab this geometry and use it in an INSERT cursor with specific attributes Think I am close but cant get the geometry of the FCs feature...the FC has only one.... geometries = arcpy.CopyFeatures_management('Counties_3_dissolved', arcpy.Geometry())
length = sum([g.length for g in geometries])
print('Total length: {}'.format(length))
arcpy.env.overwriteOutput = True
# Create a feature class
result1 = arcpy.management.CreateFeatureclass(
arcpy.env.scratchGDB,
"esri_square", "POLYGON", spatial_reference=26917)
feature_class = result1[0]
inputFeatureclass = "C:\Data\SelectCounties.gdb\Counties_4_final_append"
# Write feature to new feature class
with arcpy.da.InsertCursor(inputFeatureclass, ['SHAPE@', 'ADDRESS', 'DISTANCE', 'UNIQUEID', 'COUNTYLIST']) as cursor:
cursor.insertRow([geometries, searchAddress, searchDistance, searchid, txt_list])
# Delete cursor object
del cursor
... View more
03-25-2020
04:19 PM
|
0
|
9
|
3457
|
|
POST
|
Think I got it working Doing this....but wanting to create that FC in memory and not writing it to a FC to only have to delete it. Testing now point = arcpy.Point(coordinateX, coordinateY)
ptGeometry = arcpy.PointGeometry(point)
# FEED THE BUFFER ANALYSIS THE POINT GEOMETRY THE DISTANCE PARAMETERS
arcpy.Buffer_analysis(ptGeometry, 'IN_MEMORY/BufferGeom', distanceMeters)
arcpy.env.workspace = "C:\Data\SelectCounties.gdb"
arcpy.Delete_management('chihuahua_10000plus')
arcpy.MakeFeatureLayer_management('CountiesDissolved', 'counties_lyr')
results = arcpy.SelectLayerByLocation_management('counties_lyr', 'INTERSECT', 'IN_MEMORY/BufferGeom')
# Write the selected features to a new featureclass
arcpy.CopyFeatures_management("counties_lyr", "C:\Data\SelectCounties.gdb\chihuahua_10000plus")
arcpy.MakeFeatureLayer_management('chihuahua_10000plus', 'Counties_append')
arcpy.Append_management('Counties_append', 'C:\Data\SelectCounties.gdb\CountiesDissolved_append', 'TEST','','')
... View more
03-25-2020
12:45 PM
|
0
|
1
|
3251
|
|
POST
|
Think I got it working.. Took the result and wrote that to the newly created FC Then took that new FC and appended to the original FC Testing
... View more
03-25-2020
12:42 PM
|
0
|
0
|
3251
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-20-2018 11:09 AM | |
| 1 | 09-10-2018 06:26 AM | |
| 1 | 09-15-2022 11:02 AM | |
| 1 | 05-21-2021 07:35 AM | |
| 1 | 08-09-2022 12:39 PM |
| Online Status |
Offline
|
| Date Last Visited |
09-19-2022
09:23 PM
|