|
POST
|
Hi Phil, Yes, they both look the same to me. The left side image is from Connect's media folder after I re-downloaded since the Survey was updated this morning at 6:20am. The right side image is from the zip file that was packaged up with the updated tpk and used to upload/update the Survey item on AGOL. Also, this is the line in my script to build the tpk: def buildTPK(mxd, outputTPK):
print '...building {} now'.format(outputTPK)
print 'mxd: {} | ONLINE | outputTPK: {} | PNG | 1 '.format(mxd, outputTPK)
arcpy.CreateMapTilePackage_management(in_map=mxd, service_type="ONLINE", output_file=outputTPK, format_type="PNG", level_of_detail="14", service_file="", summary="AVATAR Mobile HFS", tags="AVATAR", extent="")
Thanks again!
... View more
08-21-2019
06:38 AM
|
0
|
0
|
2708
|
|
BLOG
|
Hi Phillip! Sorry for the cross-post I put the details below on the other thread as well! Thank you! It's the latest Survey123 version 3.5.177 just installed yesterday. Device details: Device: iPad Air2 Software: 12.2 Model: MH2M2LL/A
... View more
08-20-2019
06:08 AM
|
0
|
0
|
19094
|
|
POST
|
Hi Phillip! It's the latest Survey123 version 3.5.177 just installed yesterday. Device details: Device: iPad Air2 Software: 12.2 Model: MH2M2LL/A
... View more
08-20-2019
06:08 AM
|
0
|
5
|
2708
|
|
POST
|
Hi James, As an update: Everything is running fine, no errors, all expected changes in tpk are persisted into the uploaded Survey123 item (verified by downloading and adding the tpk into ArcGIS desktop). The ONLY time the tpk updates are seen in the Survey123 is if I completely uninstall the app, re-install it from the app store and then download the specific Survey123 item again. This then opens the survey's map with the correct/expected tpk changes.
... View more
08-19-2019
07:55 AM
|
0
|
7
|
2708
|
|
BLOG
|
Edit: if I completely uninstall Survey123 from the device and then re-download the updated survey, the updated tpk shows up in the survey's map. Hi Philip, I've implemented a version of your script that first updates a .tpk with arcpy.CreateMapTilePackage_management(), then updates the media folder and finally uploads the packaged zip. Everything runs fine, no errors, an updated tpk is generated and included in the final .zip and the AGOL item last update date is correct. However, after deleting and downloading the Survey onto the device the updated tpk is not showing the new features/updates. Any input is appreciated!
... View more
08-19-2019
07:17 AM
|
0
|
0
|
19094
|
|
BLOG
|
This is exciting. I'm doing this now but within a "heavy" GP service that has to query map service layers, create localized geometry, perform clip operation, etc... To be able to accomplish this in a popup is really powerful and look forward to implementing Arcade more and more into our products. Thanks for the example!
... View more
07-29-2019
04:53 AM
|
1
|
0
|
16560
|
|
POST
|
String would just output the df structure as a string. I ended up converting to csv and then csv-to-json.
... View more
07-19-2019
01:02 PM
|
0
|
0
|
1794
|
|
POST
|
I am converting a Feature class to a numpy array, to a pandas dataframe in order to peform some grouping and basic statistics (to determine percent of totals on Shape_Area). This is all working as expected and generating the desired result. I need to publish this out as a GP service and for some reason it fails (no errors) to convert the grouped dataframe to_json(). It seems to "print" correctly in the python IDE, [{"Landuse":"Dikes and Levees","pctOfTotal":0.84,"acreTotal":17.88},{"Landuse":"Fallow Cropland","pctOfTotal":98.5,"acreTotal":2094.91},{"Landuse":"Mixed Wetland Hardwoods","pctOfTotal":0.66,"acreTotal":14.01}] but when output to arcpy.AddMessage it seems to print the dataframe instead of the JSON, " Landuse pctOfTotal acreTotal\n0 Dikes and Levees 0.84 17.88\n1 Fallow Cropland 98.50 2094.91\n2 Mixed Wetland Hardwoods 0.66 14.01" Full implementation: narr = arcpy.da.FeatureClassToNumPyArray(clip_fc, flds)
df = pd.DataFrame(narr, columns=['Landuse','Shape_Area'])
grouped = df.groupby(['Landuse'])[['Shape_Area']].sum().reset_index()
grouped['pctOfTotal'] = (grouped['Shape_Area'] / grouped['Shape_Area'].sum()) * 100
grouped['acreTotal'] = grouped['Shape_Area'] / 43560
outJson = grouped.to_json(orient='records', default_handler = str)
print outJson #correctly formats as desired JSON
arcpy.AddMessage(outJson) #incorrectly displays it as a dataframe, not JSON
arcpy.SetParameter(1, outJson) #incorrectly outputs it as a dataframe, not JSON
... View more
07-19-2019
11:02 AM
|
0
|
2
|
2269
|
|
POST
|
Instead of creating FeatureLayer from the AsShape result, I specified it in a CopyFeatures_management and output to in_memory instead and it likes it. jsonResult = json.load(response) rfs = arcpy.AsShape(jsonResult, True) fc = arcpy.CopyFeatures_management(rfs, r'in_memory\flLanduse')
... View more
07-19-2019
10:00 AM
|
0
|
0
|
4125
|
|
POST
|
Odd. The script works when I step thru it. Fails if I simply run it from start-to-finish. When stepping thru the code in the IDE, it correctly sets: rfs = arcpy.AsShape(jsonResult, True) And the feature layer that is generated contains features (resultfl > 0): arcpy.MakeFeatureLayer_management(rfs,landuseFL)
resultlfl = arcpy.GetCount_management(landuseFL) However, when I simply execute the script, the resultfl count = 0 Full def: qryLandUseURL = 'https://myAGSsite/MapServer/0/query'
qryLandUseParams = urllib.urlencode({'f': 'pjson',
'geometryType': 'esriGeometryPolygon',
'geometry': inGeometry,
'spatialRel': 'esriSpatialRelIntersects',
'outFields': outFlds,
'returnGeometry': 'true'
})
qryLandUseReq = urllib2.Request(qryLandUseURL, qryLandUseParams)
response = urllib2.urlopen(qryLandUseReq)
jsonResult = json.load(response)
rfs = arcpy.AsShape(jsonResult, True)
landuseFL = os.path.join('in_memory','flLanduse')
arcpy.MakeFeatureLayer_management(rfs,landuseFL)
resultlfl = arcpy.GetCount_management(landuseFL)
... View more
07-19-2019
07:57 AM
|
0
|
2
|
4125
|
|
POST
|
Huge amt of thank you on this one. I was way off track for a good workaround, saved me bigtime.
... View more
07-18-2019
02:19 PM
|
0
|
0
|
4125
|
|
POST
|
I've got the results of a map service query urlib2.Request setup as jsonResult = json.load(response) From this I am attempting to setup an in_memory FeatureSet() but it is failing when fs.load(jsronResult) with "RuntimeError: RecordSetObject: Cannot open table for Load". The odd thing is this works if I write the jsonResult to a local .json file and then issue arcpy.JSONToFeatures_conversion() with the same exact contents as the jsonResult payload. Anyone have similar scenario? Must be something simple I'm missing here. Thanks! qryLandUseURL = 'https://SomeAGSurl/MapServer/0/query'
qryLandUseParams = urllib.urlencode({'f': 'pjson','geometryType': 'esriGeometryPolygon','geometry': inGeometry,'spatialRel': 'esriSpatialRelIntersects','outFields': flds,'returnGeometry': 'true'})
qryLandUseReq = urllib2.Request(qryLandUseURL, qryLandUseParams)
response = urllib2.urlopen(qryLandUseReq)
jsonResult = json.load(response)
fs = arcpy.FeatureSet()
fs.load(jsonResult) Edit: my original implementation works when I set the fs.load() to the url of the map service like this: rquery = "?where={}&outFields={}&returnGeometry=true&f=json".format(rwhere, rflds)
rqueryfsURL = rtaburl + rquery
rfs = arcpy.FeatureSet()
rfs.load(rqueryfsURL) But I need it to have an input geometry and spatialRel type instead of a simple WHERE clause.
... View more
07-17-2019
11:13 AM
|
0
|
5
|
4453
|
|
POST
|
We have a GP service that references an .ini text file that contains reference information that the .py source uses (ConfigParser and base64). We copy this .ini file to the ArcGIS Server prior to publishing and it all works just as expected. We'd like to be able to encrypt this .ini but unsure about implementation across different machines. That is, if the file is encrypted on the development machine, run/executed in order to "publish" it to the AGS server, and the published version able to perform the decryption? Or any recommendations other than pyCrypto library? Thanks for any input!
... View more
07-15-2019
11:01 AM
|
0
|
0
|
636
|
|
POST
|
ah ha! A response! Thank you a bunch, I've been looking forward to returning to this asap and this looks promising.
... View more
07-08-2019
05:50 AM
|
1
|
0
|
1176
|
|
POST
|
Is there any setting applied to the security of two different secured feature services, each with their own role/credential applied, that would require a different method to request a valid token from the AGS token service? Strange, I know. As far as I can tell the security properties, roles, credentials on these two feature services in question are setup exactly the same way and on the same ArcGIS server site (the same token service!). We have developer with an existing app that works to generate the token with credential #1. However, that same exact code executed using credential #2 and it fails. I am able to get a token via both Postman and Advanced Rest Client. The only difference I can see is that one of the requests requires the payload to be encoded while the other it doesn't matter.
... View more
06-11-2019
12:48 PM
|
0
|
0
|
2933
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-17-2020 10:47 AM | |
| 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 |
| Online Status |
Offline
|
| Date Last Visited |
01-22-2025
02:28 PM
|