POST
|
I have, I get the follow. The top and bottom row are offset for some reason. It could be because not a symmetrical square.
... View more
08-07-2024
03:17 PM
|
0
|
2
|
720
|
POST
|
I did try that and create fishnet, but every time I run those the grid doesn't stay within the polygon. It seems to be rotated and not aligned. In the attached picture, the tan is the original polygon and the red grid is what is created by the Grid Index Features tool, it doesn't follow the original polygon.
... View more
08-06-2024
02:14 PM
|
0
|
0
|
759
|
POST
|
I have this polygon that I need to cut into pieces, 10 horizontal and 10 vertical blocks. My though was converting the polygon to polylines, (pic 1) then break the polyline into 4 parts, then creating the 10 horizontal and 10 vertical lines, then converting those into polygons. The issue I am having is that when creating the segments, the west and south boundary have 20 segments. Not know why 20 segments were being created for the west and south boundary. I did a arcpy.management.FeatureVerticesToPoints and that it was creating two segments for the west and south polylines (pic 2). I am not sure how this can happen given that the polyline comes from the polygon. import arcpy
# Define your workspace and input feature class
arcpy.env.workspace = r"C:\Temp\Sec.gdb"
input_fc = "Sec_1N2W30"
output_fc = "Polygons_Output" # This will store the polygons
segment_fc = "Segmented_Polylines" # This will store the segmented polylines
# Convert features to polygons
arcpy.management.FeatureToPolygon(input_fc, output_fc)
# Create an empty Polyline feature class for segmented polylines
arcpy.CreateFeatureclass_management(arcpy.env.workspace, segment_fc, "POLYLINE")
# Create a cursor to insert segmented polylines
with arcpy.da.InsertCursor(segment_fc, ["SHAPE@"]) as insert_cursor:
# Iterate over each polygon in the output_fc
with arcpy.da.SearchCursor(output_fc, ["SHAPE@"]) as search_cursor:
for row in search_cursor:
polygon = row[0]
# Get the exterior ring of the polygon
exterior_ring = polygon.boundary()
# Iterate over each part of the exterior ring
for part in exterior_ring:
if len(part) < 2:
continue
for i in range(len(part) - 1):
p1 = part[i]
p2 = part[i + 1]
line = arcpy.Polyline(arcpy.Array([p1, p2]))
length = line.length
segment_length = length / 10
# Create points at each segment interval
points = [p1]
for j in range(1, 10): # 9 additional points to create 10 segments
segment_point = line.positionAlongLine(j * segment_length)
points.append(segment_point.firstPoint)
points.append(p2)
# Ensure no duplicate points by slightly adjusting them
unique_points = []
for point in points:
if not unique_points or unique_points[-1] != point:
unique_points.append(point)
# Create polylines from the unique points and insert them
for k in range(len(unique_points) - 1):
segment_line = arcpy.Polyline(arcpy.Array([unique_points[k], unique_points[k + 1]]))
insert_cursor.insertRow([segment_line])
print("Segmented polylines created successfully in", segment_fc)
... View more
08-06-2024
11:15 AM
|
0
|
6
|
794
|
POST
|
My issue was, I put the polygon layer inside the geodatabase feature data set. Once I have the polygons layer and table in the geodatabase root folder, everything worked fine.
... View more
01-17-2024
01:49 PM
|
0
|
0
|
925
|
POST
|
I'm attempting to execute a straightforward select by location operation using "Have their center in" with Pro. I initially thought this was comparable to ArcMap's Select by Location with the condition "Have their centroid in the source layer feature." However, when I try to perform the same operation in ArcGIS Pro using "Have their center in," I encounter the following error: "Error 160306: The server was not found." My objective is to select features from Layer B whose centroid falls within the boundaries of polygons in Layer A.
... View more
01-16-2024
03:48 PM
|
0
|
4
|
1049
|
POST
|
Essentially, I need to create point features for every record in the table, which falls within a parcel. I do have CopyFeatures which is suppose to create the features, from what I have read. What is happening is that, if I run the stand alone script the join.management works but as mentioned I creates duplicates not all the attributes from the table get transferred after doing a copyfeature. Upon incorporating the script into a model, the Join management function behaves differently from the standalone script. It fails to establish a one-to-many join as observed in the script.
... View more
01-11-2024
04:02 PM
|
0
|
0
|
596
|
POST
|
When I search for joining one to many, I found that join.management should work, unless it doesn't truly work? Add Join (Data Management)
... View more
01-09-2024
08:00 AM
|
0
|
2
|
640
|
POST
|
It is making a duplicate but for example the table will have 4 attributes and the feature class will have one attributes. It it creates a duplicate four times, how can I get it to create new records for keep the attributes from the table? Table Table Acct Field A 14970201 MH 14970201 SFR 14970201 CON 14970201 RV Feature class Acct FieldA 14970201 MH After Join. 14970201 MH 14970201 MH 14970201 MH 14970201 MH
... View more
01-08-2024
02:55 PM
|
0
|
0
|
756
|
POST
|
I have a feature class and a table that I need to join. The table and feature class share a common field, The table will have duplicate Acc (ID's), and the Feature class will have just one Acc (ID's). Both are in the same file geodatabase, both have objectIds. The following doesn't crate the one to many join, what am I missing? arcpy.env.workspace = "C:/Temp/test.gdb"
fc = "C:/Temp/test.gdb/TaxPs"
sourceTB = "C:/Temp/test.gdb/table"
arcpy.MakeFeatureLayer_management(fc, "TaxPs")
arcpy.AddJoin_management("TaxPs", "Acc", sourceTB, "Acc", "KEEP_COMMON")
arcpy.management.CopyFeatures(fc, os.path.join(arcpy.env.workspace, "Taxps_Joined"))
... View more
01-08-2024
02:42 PM
|
0
|
5
|
763
|
POST
|
I am trying to create a feature layer from the current selection. The selection can be one feature or multiple features. I have an ERROR 000358: Invalid expression on line 9. I am assuming my where clause is wrong? ptSelection = "points"
parcel = 'TaxParcels'
PF = "memory\PointFeat"
selected_features = arcpy.Describe(ptSelection).FIDSet
where_clause="OBJECTID = {}".format(selected_features)
arcpy.MakeFeatureLayer_management(ptSelection, PF, where_claus
... View more
10-25-2023
03:28 PM
|
0
|
3
|
936
|
POST
|
I need to copy features that are not Null. I need to use the arcpy.management.CopyFeatures because I am doing a join, that is one to many. The issue I am having is that my query to select "IS NOT NULL" doesn't work. I don't get an error, what is the correct syntax for this query? Source = "Parcels"
Lyr = "Par"
fieldName = "TAXID"
select = """{0} IS NOT NULL""".format(fieldName)
arcpy.management.MakeFeatureLayer(TAXSource, Lyr)
arcpy.SelectLayerByAttribute_management(Lyr, "NEW_SELECTION", select)
arcpy.management.CopyFeatures(Lyr, "C:Temp/test.gdb/TestPar") Lyr = "TaxPar"
#fieldName = "TAXID"
select = "TAXID IS NOT NULL" #"'TAXID = IS NOT NULL'"
arcpy.management.MakeFeatureLayer(TAXSource, Lyr, select)
arcpy.management.CopyFeatures(Lyr, "C:Temp/test.gdb/Testpar")
... View more
07-17-2023
03:15 PM
|
0
|
1
|
658
|
POST
|
After testing and testing, I figured out why I kept getting that error, at least I think. You have to be the owner/creator of that of that enterprise SDE gdb. The soils feature class was from another departments enterprise SDE gdb. It works on my enterprise SDE gdb but if the template is from another enterprise SDE gdb not owned or created by you it won't work. I've tested this a dozen times, that is how it functions for me.
... View more
06-15-2023
08:31 AM
|
0
|
0
|
1295
|
POST
|
The soils layer resides in an SDE feature class/ feature dataset and I have other shapefiles and SDE feature classes in this project. No matter what sde feature class I changed the templateFC to, if it's in a feature class I get the error I posted. It works fine if the templateFC is a shapefile...?
... View more
06-14-2023
11:58 AM
|
0
|
3
|
1317
|
POST
|
I am trying to create an empty feature class in the projects folder directory, but I get the following error. How can use arcpy.management.CreateFeatureclass to create an empty feature class in the projects folder? import arcpy
import os, sys
import time
from arcpy import env
t1 = time.time()
aprx = arcpy.mp.ArcGISProject("CURRENT")
m = aprx.listMaps()[0]
lyr = m.listLayers("Soil")[0]
arcpy.env.workspace = os.path.dirname(aprx.filePath)
wp = os.path.dirname(aprx.filePath)
outPath = wp
NewLyr = "Soils_New"
template = "Soil"
out_fc = arcpy.management.CreateFeatureclass(outPath, NewLyr, template) Error Traceback (most recent call last):
File "<string>", line 20, in <module>
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 3451, in CreateFeatureclass
raise e
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 3448, in CreateFeatureclass
retval = convertArcObjectToPythonObject(gp.CreateFeatureclass_management(*gp_fixargs((out_path, out_name, geometry_type, template, has_m, has_z, spatial_reference, config_keyword, spatial_grid_1, spatial_grid_2, spatial_grid_3, out_alias), True)))
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: ERROR 160142: The Field type is invalid or unsupported for the operation.
Failed to execute (CreateFeatureclass).
... View more
06-14-2023
07:42 AM
|
0
|
6
|
1350
|
Title | Kudos | Posted |
---|---|---|
1 | 10-27-2022 11:37 AM | |
1 | 10-31-2023 10:16 AM | |
1 | 02-16-2023 01:50 PM | |
1 | 08-11-2021 11:13 AM | |
1 | 01-06-2021 10:45 AM |
Online Status |
Offline
|
Date Last Visited |
09-10-2024
10:42 AM
|