POST
|
I know it's old, but maybe it will help someone. If you send invalid token in request to endpoint mentioned by @VictorTey , you will get error code 498 (invalid token), and if you will not give token at all, then "user" part of json won't be present. So you can use this endpoint to validate token and get info about user it was issued for.
... View more
03-29-2023
12:37 AM
|
1
|
0
|
1529
|
POST
|
Had the same error message, it turned out admin module has more dependencies and some were missing (in my case pandas). Try putting: import arcgis.gis.admin in standalone script, and see what happens (I got as below, and installing pandas solved the problem) Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Miniconda3\lib\site-packages\arcgis\gis\admin\__init__.py", line 9, in <module>
from .portaladmin import PortalAdminManager
File "C:\Miniconda3\lib\site-packages\arcgis\gis\admin\portaladmin.py", line 10, in <module>
from ...apps.tracker._location_tracking import LocationTrackingManager
File "C:\Miniconda3\lib\site-packages\arcgis\apps\__init__.py", line 4, in <module>
from . import survey123
File "C:\Miniconda3\lib\site-packages\arcgis\apps\survey123\__init__.py", line 3, in <module>
from ._survey import SurveyManager, Survey
File "C:\Miniconda3\lib\site-packages\arcgis\apps\survey123\_survey.py", line 10, in <module>
import pandas as pd
ModuleNotFoundError: No module named 'pandas'
... View more
10-05-2022
08:01 AM
|
0
|
2
|
1625
|
POST
|
Hi, Cursor shouldn't cause such behavior. I think there might be something with referencing layer you're trying to remove (addstru variable). Can you try change code to:
arcpy.AddMessage(str(arcpy.mapping.ListLayers (mxd, "", df)))
arcpy.AddMessage(addstru)
arcpy.mapping.RemoveLayer(df, arcpy.mapping.ListLayers(mxd, 'StruxPts_v04)[0])
arcpy.AddMessage(str(arcpy.mapping.ListLayers (mxd, "", df)))
Regards Arek
... View more
01-20-2014
12:23 AM
|
0
|
0
|
219
|
POST
|
Hi Unless there is more than 65534 of them you can use file geodatabase table as output (it has limit of 65534 columns), then arcpy.TransposeFields_management to get table with only two columns - which can be DBF if its essential. I don't think there is another option except this or one I wrote before. Best Regards Arek
... View more
01-17-2014
12:37 AM
|
0
|
0
|
368
|
POST
|
Hi, Partially you have answer to you question. Iterate over your raster list with step 255 (as written in my last post) in loop, after creating DBF file with 255 columns and one row, use function arcpy.TransposeFields_management (http://resources.arcgis.com/en/help/main/10.1/index.html#//0017000000v4000000) to get DBF with two columns (name of the raster and value) and 255 rows. When you finished loop you can append all two-coloumn-dbfs to single file. Best Regards. Arek
... View more
01-16-2014
10:10 PM
|
0
|
0
|
368
|
POST
|
Hi, In lines below:
def uploadCSVfile1(token, ThePlaceTOupload):
files = {'file': open('E:\sample.csv','rb'),
(...)
def uploadCSVfile2(token, ThePlaceTOupload):
query_dict = {'file': open('E:\sample.csv','rb'),
(...) You should use either "/", "\\" or r'C:\sample.csv' in paths to files. So:
open('E:\\sample.csv','rb')
or:
open('E:/sample.csv','rb')
or:
open(r'E:\sample.csv','rb')
Also using path as filename isn't good practice. Regards Arek
... View more
01-15-2014
11:45 PM
|
0
|
0
|
509
|
POST
|
Hi, My first idea would be iterating over list of raster with 255 step, and extracting values in chunks. Of course first you have to copy your point fc len(raster_list) / 255 + 1 times and extracting each part of values to next copy. Then you can Transpose Fields in each result, export it to spreadsheet or whatever you want. Regards Arek
... View more
01-15-2014
11:03 PM
|
0
|
0
|
368
|
POST
|
Hi, Few questions: How many instances of python you have installed on your computer? Have you checked if C:\Python27\ArcGIS10.1\Lib\site-packages is in sys.path in python? import sys
sys.path Also some other folders should be there (ArcGISinstallPath\bin; ArcGISinstallPath\arcpy). If some of them are missing, you can just append them at start of your script (before importing arcpy):
import sys
sys.path.append(path1)
sys.path.append(path2)
...
import arcpy Also you can create new windows environment variable named PYTHONPATH and define paths that should be included in python. Best Regards Arek
... View more
10-09-2013
02:11 AM
|
0
|
0
|
2596
|
POST
|
Hi, In cases like this I prefer defining out_coor_system as path to .prj file representing reference system usually it solves problem. Also I don't think "Peru96_UTM_Zone_19S" is name of geographic transformation - at least I didn't find such (refer to <install location>\ArcGIS\Desktop10.1\Documentation\geographic_transformations.pdf). Best Regards Arek
... View more
10-04-2013
12:40 AM
|
0
|
0
|
765
|
POST
|
Hi, When using arcpy.da.SearchCursor() each row is returned as list of values, correct call to get attribute value for row would be: arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", whereClause) df.extent = lyr.getSelectedExtent() df.scale = df.scale*1.1 arcpy.AddMessage(str(whereClause)) cursor = arcpy.da.SearchCursor("Land", ["ValueGain"]) for row in cursor: arcpy.AddMessage(str(row[0])) # row[0] = first element of list that represents row del row del cursor In case from your code: arcpy.AddMessage(str(ValueGain)) ValueGain is unassigned variable, so you will get error. Regards Arek
... View more
08-07-2013
06:39 AM
|
0
|
0
|
239
|
POST
|
Hi, Are you running your script as toolbox, add in or from python window? In last two cases running: arcpy.MakeTableView_management("H:/ss/Projects/MaPP/Habitat.gdb/tablename", "TMP") will add tabel under name of "TMP" to TOC of mxd in context of which you invoked command (select "List by source" tab in TOC). Best Regards Arek
... View more
08-06-2013
05:40 AM
|
2
|
1
|
1111
|
POST
|
Hi, You can try delete existing fields (arpcy.DeleteField_management) from copied featureclass, then adding your attributes (arcpy.AddField_management), putting new values with arcpy.CalculateField_management, and at last appending to existing featureclass (arcpy.Append_management). So it will look something like:
arcpy.CopyFeatures_management(lyr, tmp_fc)
f_list = arcpy.ListFields(tmp_fc)
for f in f_list:
if f.type not in ('OID', 'Geometry'):
arcpy.DeleteField_management(tmp_fc, f) #delete all fields except of geometry and FID
arcpy.AddField_management(tmp_fc, field1, 'TEXT')
arcpy.AddField_management(tmp_fc, field2, 'LONG') # adding fields you need
...
arcpy.CalculateField_management(tmp_fc, filed1, value1)
arcpy.CalculateField_management(tmp_fc, filed2, value2)
...
arcpy.Append_management(tmp_fc, out_fc, *params)
Hope it helps. Regards Arek
... View more
08-02-2013
01:12 AM
|
0
|
0
|
170
|
POST
|
Hi, I think you should already have schema name in child.name string. Your child name should be something like:
SHEMA.FEATURE_CLASS_NAME
So all you need to do is split child.name on dot and get first element of the list.
import arcpy
# Create a Describe object
#
desc = arcpy.Describe(r"Database Connections\SDCM_SIS in PRD as 044231 DC.sde")
# Print some Describe Object properties
#
for child in desc.children:
print "\tSchema: %s, Table: %s, DataType: %s " % (child.name.split('.')[0], child.name.split('.')[1], child.dataType)
Regards Arek
... View more
07-15-2013
12:55 AM
|
0
|
0
|
348
|
POST
|
Hi, Depends what kind of geometry you want to create. In your second script it's polyline. If you want to keep it that way code would be: import arcpy import re from itertools import product pnt = arcpy.Point() KEY_VALUE_RE = re.compile(r'([a-z_][a-z0-9_]*)=(\d+(?:\.\d*)?)') lineArray = arcpy.Array() def main(): i_cur=arcpy.InsertCursor("test_polygon.shp") # create cursor to insert features points_to_search_r = [ 'p{0}_{1}w'.format(a, b) for a, b in product([1, 2, 4, 6, 7, 9], 'r') ] points_to_search_h = [ 'p{0}_{1}w'.format(a, b) for a, b in product([1, 2, 4, 6, 7, 9], 'h') ] with open('F:\\Rasterdaten\\SRV\\2005\\TK100\\c4706_3.txt') as lines: for line in lines: pnt.X = 0.0 # reset values for each line pnt.Y = 0.0 variables = dict( (k, float(v)) for k, v in KEY_VALUE_RE.findall(line) ) for point_r in points_to_search_r: value_r = variables.get(point_r) if value_r is not None: #print '{0} {1}'.format(point_r, value_r) pnt.Y = value_r #print pnt.Y for point_h in points_to_search_h: value_h = variables.get(point_h) if value_h is not None: #print '{0} {1}'.format(point_h, value_h) pnt.X = value_h #print pnt.X if pnt.X != 0.0 and pnt.Y != 0.0: lineArray.add(pnt) # add point to polyline feat = i_cur.newRow() feat.SHAPE = lineArray i_cur.insertRow(feat) del i_cur if __name__ == '__main__': main() If you want to create points, code will be: import arcpy import re from itertools import product pnt = arcpy.Point() KEY_VALUE_RE = re.compile(r'([a-z_][a-z0-9_]*)=(\d+(?:\.\d*)?)') #lineArray = arcpy.Array() def main(): i_cur=arcpy.InsertCursor("test_polygon.shp") # create cursor to insert features points_to_search_r = [ 'p{0}_{1}w'.format(a, b) for a, b in product([1, 2, 4, 6, 7, 9], 'r') ] points_to_search_h = [ 'p{0}_{1}w'.format(a, b) for a, b in product([1, 2, 4, 6, 7, 9], 'h') ] with open('F:\\Rasterdaten\\SRV\\2005\\TK100\\c4706_3.txt') as lines: for line in lines: pnt.X = 0.0 # reset values for each line pnt.Y = 0.0 variables = dict( (k, float(v)) for k, v in KEY_VALUE_RE.findall(line) ) for point_r in points_to_search_r: value_r = variables.get(point_r) if value_r is not None: #print '{0} {1}'.format(point_r, value_r) pnt.Y = value_r #print pnt.Y for point_h in points_to_search_h: value_h = variables.get(point_h) if value_h is not None: #print '{0} {1}'.format(point_h, value_h) pnt.X = value_h #print pnt.X if pnt.X != 0.0 and pnt.Y != 0.0: feat = i_cur.newRow() feat.SHAPE = pnt i_cur.insertRow(feat) del i_cur if __name__ == '__main__': main() Hope it will help. Regards Arek
... View more
07-03-2013
11:55 PM
|
0
|
0
|
266
|
POST
|
I question your use of desc.fields... Not sure that describe object is iterable. Can't you use the listFields function instead? Careful with case, could be ListFields, look up the topic of listing data. Hi, As Wayne told, use arcpy.ListFields instead of desc.fields, also you should change AddMessage statement a bit, to make sure it won't crush if field type is different than TEXT:
fields = arcpy.ListFields(DBase_file)
rows = arcpy.SearchCursor(DBase_file)
for row in rows:
for field in fields:
rVal = row.getValue(field)
arcpy.AddMessage("Field Name: " + field + "Value: " + str(rVal)) # is not always string
Regards Arek
... View more
05-17-2013
02:25 AM
|
0
|
0
|
11434
|
Title | Kudos | Posted |
---|---|---|
1 | 03-29-2023 12:37 AM | |
2 | 08-06-2013 05:40 AM | |
1 | 11-15-2012 10:38 PM |
Online Status |
Offline
|
Date Last Visited |
03-29-2023
03:19 PM
|