POST
|
Greetings, I am using the ESRI JS API 4.2 I am trying to use BNG grid coordinates for the Min/Max extent, and centre. The map defaults to the world view, not UK extent?? I cannot see why it is not working?? This is the JS script: const view = new MapView({ container: "viewDiv", map: map, center: [506032.00000, 194447.000000], //zoom: 15, scale: 50000, extent: { // autocasts as new Extent() xmin: 53976.3289500004, // 318351.6994, ymin: 633750.0000, // -5.6914500001, xmax: -168200.0000, // 571833.3974, ymax: 117983.0000, // 657535.9723, spatialReference: 27700 } }); I added the following that was listed as a solution in another posting... Still doesn't work?? view.when(() => { //view.goTo(layer.fullExtent); // this works too view.extent = layer.fullExtent; }); Map extent I am using BNG (27700), not WGS84. So I don't see why the centre, extent and zoom is not honoured?? I would appreciate any pointers. Thanks, Clive
... View more
08-18-202104:15 AM
|
0
|
1
|
376
|
POST
|
问候,我得到一个套接字。gaierror错误When running a script to read the Portal Services. The code fails at: httpConn . request ( "POST" , folderURL , params , headers ) The code is: # Construct URL to read folder if str.upper(folder) == "ROOT": folder = "" else: folder += "/" folderURL = "/arcgis/admin/services/" + folder #### This request only needs the token and the response formatting parameter params = urllib.parse.urlencode({'token': Token, 'f': 'json'}) headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"} #### Connect to URL and post parameters httpConn = http.client.HTTPSConnection(serverName, serverPort) httpConn.request("POST", folderURL, params, headers) #### Read response response = httpConn.getresponse() if (response.status != 200): httpConn.close() print "Could not read folder information." return else: data = response.read() # Check that data returned is not an error object if not assertJsonSuccess(data): print "Error when reading folder information. " + str(data) else: print "Processed folder information successfully. Now processing services..." #### Deserialize response into Python object dataObj = json.loads(data) httpConn.close() #### Loop through each service in the folder and stop or start it for item in dataObj['services']: fullSvcName = item['serviceName'] + "." + item['type'] #### Construct URL to stop or start service, then make the request statusURL = "/arcgis/admin/services/" + folder + fullSvcName + "/status" httpConn.request("POST", statusURL, params, headers) #### Read status response statusResponse = httpConn.getresponse() if (statusResponse.status != 200): httpConn.close() print "Error while checking status for " + fullSvcName return else: statusData = statusResponse.read() #### Check that data returned is not an error object if not assertJsonSuccess(statusData): print "Error returned when retrieving status information for " + fullSvcName + "." print str(statusData) else: #### Add the stopped service and the current time to a list statusDataObj = json.loads(statusData) if statusDataObj['realTimeState'] == "STOPPED": stoppedList.append([fullSvcName, str(datetime.datetime.now())]) httpConn.close() #### Check number of stopped services found if len(stoppedList) == 0: print "No stopped services detected in folder " + folder.rstrip("/") else: #### Write out all the stopped services found #### This could alternatively be written to an e-mail or a log file for item in stoppedList: print "Service " + item[0] + " was detected to be stopped at " + item[1] return #### A function that checks that the input JSON object is not an error object. def assertJsonSuccess(data): obj = json.loads(data) if 'status' in obj and obj['status'] == "error": print "Error: JSON object returns an error. " + str(obj) return False else: return True #### Script start if __name__ == "__main__": sys.exit(main(sys.argv[1:])) The error message points to a path error?? Traceback (most recent call last): File "C:/Users/tmpgcesn/PycharmProjects/TEST/venv/InternalProd_ListRestStatus.py", line 144, in
07-21-202103:26 AM
|
0
|
1
|
6755
|
POST
|
Greetings, I have read through the ESRI Accessibility documents that suggest using high colour contrast, etc for users that have a visual disability. Is there any option to convert sound to text in a text-box, for example if a user reads out an address?? So that a severely visually disabled or blind user could use the text to do a spatial search, and the Web map return the result to be processed. Regards, Clive
... View more
07-07-202104:20 AM
|
2
|
1
|
559
|
POST
|
Hi Dan, Thanks for the message. I read the link in your message, the answer is: From ESRI Upgrade to ArcGIS Pro 2.7 - arcgis module 1.8.3. I have ArcGIS Pro 2.7.2 installed, with arcgis module 1.8.3... It still doesn't work...
... View more
06-29-202107:03 AM
|
0
|
1
|
3078
|
POST
|
问候,我使用ESRI Python代码李st of Services. URL: arcgis.gis.server module — arcgis 1.8.5 documentation Using the same code: gis = GIS(portalURL, username, password) ##print('Connected to {} as {}'.format(gis_name.properties.portalHostname, gis_name.users.me.username)) print("Logged IN") #print(gis.admin.servers.validate()) ### true gis_server = gis.admin.servers.list() print(gis_server) server1 = gis_server[0] services = server1.services.list() print(services) The server name is returned, throws an error on the following line: services = server1.services.list() Error message: Traceback (most recent call last): File "C:/Users/tmpgcesn/PycharmProjects/TEST/venv/Test/LOGS_Internal.py", line 31, in
06-25-202108:36 AM
|
0
|
6
|
3225
|
POST
|
Greetings, I am trying to get the ArcGIS Server Report out to JSON, there are two issues. 1) Python loops through the reports, is expecting 4 columns? There is report.reportname, report.metadata, report.time-slices, report.report-data The Python is writing out rows, this fails when it try's to write out column 2. There is no column 2, 3, 4. The code is: with open(outFile, 'w', newline='') as json_file: for service in srv.services.list(): if service.properties.serviceName != " ": for report in service: qk_report = srv.usage.quick_report(since="LAST_DAY", metrics="error") df = DataFrame(qk_report, columns=['report' ]) flat = pd.json_normalize(qk_report) flatten = flat.to_json() print(flatten) json.dump(flatten, json_file) print("End of Report") json_file.close print("END REPORT") The output per row (flattened JSON is): {"report.reportname":{"0":"3da3d646cf434b9c838a822cd5c75d06"},"report.metadata":{"0":"{\"temp\":true,\"title\":\"3da3d646cf434b9c838a822cd5c75d06\",\"managerReport\":false}"},"report.time-slices":{"0":[1622989800000,1622991600000,1622993400000,1622995200000,1622997000000,1622998800000,1623000600000,1623002400000,1623004200000,1623006000000,1623007800000,1623009600000,1623011400000,1623013200000,1623015000000,1623016800000,1623018600000,1623020400000,1623022200000,1623024000000,1623025800000,1623027600000,1623029400000,1623031200000,1623033000000,1623034800000,1623036600000,1623038400000,1623040200000,1623042000000,1623043800000,1623045600000,1623047400000,1623049200000,1623051000000,1623052800000,1623054600000,1623056400000,1623058200000,1623060000000,1623061800000,1623063600000,1623065400000,1623067200000,1623069000000,1623070800000,1623072600000,1623074400000]},"report.report-data":{"0":[[{"resourceURI":"services\/","metric-type":"error","data":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null]}]]}} 2) The data returned is not that useful??
... View more
06-07-202107:54 AM
|
0
|
0
|
351
|
POST
|
Greetings, I am unable to get the Token in my current environment, due to certificates?? I am trying to get a request working to retrieve the token but keep getting an
05-26-202104:27 AM
|
0
|
3
|
825
|
POST
|
Hi David, It was supposed to be a variable holder, to reference the input. Thanks, Clive
... View more
05-26-202104:21 AM
|
0
|
0
|
692
|
POST
|
Greetings, I am trying to parse a date filed in YYYY-MM-DD format, get an input error?? The code is: fromTime = 0 while fromTime == 0: ###fromTime = raw_input("Start date of total requests in YYYY-MM-DD HH:MM format (e.g. 2014-05-10 14:00): ") ##YYYY-MM-DD HH:MM format. fromTime = ("2021-05-20 08:00: 2021-05-20 08:00") # Convert input to Python struct_time and then to Unix timestamp in ms try: fromTime = int(time.mktime(time.strptime(fromTime, '%Y-%m-%d %H:%M')) * 1000) except: print('Unable to parse input. Ensure date and time is in YYYY-MM-DD HH:MM format.') fromTime = 0 The ToTime = 2021-05-21 08:00 I don't get why I get the input time error?? Any pointers would be appreciated. The error is: Unable to parse input. Ensure date and time is in YYYY-MM-DD HH:MM format. Unable to parse input. Ensure date and time is in YYYY-MM-DD HH:MM format. Unable to parse input. Ensure date and time is in YYYY-MM-DD HH:MM format.
... View more
05-24-202109:47 AM
|
0
|
2
|
733
|
POST
|
Greetings, I am tring to loginto ArcGIS Hub and get a token to use to access data. The code is: referer = 'https://org-data-hub-org.hub.arcgis.com' AGOL = referer AGOL=GIS(AGOL, username, password, ssl=False) token = arcpy.GetSigninToken()['token'] token = token.rstrip(".") print(token) The error appears not to return a token?? Any pointers to get a token to use with the DataHub?? Any pointers appreciated. Thanks, Clive JSONDecodeError Traceback (most recent call last) In [21]: Line 50: AGOL=GIS(AGOL, username, password, ssl=False) File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py, in __init__: Line 359: raise e File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py, in __init__: Line 343: trust_env=kwargs.get("trust_env", None)) File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\_impl\_portalpy.py, in __init__: Line 173: self.get_properties(True) File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\_impl\_portalpy.py, in get_properties: Line 1138: raise e File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\_impl\_portalpy.py, in get_properties: Line 1126: resp = self.con.post(path, self._postdata(), ssl=True) File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\_impl\_con\_connection.py, in post: Line 632: elif token_as_header == False and self.token is not None: #as ?token= File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\_impl\_con\_connection.py, in token: Line 1038: self._token = self._enterprise_token() File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\_impl\_con\_connection.py, in _enterprise_token: Line 1155: add_token=False) File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\_impl\_con\_connection.py, in post: Line 720: force_bytes=kwargs.pop('force_bytes', False)) File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\_impl\_con\_connection.py, in _handle_response: Line 500: data = json.loads(data) File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\json\__init__.py, in loads: Line 348: return _default_decoder.decode(s) File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\json\decoder.py, in decode: Line 337: obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\json\decoder.py, in raw_decode: Line 355: raise JSONDecodeError("Expecting value", s, err.value) from None JSONDecodeError: Expecting value: line 1 column 1 (char 0)
... View more
05-17-202102:51 AM
|
0
|
0
|
362
|
Title | Kudos | Posted |
---|---|---|
1 | 11-06-202007:13 AM | |
2 | 07-07-202104:20 AM | |
1 | 01-07-202101:38 PM | |
1 | 01-07-202102:53 PM | |
1 | 01-07-202103:11 PM |
Online Status |
Offline
|
Date Last Visited |
10-04-202112:55 PM
|