POST
|
Greetings, I am using the ESRI example to try and return the Features extent, getting an error: Extent—ArcGIS Pro | Documentation TypeError: '<' not supported between instances of 'Polyline' and 'Polyline' The error is at the for row in sorted: for dirpath, dirnames, filenames in arcpy.da.Walk(workspace, topdown=True, datatype=data_type):
#datasets = [''] + datasets if datasets is not None else []
for filename in filenames:
for row in sorted(arcpy.da.SearchCursor(filename, ['Shape@'])):
#print(filename)
extent = row[0].extent
print(filename, extent) Appreciate any pointers. Thanks, Clive
... View more
03-03-2021
09:09 AM
|
0
|
2
|
1526
|
POST
|
Greetings, I am trying to use arcpy.da.SearchCursor to return a row, and get the extent (min, max). I used the ESRI example: Use SQL TOP to limit the number of records to return. # Use SQL TOP to sort field values
for row in arcpy.da.SearchCursor(fc, fields, sql_clause=('TOP 3', None)): My code: gets an error at 'for row in arcpy.da...' RuntimeError: Invalid SQL syntax [ERROR: syntax error at or near "3"?? Appreciate any pointers, Regards, Clive for dirpath, dirnames, filenames in arcpy.da.Walk(workspace, topdown=True, datatype=data_type):
#datasets = [''] + datasets if datasets is not None else []
for filename in filenames:
#print(filename) ### Prints the path + name
fc_name = filename.split('.')[-1]
print(fc_name)
sc = arcpy.da.SearchCursor(r"D:\Users\me\db.sde\fc",["polygon"])
for row in sorted(arcpy.da.SearchCursor(sc, ["Shape@"], sql_clause=('TOP 1', None)):
print(row) I get an error @
... View more
02-25-2021
07:54 AM
|
0
|
2
|
2673
|
POST
|
Get through one error message and ESRI has another for you.. I created a .vtpk file, trying to export it to portal, using the ESRI example It threw an error message, then it ran.. 🙂
... View more
02-22-2021
07:57 AM
|
0
|
0
|
3287
|
POST
|
Hi Dan, Thanks for the email. This is a new export from ArcGIS Pro to a VectorTilePackage My understanding is ESRI default tiling SRS is EPSG: 3857. Both the Map and the Layers have been projected from BNG:27700 to EPSG: 3857. Regards, Clive
... View more
02-22-2021
05:51 AM
|
0
|
0
|
3352
|
POST
|
Greetings, I am trying to export an ArcGIS Pro project to a Vector Tile Package. I am getting an ERROR 000707: Spatial reference of the tiling scheme does not match the spatial reference of the map I found an ESRI Support posting that stated change the Map projection to WGS 1984 Web Mercator projection. I updated the Map projection to WGS 1984 Web Mercator: I am still getting ExecuteError: ERROR 000707 Any suggestions?? Regards, Clive
... View more
02-22-2021
04:17 AM
|
1
|
4
|
3470
|
POST
|
Greetings, You use and .ags file to connect to ArcGIS Server and a .sde file to connect to SDE. What is the method to connect to the Enterprise DataStore - a PostgreSQL database?? I haven't found any information on the ArcGIS Enterprise webpage, that explains how to connect. Any pointers appreciated. Regards, Clive
... View more
02-08-2021
02:02 AM
|
0
|
3
|
3492
|
POST
|
Greetings, I have a query reading the Shape field, to return the number of records. The code is: for ds in datasets:
for fc in arcpy.ListFeatureClasses(feature_dataset=ds):
cursor = arcpy.SearchCursor(fc)
new_name = fc.split('.')[-1]
#print(new_name)
#path = os.path.join(arcpy.env.workspace, ds, fc)
#### PRINT full name
rowitem = ([fc])
#### PRINT Feature name
#rowitem = ([new_name])
print(rowitem)
#Count_feat = arcpy.GetCount_management(rowitem.objectid)
query = "SELECT '*' FROM 'Shape'"
#print(rowitem, query)
arcpy.SelectLayerByAttribute_management(fc, "NEW_SELECTION", query )
Count_feat = arcpy.GetCount_management(fc)
print(Count_feat) The error message is: START
LOOP
['server.gis.Rail_Systems']
Then error:
ExecuteError Traceback (most recent call last)
<ipython-input-24-43e73deac686> in <module>
47 query = "SELECT '*' FROM 'Shape'"
48 #print(rowitem, query)
---> 49 arcpy.SelectLayerByAttribute_management(fc, "NEW_SELECTION", query )
50 Count_feat = arcpy.GetCount_management(fc)
51 print(Count_feat)
C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py in SelectLayerByAttribute(in_layer_or_view, selection_type, where_clause, invert_where_clause)
8752 return retval
8753 except Exception as e:
-> 8754 raise e
8755
8756 @gptooldoc('SelectLayerByLocation_management', None)
C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py in SelectLayerByAttribute(in_layer_or_view, selection_type, where_clause, invert_where_clause)
8749 from arcpy.arcobjects.arcobjectconversion import convertArcObjectToPythonObject
8750 try:
-> 8751 retval = convertArcObjectToPythonObject(gp.SelectLayerByAttribute_management(*gp_fixargs((in_layer_or_view, selection_type, where_clause, invert_where_clause), True)))
8752 return retval
8753 except Exception as e:
C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py in <lambda>(*args)
509 val = getattr(self._gp, attr)
510 if callable(val):
--> 511 return lambda *args: val(*gp_fixargs(args, True))
512 else:
513 return convertArcObjectToPythonObject(val)
ExecuteError: ERROR 000358: Invalid expression
Failed to execute (SelectLayerByAttribute). I would appreciate any pointers. Regards, Clive
... View more
02-05-2021
07:18 AM
|
1
|
2
|
6789
|
POST
|
Greetings, I am trying to read in a list from a csv file, using that to select Features within SDE. The list is empty?? The csv file is: server.gis.BreedingBirdSurvey_Tbl,
server.gis.Heronries_Tbl,
server.gis.Invertebrates_Pt,
server.gis.Vertebrates_Pt,
server.gis.FreshwaterFishCounts_Pt,
server.gis.InvasiveNonNativeSpecies_Pt,
server.gis.MacroinvertebrateSurvey_Pt,
server.gis.MacrophyteSurvey_Pt,
server.gis.PriorityHabitat_Pt,
server.gis.RiverHabitatSurveys_Pt,
server.gis.NonNative_Pt,
server.gis.RareProtectedSpecies_Pt The code is: #### Features
fcs = arcpy.ListFeatureClasses("server.gis.*")
#### CSV file
asc_f = r"W:\My Documents\user\AS_1.csv"
print("LOOP")
with open(asc_f, mode='r') as csv_file:
csv_reader = csv.DictReader(csv_file)
for row in csv_reader:
#print(row)
for fc in fcs:
if fc == row:
new_name = fc.split(".")[-1]
#print(fc)
print(row)
#arcpy.FeatureClassToFeatureClass_conversion(fc, outLocation, new_name)
else:
print("NOT in list")
############
print("END") From
print("LOOP")
with open(asc1_f, mode='r') as csv_file:
csv_reader = csv.DictReader(csv_file)
for row in csv_reader:
print(row)
This returns:
START
LOOP
OrderedDict([('server.gis.BreedingBirdSurvey_Tbl', 'server.gis.Heronries_Tbl')])
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
OrderedDict([('server.gis.BreedingBirdSurvey_Tbl', 'server.gis.Invertebrates_Pt')])
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
OrderedDict([('server.gis.BreedingBirdSurvey_Tbl', 'server.gis.Vertebrates_Pt')])
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
OrderedDict([('server.gis.BreedingBirdSurvey_Tbl', 'server.gis.FreshwaterFishCounts_Pt')])
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
OrderedDict([('server.gis.BreedingBirdSurvey_Tbl', 'server.gis.invertebrateSurvey_Pt')])
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
OrderedDict([('server.gis.BreedingBirdSurvey_Tbl', 'server.gis.MacrophyteSurvey_Pt')])
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list It returns:
START
LOOP
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list
NOT in list I expected:
'server.gis.BreedingBirdSurvey_Tbl',
'server.gis.Heronries_Tbl'
'server.gis.Invertebrates_Pt'
'server.gis.Vertebrates_Pt'
'server.gis.MacrophyteSurvey_Pt'
'server.gis.Ancient_Woodland'
'server.gis.Sites_Special_Scientific_Interest'
'server.gis.Sites_Special_Scientific_Interest_GRP'
'server.gis.Special_Protection_Areas'
OR
"server.gis.BreedingBirdSurvey_Tbl"
"server.gis.Heronries_Tbl"
"server.gis.Invertebrates_Pt"
"server.gis.Vertebrates_Pt"
"server.gis.MacrophyteSurvey_Pt"
"server.gis.Ancient_Woodland"
"server.gis.Sites_Special_Scientific_Interest"
"server.gis.Sites_Special_Scientific_Interest_GRP"
"server.gis.Special_Protection_Areas" I would appreciate any pointers
... View more
02-05-2021
05:29 AM
|
0
|
1
|
2050
|
POST
|
Greetings, I am working with ArcGIS pro 2.6.0 I created Metadata for a number of layers, that I can view, when I select View Metadata. However when I forward a file gdb to my colleagues, they cannot view the data. Could this be due to a file lock, or ??? All the icons are green, and w e don't get any error message!! It is really annoying to spend ages setting-up the Metadata, and it doesn't work as expected. I would appreciate any pointers.. Regards, Clive
... View more
01-15-2021
05:02 AM
|
0
|
3
|
1136
|
POST
|
I am using Pycharm. That happens when spend 4 hours working on a problem. Not throwing any errors, doesn't seem to read the csv?? It didn't return a single Features.
... View more
01-07-2021
03:11 PM
|
1
|
1
|
9080
|
POST
|
It is running but not returning the csv?? f = open("W:\My Documents\user\Priority List 1.csv")
envarp_list = csv.reader(f)
print("LOOP")
fcs = arcpy.ListFeatureClasses("server.gis.*")
for fc in fcs:
new_name = fc.split(".")[-1]
for envarp in envarp_list:
if fc == envarp:
print(fc)
print(new_name)
arcpy.FeatureClassToFeatureClass_conversion(fc, outLocation, new_name)
else:
print("NOT in list")
print("END") Just returns not in the file. There are thousands of Features and I want to export a subset to gdb???
... View more
01-07-2021
02:53 PM
|
1
|
1
|
9084
|
POST
|
Greetings, I am getting an error from a list from a csv that I want to use to loop through features in SDE. It was working, but is throwing an error now?? envarp_list = ["AirQualityReceptors_Ply", "AirQualityReceptors_Pt", "LandscapeCharacterAreas_Ply", "Viewpoints_Pt","LV_ZTV_Ply", "AssessmentLocationsAll_Pt"] envarp_list = ["AirQualityReceptors_Ply", "AirQualityReceptors_Pt", "LandscapeCharacterAreas_Ply", "Viewpoints_Pt","LV_ZTV_Ply", "AssessmentLocationsAll_Pt"]
print("LOOP")
fcs = arcpy.ListFeatureClasses("server.gis.*")
for fc in fcs:
for envarp in arcpror1_list:
if fc == envarp:
print(fc)
print(new_name)
arcpy.FeatureClassToFeatureClass_conversion(fc, outLocation, new_name)
else:
print("NOT in list")
print("END") The list is much longer, it would be good to read directly from the csv file. Error message is: SyntaxError Traceback (most recent call last)
File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\ast.py, in parse:
Line 35: return compile(source, filename, mode, PyCF_ONLY_AST)
SyntaxError: invalid syntax (<string>, line 29) This was working earlier with a smaller list, really need to read it from the csv, without looping 4 times Any pointers appreciated. Clive
... View more
01-07-2021
01:38 PM
|
1
|
8
|
9100
|
POST
|
Greetings, I can return and loop through a list of Features that I want to export to a file gdb. I can't add the gdb + Feature as a variable to export. It fails in the arcpy.FeatureClassToFeatureClass_conversion(Features, outLocation, outFeatures) section. I would appreciate any pointers, and/or links to help resolve this. import arcpy
import arcgis
from arcgis.gis import *
from arcgis.gis import GIS
from arcgis.features import FeatureLayer
from arcgis.features import FeatureLayerCollection
import pandas as pd
## SET Parameters
arcpy.env.orverwriteOutput = True
arcpy.env.workspace = r"D:\Users\user\Documents\ArcGIS\Projects\Databases\SDE.sde"
datasets = arcpy.ListDatasets(feature_type='feature')
datasets = [''] + datasets if datasets is not None else []
print("START")
## output file
outLocation = (r"W:\My Documents\user\ENV.gdb\ENV")
inFeatures = ""
outFeatures = inFeatures
#### EXPORT DATA
for ds in datasets:
for fc in arcpy.ListFeatureClasses(feature_dataset=ds):
new_name = fc.split('.')[-1]
#print(new_name)
Features = ([new_name])
print(inFeatures)
arcpy.FeatureClassToFeatureClass_conversion(Features, outLocation, outFeatures) The arcpy error message
RuntimeError Traceback (most recent call last)
<ipython-input-13-f520ea9e3f4b> in <module>
38 Features = ([new_name])
39 print(inFeatures)
---> 40 arcpy.FeatureClassToFeatureClass_conversion(Features, outLocation, outFeatures)
41
42 # outFile.close
C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\conversion.py in FeatureClassToFeatureClass(in_features, out_path, out_name, where_clause, field_mapping, config_keyword)
2098 return retval
2099 except Exception as e:
-> 2100 raise e
2101
2102 @gptooldoc('FeatureClassToGeodatabase_conversion', None)
C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\conversion.py in FeatureClassToFeatureClass(in_features, out_path, out_name, where_clause, field_mapping, config_keyword)
2095 from arcpy.arcobjects.arcobjectconversion import convertArcObjectToPythonObject
2096 try:
-> 2097 retval = convertArcObjectToPythonObject(gp.FeatureClassToFeatureClass_conversion(*gp_fixargs((in_features, out_path, out_name, where_clause, field_mapping, config_keyword), True)))
2098 return retval
2099 except Exception as e:
C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py in <lambda>(*args)
509 val = getattr(self._gp, attr)
510 if callable(val):
--> 511 return lambda *args: val(*gp_fixargs(args, True))
512 else:
513 return convertArcObjectToPythonObject(val)
RuntimeError: Object: Error in executing tool Regards, Clive
... View more
01-05-2021
05:06 AM
|
0
|
1
|
1935
|
POST
|
Greetings, I am working in a locked down environment where I can't install any Python modules, so I have to rely on arcpy while working with SDE PostgresSQL. I don't get any error message connecting, it doesn't return an error for the list of tables, only returns the wildcard, not the tables. for tbl in tables:
print(tbl)
## Only returns a single wildcard, not a list of tables I get a DBMS error "-37 DBMS Table not found" when doing select or count.. import os, sys
import arcpy
import arcgis
arcpy.env.workspace = r"D:\Users\user\Documents\ArcGIS\Projects\Databases\Databases.gdb"
sdeconn = arcpy.ArcSDESQLExecute(r"Z:\a - Connection Files\gisserver_branch.sde")
tables = ["%"]
## Logged IN
print("Logged IN")
for tbl in tables:
print(tbl)
sql = "select objectid from PRP_LandParcels_Ply"
sdeconn_tables=sdeconn.execute(sql) Appreciate any pointers, to get this working. Regards, Clive
... View more
12-29-2020
06:10 AM
|
1
|
2
|
1908
|
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
|