POST
|
Is it possible to access the Distance and Direction tools, specifically Create Sector, via python or ModelBuilder? I need to be able to create a 65 degree wide pie wedge from a central point given a specific wind direction. This is easy enough with the Distance and Direction tools in Pro, but I need to be able to do this as a web service. I know there is already a Distance and Direction widget, but it does not appear to have the "sector" option and it needs to be less interactive: i.e., a single user input such as "12 degrees."
... View more
07-17-2023
01:26 PM
|
1
|
0
|
281
|
POST
|
I am attempting to align school floorplans with the building footprint. Unfortunately for me, the floorplans do not appear to be to scale. The Scale Geometry feature scales proportionately in all directions. I only need to do it in one. See example.
... View more
11-09-2020
11:35 AM
|
0
|
1
|
297
|
POST
|
I've read through most of the other similar questions and nothing so far has addressed my issue; most are about syntax. I'm trying to select by attribute from a Feature Layer. But every time, Arc announces that it succeeded and nothing is selected. It works just fine using the same expression to select from a Table View. Any ideas? expression = arcpy.AddFieldDelimiters(tempFeatureLayer, "BLDG_ID") + " LIKE '{0}%'".format(county)
arcpy.SelectLayerByAttribute_management(tempFeatureLayer, "NEW_SELECTION", expression)
if int(arcpy.GetCount_management(tempFeatureLayer)[0]) > 0:
arcpy.DeleteRows_management(tempFeatureLayer) It's an SDE Database feature class, if that makes a difference. I've also tried rewriting the expression as below with the same result: expression = """ "BLDG_ID" LIKE '37019%'""" and expression = "BLDG_ID LIKE '37019%'"
... View more
08-28-2019
06:09 AM
|
0
|
2
|
563
|
POST
|
I have been trying to work with countywide contours, either producing or clipping, and every time Pro will peg my physical memory usage and eventually give me an out of memory error. Is there some secret setting to prevent this?
... View more
04-11-2019
09:19 AM
|
1
|
0
|
263
|
POST
|
Figured it out. New code: with arcpy.da.SearchCursor(BIG_TABLE, FieldNameList) as searchRows:
with arcpy.da.InsertCursor(new_table, FieldNameList) as InsertTable:
for row in searchRows:
if row[0] in SUMMARY_Set:
InsertTable.insertRow(row)
... View more
02-17-2016
09:43 AM
|
0
|
0
|
295
|
POST
|
I'm attempting to write a script that will extract specific records from another very large table (29 million records) so that I can run a QC on the extracted data. My plan was to create a set object containing record ID’s I'm interested in. I would then perform a da.SearchCursor to match each of the 29 million records to the values in my set object. Any matching row would then be copied into a new table with a da.InsertCursor instance. It didn’t work and I have no idea why. I only have issues if I try to use a conditional statement to insert rows into a new table. Any other 'then' statement works just fine. Can someone help me figure out where my problem is? Or suggest a work around? SUMMARY_Set = ([CID, or, a, bunch, of, Community, IDs]) #interested in the ‘CID’ field
FGDB = r'D:\~Working\Developement\RISK\QC_Test.gdb'
BIG_TABLE = r'Database Connections\NC_RISK.sde\NC_RISK.sql.L_DAMAGE_SUMMARY_JURISDICTION'
new_table = os.path.join(FGDB, "L_DAMAGE_SUMMARY_JURISDICTION")
arcpy.CreateTable_management(FGDB, "L_DAMAGE_SUMMARY_JURISDICTION", BIG_TABLE)
FieldNameList = []
fieldnames = arcpy.ListFields(BIG_TABLE)
for field in fieldnames:
FieldNameList.append(field.name)
InsertTable = arcpy.da.InsertCursor(new_table, FieldNameList)
with arcpy.da.SearchCursor(BIG_TABLE, FieldNameList) as searchRows:
for row in searchRows:
if row[0] in SUMMARY_Set:
InsertTable.insertRow(row) I used the same code without the conditional statement and the rows copied into a new table just fine. it took a while, but all the records were there. with arcpy.da.SearchCursor(SUMMARY_LAYERS, FieldNameList) as searchRows:
for row in searchRows:
InsertTable.insertRow(row) I modified the code again to only print the matching rows instead of inserting them into a new table. It worked just like I had intended it to. >>> FieldNameList.index("CID")
0
>>> with arcpy.da.SearchCursor(BIG_TABLE, FieldNameList) as searchRows:
... for row in searchRows:
... if row[0] in SUMMARY_Set:
... print row[0] + " is in SUMMARY_Set"
...
370042 is in SUMMARY_Set
370042 is in SUMMARY_Set
370042 is in SUMMARY_Set
370042 is in SUMMARY_Set
370042 is in SUMMARY_Set
... View more
02-17-2016
08:03 AM
|
0
|
1
|
1447
|
POST
|
Thanks James, Of course I was trying to make things way more difficult than they needed to be. I had originally gone down this route because I was unable to access the sql.L_HAZARDPROBABILITY table after performing a os.path.join on the database and the table name. I left out the very important "sql." I will look into this other method when I start down the SQL path again--shouldn't be too long.
... View more
01-12-2016
07:22 AM
|
1
|
0
|
552
|
POST
|
I am trying to teach myself to access sql tables in an SDE database from an Arcpy script as part of a larger QC process. I am fairly certain I have the sql statement correct (it works in SQL Server, albeit formatted a little differently - the python window didn't like the line breaks), but I have no clue how to return my declared sql variable back as a python variable so that I may run other stuff on it. Ultimately, I would like to be able to run stored procedures via the script, but baby steps first. I am trying to check a sql table in a SDE Database to see if the value of a single column is smaller than 1000 but larger than 10. If there are values outside of this range, I need to run other processes. This is what I've got so far: SDE = r'Database Connections\NC_RISK - test - 106.sde'
SQLLink = arcpy.ArcSDESQLExecute(SDE)
L_HAZARDPROBABILITY = r'\NC_RISK.sql.L_HAZARDPROBABILITY'
sql = """LARE @MyBadIndicator int; SET @MyBadIndicator = 0; SET @MyBadIndicator = SELECT 1 WHERE EXISTS (SELECT L_HAZARDPROBABILITY.F_EVENT
FROM L_HAZARDPROBABILITY WHERE L_HAZARDPROBABILITY.F_EVENT<10 Or L_HAZARDPROBABILITY.F_EVENT >1000)""" SQL has always been a little intimidating to me (primarily b/c I've just never known where to start). So, I just going to jump in head first. Any help would be greatly appreciated. If there are any recommended resources I should check out to learn this stuff, that would be appreciated as well. I have been playing around with this a little more trying to get something to happen, anything really, and I keep getting the same errors. In the above script, I never execute the sql query. When I do, I receive the following error: AttributeError: ArcSDESQLExecute: StreamPrepareSQL ArcSDE Error -37 \ue61c I tried changing the query to sql = "SELECT F_EVENT FROM L_HAZARDPROBABILITY WHERE F_EVENT<10" and I get the same error. When I change the code to try:
sql = "SELECT F_EVENT FROM L_HAZARDPROBABILITY WHERE F_EVENT<10"
result = SQLLink.execute(sql)
except Exception as err:
print (err)
result = False
I get
UnicodeEncodeError: 'ascii' codec can't encode character u'\ue61c' in position 52: ordinal not in range(128) Message was edited by: John Lay to include further experimentation.
... View more
01-12-2016
04:58 AM
|
0
|
2
|
2621
|
POST
|
I am hoping for a little clarification on how scripting env.XYResolution and/or env.XYTolerance adjustments work. My script works; I have a question about why it works the way it does. Because I need to match the work done by another department, I need to create a feature dataset with resolution values equal to 0.01 feet and all the tolerances equal to 0.02 feet. I thought creating a spatial reference (arcpy.CreateSpatialReference_management) to use in the feature dataset creation would do it, but it only gets me halfway there. I still end up needing to change the XY resolution and tolerance through the environment (env) function. I’m just confused why it needs to be written the way it does. This works: XY_Resolution = arcpy.env.XYResolution
arcpy.env.XYResolution = "0.01 Feet"
XY_Tolerance = arcpy.env.XYTolerance
arcpy.env.XYTolerance = "0.02 Feet"
arcpy.CreateFeatureDataset_management(TerrainGDB, DatasetName, Coordinate_System)
arcpy.env.XYResolution = XY_Resolution
arcpy.env.XYTolerance = XY_Tolerance This does not: arcpy.CreateFeatureDataset_management(TerrainGDB, DatasetName, Coordinate_System)
arcpy.env.XYResolution = "0.01 Feet"
arcpy.env.XYTolerance = "0.02 Feet" Why does the first example work and the second not? The first example just seems overly redundant: XY_Resolution = arcpy.env.XYResolution = "0.01 Feet" = arcpy.env.XYResolution = XY_Resolution. Maybe I’m just trying to make it too complicated. Can someone help explain this to me? I keep thinking I have it figured out. But then I think a little bit more and lose it. Is XY_Resolution = arcpy.env.XYResolution behaving kind of like Coordinate_System = arcpy.CreateSpatialReference_management only without the “create” verbiage and the parameters? Meaning that arcpy.env.XYResolution can’t be set by anything but another environment setting. But then, arcpy.env.XYResolution is being set by the value “0.01 Feet” and not by another environment setting. The help doesn’t say anything about setting up the code like the first example, only "arcpy.env.XYTolerance = linear_unit". But the first example is what's produced when the process is exported from ModelBuilder. I feel like I’m missing some giant concept that would make this all make more sense. Thanks.
... View more
06-08-2015
04:52 AM
|
0
|
2
|
3944
|
POST
|
No, unfortunately they are being stored in file geodatabases so that they can be distributed. The ESRI File Geodatabase (FileGDB) driver looks interesting, however. I'm off to figure out how it works. Thanks!
... View more
05-28-2015
05:46 AM
|
0
|
1
|
775
|
POST
|
Thanks Todd. We are on the same page. What little I could find is that the "guts" of the geodatabase are not visible to python but are to ArcObjects. There are a number of references to a gentleman named Mark Cederholm who did some work a couple years back (9.3 & 10.0) with the comtypes module that can access ArcObjects. He was working with comtypes 0.6.2 found at sourceforce. Others have continued to update his Snippets module for successive releases. But Comtypes is now at 1.1.1 if you search Python.org, and I've found no acknowledgment of this new comtypes version whenever anyone speaks of Mr. Cederholm. I've looked at Esri's ArcObjects Recource Center and I believe I have found the functions to do what I want to do, but I never learned ArcObjects and code examples to study and learn from are hiding from me if they exist in the recourse center. It appears that ITerrain Interface has "Properties Members" for DataSource and PyramidLevel. But like I said, I know nothing about ArcObjects. You don't know of any tutorials or learning sites that I can get a crash course in ArcObjects do you? How 'bout Comtypes?
... View more
05-28-2015
05:03 AM
|
1
|
3
|
1119
|
POST
|
The more I scour the web for a solution to this problem, the more I'm beginning to believe that this will not be solved with python alone but with the comtypes module and ArcObjects. I know nothing about either. If someone knows a good learning source, I'd appreciate it. Esri's ArcObjects Resource Center is not very helpful.
... View more
05-28-2015
03:08 AM
|
0
|
0
|
1119
|
POST
|
Unfortunately, Terrains are stored in geodatabases.
... View more
05-27-2015
09:30 AM
|
0
|
0
|
1119
|
POST
|
Larry, I do not need help building a terrain model. I know how to do that. I have no idea where you are coming up with this. I have asked a very specific question and you are providing answers to anything but. Go back and read, carefully, my previous posts. (No fair editing out your responses) I am fully aware of what class our ground is. I know the multipoints should only be ground points for a surface model, not all classes. I know how to change the resolution and tolerances once the terrain is built. I do not need a lesson in LAS properties or LiDAR, You are are making assumptions about imaginary problems. Let me repeat, I do not need to know how to build a terrain. What I need to know is how to check, with python, to see if the terrain model (that, yes, is contained within the feature dataset inside a file geodatabase) has pyramids. If the terrain has pyramids I need the python script to skip the process of adding pyramids. I then need to check to see if the terrain model has data sources. If the terrain has data sources, I need the python script to skip that process. And so on. The problem I am having, and the ONLY problem I am having, is finding a way to have python check a terrain model for various properties. At this point in the script process, I don't care about the LiDAR or ground points. Their job is done. All I care about is whether or not pyramids or data sources have been added to the terrain model. That's it. Nothing more.
... View more
05-27-2015
03:34 AM
|
2
|
0
|
1119
|
POST
|
The LiDAR is not the issue. The LiDAR LAS are v1.3. I need to create terrain models for each of 20 counties to match 20 other counties that were created by a contractor. Each terrain model must contain layers that are specific to each county, including hydrology and clipping boundaries. I'm not building rasters. The process is: LAS to Multipoint Create Terrain Add pyramids to terrain add layers to terrain (hydro line, clip bounds, multipoints (embedded)) change terrain resolution (for hydro breaklines) build terrains. The script failed at add layers to terrain for some unknown reason. As i said previously, separating this bit of code and running as a single process worked just fine. Instead of starting from scratch every time (last time took 18 hours to get to add layers to terrain), I want to start where the script broke: e.g. the add layers to terrain. In order to do so, however, I need the script to be able to identify that the terrain already has pyramids. Additionally, since I tested the bit a script that failed previously and the terrain now also has the proper layers added, I need the script to check for that too. I have been unable to find anywhere on line that addresses how to read the properties of the terrain model.
... View more
05-26-2015
07:18 AM
|
1
|
2
|
1119
|
Title | Kudos | Posted |
---|---|---|
1 | 07-17-2023 01:26 PM | |
1 | 05-26-2015 07:18 AM | |
1 | 05-28-2015 05:03 AM | |
1 | 04-11-2019 09:19 AM | |
1 | 01-12-2016 07:22 AM |
Online Status |
Offline
|
Date Last Visited |
07-19-2023
06:26 PM
|