POST
|
Greetings I have spent hours trying to install an offline Experience Builder. I followed the steps. Point 5 npm configure get cache Point 6/7 I copied the folder to user\Appdata\local Point 8 npm install --offline This throws hundreds of warnings. Then crashes with ERR code ENOTCACHED I am running an off-line installation, so why is it crashing trying to get: http://registry.npmjs.org/react Failed: cached mode is 'only-if-cached' but no cached response available. I uninstall and reinstalled npm. Opened a new cmd window. But still can't install /client I would appreciate a solution to this! Thanks Clive
... View more
02-23-2024
11:07 AM
|
0
|
8
|
1278
|
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-2021
04:15 AM
|
0
|
1
|
772
|
POST
|
Greetings, I am getting a socket.gaierror Error 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 <module>
sys.exit(main(sys.argv[1:]))
File "C:/Users/tmpgcesn/PycharmProjects/TEST/venv/InternalProd_ListRestStatus.py", line 62, in main
httpConn.request("POST", folderURL, params, headers)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\http\client.py", line 1277, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\http\client.py", line 1323, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\http\client.py", line 1272, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\http\client.py", line 1032, in _send_output
self.send(msg)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\http\client.py", line 972, in send
self.connect()
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\http\client.py", line 1439, in connect
super().connect()
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\http\client.py", line 944, in connect
(self.host,self.port), self.timeout, self.source_address)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\socket.py", line 707, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\socket.py", line 752, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed
Process finished with exit code 1
... View more
07-21-2021
03:26 AM
|
0
|
1
|
19449
|
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-2021
04:20 AM
|
2
|
1
|
1238
|
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-2021
07:03 AM
|
0
|
1
|
7655
|
POST
|
Greetings, I used the ESRI Python code to get a list 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 <module> services = server1.services.list() File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\server\_common\_base.py", line 86, in __getattr__ raise AttributeError("'%s' object has no attribute '%s'" % (type(self).__name__, name)) AttributeError: 'Server' object has no attribute 'services' Process finished with exit code 1 Has anyone resolved this issue?? Or can point to any suggestions? Regards, Clive
... View more
06-25-2021
08:36 AM
|
0
|
6
|
7802
|
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-2021
07:54 AM
|
0
|
0
|
620
|
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 <OSError: Int or String expected> error?? The code is: params = {'username': username, 'password': password, 'referer': bccreferer, 'f': 'pjson'}
headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "*.*"}
port = 6443
#### For Python 3
#### req = urllib.request("POST"(tokenURL, urlencode(params)))
#### response = urlopen(req)
conn = http.client.HTTPSConnection(tokenURL, params)
conn.request("POST", "", params, headers)
response = conn.getresponse()
print(response.status, response.reason) The error points to: conn.request("POST", "", params, headers) I would appreciate any pointers to resolve this issue. Regards, Clive
... View more
05-26-2021
04:27 AM
|
0
|
3
|
1981
|
POST
|
Hi David, It was supposed to be a variable holder, to reference the input. Thanks, Clive
... View more
05-26-2021
04:21 AM
|
0
|
0
|
1255
|
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-2021
09:47 AM
|
0
|
2
|
1296
|
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-2021
02:51 AM
|
0
|
0
|
605
|
POST
|
Hi Henry, I wish ESRI would provide context about the code. That SearchCursor code example was my first stab. Unfortunately the TOP option is only for MS Access and SQL Server. Thanks Dan, your pointer with the Where statement helped me solve the issue. Much appreciated.
... View more
03-05-2021
07:22 AM
|
0
|
0
|
3302
|
POST
|
If I SELECT ALL the query, without the select works. I only want to loop through 5 - 10 records, not 30,000. So trying to get a select statement to limit the number of records returned. This code works: for filename in filenames:
try:
for row in (arcpy.da.SearchCursor(filename, ['Shape@'])):
print(filename) The sql_clause throws an error?? for filename in filenames:
try:
for row in arcpy.da.SearchCursor(filename, ['OBJECTID@', 'Shape@'], sql_clause=('select * from ' + ['OBJECTID@', 'Shape@'] + 'limit 5', None)):
print(filename) Appreciate any pointers to fixing the sql_clause. Thanks, Clive
... View more
03-05-2021
03:41 AM
|
0
|
5
|
3375
|
POST
|
Hi George, I want to list the data stored in the Data Store, ie just read the data content. Is the hosted services content, the same as Data Store content?? Thanks Clive
... View more
03-05-2021
03:29 AM
|
0
|
1
|
2208
|
POST
|
Greetings, I want to search all Features, but exclude those that are a 'NoneType' object I tried to exclude the 'NoneType' object in the search, this is not working?? Appreciate any pointers, to skip the 'NoneType' serviceItems = portal.content.search("*", item_type="Feature*", max_items=4000)
for item in serviceItems:
if item != 'NoneType':
layers = item.layers
#print(layers)
#try:
for lyr in item.layers:
print(item.id, item.url, lyr.properties["id"], lyr.properties["name"], item.tags )
rowitem = (item.id, item.url, lyr.properties["id"], lyr.properties["name"], item.tags)
filewriter.writerow(rowitem )
else:
print("EROR")
... View more
03-04-2021
04:10 AM
|
0
|
1
|
3685
|
Title | Kudos | Posted |
---|---|---|
1 | 02-22-2021 04:17 AM | |
1 | 02-05-2021 07:18 AM | |
1 | 11-06-2020 07:13 AM | |
2 | 07-07-2021 04:20 AM | |
1 | 01-07-2021 02:53 PM |
Online Status |
Offline
|
Date Last Visited |
02-23-2024
07:07 PM
|