POST
|
Thank you. I didn't mention that the Oracle db is non-spatial/sde that is being queried. I looked at the actual Sql in the original script and it's quite extensive.
... View more
05-28-2024
01:20 PM
|
0
|
1
|
430
|
POST
|
Hi all, Was provided an old Python 2.7 script that imported cx_Oracle for submitting SQL against an Oracle db. Just curious if there's any replacement for this using the default py libraries that come installed with ArcGIS Pro 3.1.2 (or some version of such)?
... View more
05-28-2024
11:54 AM
|
0
|
4
|
457
|
POST
|
The input geometry attribute is expecting a string of coordinate pairs. I was simply passing in the geom object of the result from another query/response of the point layer: 'geometry': geom Simply putting this into a string solves the issue: 'geometry': '{},{}'.format(geom['x'],geom['y'])
... View more
03-27-2024
06:12 AM
|
0
|
0
|
713
|
POST
|
When attempting to use point geometry as inputGeometry to query our Parcels REST service, it doesn't fail but it does return all parcels when I'm expecting only 1 parcel to be in the result. Also, successfully doing a similar spatial query using polygon geometry so not sure why we're seeing a different result using point feature as the inputGeometry. Using the "geometry" values in the example below as the input directly in the REST query interface returns the correct result. Example input payload to the request: {
"f": "json",
"geometryType": "esriGeometryPoint",
"geometry": {
"x": 952887.1388473287,
"y": 830228.6453575715,
"spatialReference": {
"wkid": 2881
}
},
"spatialRel": "esriSpatialRelIntersects",
"distance": 0,
"units": "esriSRUnit_Foot",
"inSR": 2881,
"where": "1=1",
"outFields": "PARNO",
"returnGeometry": "false",
"returnCountOnly": "true",
"featureEncoding": "esriDefault",
"token": "validtoken"
} This is being run via Python 3.x using the requests library (again, successfully with other geometry types). In this code sample below the "geom" variable is as described in the "geometry" attribute above. queryURL_parcels = 'https://{}/ourdevserver/rest/services/LandOwnershipAndInterests/NormalizedParcels/FeatureServer/0/query'.format(portalUrlBase)
params = {'f': 'json',
'geometryType': 'esriGeometryPoint',
'geometry': geom,
'spatialRel': 'esriSpatialRelIntersects',
'distance': 0.0,
'units': 'esriSRUnit_Foot',
'inSR': 2881,
'where': '1=1',
'outFields': 'PARNO',
'returnGeometry': 'false',
'returnCountOnly': 'true',
'token': tok}
print(json.dumps(params))
r = requests.post(queryURL_parcels, data = params, verify=False)
response = json.loads(r.content)
print(response) Since the returnCountOnly param is true then we get back all 4million parcels in the layer, expecting only 1 feature in the count/result. Hopefully someone can spot what I'm missing because I've attempted all combinations of geometry formats.
... View more
03-26-2024
02:15 PM
|
0
|
1
|
793
|
POST
|
If nothing evaluates from the query and the result is [] sdf then there is no spatial reference and nothing to join. It must be that I get a result from 1 of the portal items and the other i do not!
... View more
02-16-2024
11:46 AM
|
0
|
0
|
630
|
POST
|
We're doing a simple query of 2 portal feature layers and performing a spatial join on the 2 sdf representations. It looks like the error complains "Difference Spatial References, aborting operation" when a Left/Right join is attempted, so I checked each sr for each sdf and sure enough one of them is []! This issue appears to only occur on 1 of our enterprise portals (we have a test and prod version of each site). When I check the item properties it does show the correct spatref so I'm not sure where to check next! Code executed on it's comparable items across both portals produces what we expect: {'wkid': 2881, 'latestWkid': 2881} The other portal produces: [] targetFSet = scratchLayer.query(where=qryStr,out_sr=2881)
targetDF = targetFSet.sdf
df1SR = targetDF.spatial.sr
print(df1SR)
... View more
02-16-2024
11:23 AM
|
0
|
1
|
636
|
POST
|
Hey there David! Great to hear from you again. The directory levels all look correct, there's no duplication on the deployed resources. This issue only appears when we navigate to the index.html of the deployed app. I'm wondering if this is an IIS/domain setting thing? We ran into this issue a couple of years ago but didn't document the fix and just re-investigating.
... View more
01-05-2024
09:14 AM
|
0
|
0
|
346
|
POST
|
We have developed an ExB with Developer edition v1.12 and seeing 404 error when attempting to navigate to the index.html of the deployed ExB. From the dev tools console (header tab): Index.html Request URL: https://ourdomain.com/somefoldername/index.html Status Code: 200 Ok init.js Request URL: https://ourdomain.com/somefoldername/cdn/1/cdn/1/jimu-core/init.js Status Code: 404
... View more
01-05-2024
08:03 AM
|
0
|
2
|
407
|
POST
|
Sounds like your portal is connected to your active directory accounts maybe? If that's the case, what we do is create a new portal account that doesn't use AD to authenticate and this is the account used for authentication within any scripting. Also: if you have ArcGIS Pro open and you are logged into the portal, does your script run successfully then to create the GIS object?
... View more
11-09-2023
09:16 AM
|
0
|
1
|
1721
|
POST
|
Hi Katherine! What is the output parameter of your GP tool? I'm unsure what the application is expecting to render it as or what would be appropriate. I think my comments above to the original post were more about generating an output of a zipped up kml that would end up in a the user's downloads folder. If that's the case, your python script source would need to execute the "Layer To KML" tool then implement code to zip that up and send via the output parameter.
... View more
09-25-2023
07:00 AM
|
0
|
0
|
2372
|
POST
|
Oh. the updates parameter is supposed to be a list in edit_features() method: edit_result = layer.edit_features(updates=[editFeature])
... View more
08-14-2023
07:14 AM
|
2
|
0
|
651
|
POST
|
This is supposed to be simple but running into issues attempting to submit updates to a feature service layer. Forever I have simply used the REST api (ie. "applyEdits") on a service layer and always works as expected but now I'm converting some of that code over to the python API to work directly on the portal items themselves. Anyway, this is somewhat close to THIS example but getting this error "object of type 'Feature' has no len()" on the edit_features() method. #set layer
portalItem = gis.content.get('9cb6469e3d3e43379551abbb1b74a284')
for layer in portalItem.layers:
if "Final" in layer.properties.name:
#check if there is a matching appId
checkSet = layer.query(where='objectid={}'.format(oid), return_count_only=True)
if checkSet == 1:
#get the row to edit using the oid value
fset = layer.query(where='objectid={}'.format(oid))
editFeature = [f for f in fset.features if f.attributes['OBJECTID']==oid][0]
editFeature.attributes['PERMIT_ID'] = inputPermitId
editFeature.attributes['PERMIT_NO'] = inputPermitId
edit_result = layer.edit_features(updates=editFeature)
... View more
08-14-2023
07:10 AM
|
0
|
1
|
654
|
POST
|
If you go the gp service route and implement python api to I guess access a FeatureLayerCollection, there may be something there to go at it in one shot but I'm not sure what is under the hood behind that operation (ie, maybe it just makes all 100 requests too). Also, this seems overly complex for such a simple request to get feature counts! Anyway -- sorry no real good answer for you just a quick comment and will get notified of any other answers you may get, I am curious myself!
... View more
08-11-2023
09:34 AM
|
0
|
1
|
1018
|
POST
|
Printing params value and sending same exact request/post using Postman succeeds.
... View more
07-13-2023
06:25 AM
|
0
|
0
|
513
|
POST
|
I have had a py 2.7 script running for years that makes requests to the ESRI route service at https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World/solve Converting to requests library. It supplies a token and pre-built input params and makes the post request: {'f': 'json', 'stops': {'features': [{'geometry': {'x': 863532.1692919674, 'y': 1030860.3483306282, 'spatialReference': {'wkid': 2881}}, 'attributes': {'CurbApproach': 'null', 'TimeWindowStart': 'null', 'TimeWindowEnd': 'null', 'Attr_Minutes': 0, 'Attr_TravelTime': 0, 'Attr_Miles': 0, 'Attr_Kilometers': 0, 'Attr_TimeAt1KPH': 0, 'Attr_WalkTime': 0, 'Attr_TruckMinutes': 0, 'Attr_TruckTravelTime': 0, 'Name': 'permitAppBoundary'}}, {'geometry': {'x': 623453.099237, 'y': 136924.166006, 'spatialReference': {'wkid': 2881}}, 'attributes': {'CurbApproach': 'null', 'TimeWindowStart': 'null', 'TimeWindowEnd': 'null', 'Name': 'MARATHON FS'}}]}, 'token': '7a6sZjdk8Xiit1VUsERtOGf4tEHskFAyZky3_LP8J1yggoKtkpp2cvFFDo5WP3bg6imUNra7cLZZ2B9yyKhJTnRl-fe0qxcD73vL_58lLSytF00nfhoXM6K0mbp7Vt2OISbhzTfjLlpa3Y2tI5K2j17Qq5o-JXO16Bcmx7KKlgpyhDlfxnhX34umWPIi2hEr', 'returnDirections': 'false'} Same request made in Postman successful. I am running into a new error with the input above: {'error': {'code': 400, 'extendedCode': -2147024809, 'message': 'Invalid or missing input parameters.', 'details': ['Invalid input coordinates [features].']}} Only difference is that now all input coordinates you see above are in WKID 2881 (whereas before all were supplied in 102100 Complete def: def routeRequest(permitX, permitY, scX, scY, serviceCenter):
routeQueryURL = 'https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World/solve'
params = {'f':'json',
'stops':{'features':[{
'geometry':{
'x':permitX,
'y':permitY,
'spatialReference':{
'wkid':2881
}
},
'attributes':{
'CurbApproach':'null',
'TimeWindowStart':'null',
'TimeWindowEnd':'null',
'Attr_Minutes':0,
'Attr_TravelTime':0,
'Attr_Miles':0,
'Attr_Kilometers':0,
'Attr_TimeAt1KPH':0,
'Attr_WalkTime':0,
'Attr_TruckMinutes':0,
'Attr_TruckTravelTime':0,
'Name':'permitAppBoundary'
}
},
{
'geometry':{
'x':scX,
'y':scY,
'spatialReference':{
'wkid':2881
}
},
'attributes':{
'CurbApproach':'null',
'TimeWindowStart':'null',
'TimeWindowEnd':'null',
'Name':serviceCenter
}
}
]},
'token':tokAGO,
'returnDirections':'false'}
r = requests.post(routeQueryURL, data = params, verify=False)
dataM = json.loads(r.content)
print (dataM)
stopName = dataM['routes']['features'][0]['attributes']['Name']
miles = dataM['routes']['features'][0]['attributes']['Total_Miles']
driveTime = dataM['routes']['features'][0]['attributes']['Total_TravelTime']
return miles, driveTime, stopName
... View more
07-12-2023
12:45 PM
|
0
|
1
|
580
|
Title | Kudos | Posted |
---|---|---|
1 | 10-25-2022 11:46 AM | |
1 | 08-08-2022 01:40 PM | |
1 | 02-15-2019 08:21 AM | |
2 | 08-14-2023 07:14 AM | |
1 | 07-10-2023 01:25 PM |
Online Status |
Offline
|
Date Last Visited |
08-19-2024
09:15 PM
|