|
POST
|
I need to automate the creation of nearly 100 check-outs .gdbs. Each check-out will have a site-specific name and be limited to a geographic extent from boundary layers of the same name. Are there some existing tools that may get us started, or will this need to be a from-scratch effort? I put together a simple process with arcpy.CreateReplica_management to create a single output, but I'm trying to wrap my head around the rest of our requirements. Thanks for any help nudging me in the right direction. Justin
... View more
02-10-2017
09:57 AM
|
0
|
0
|
803
|
|
POST
|
Thanks again Darren. That nudged me in the correct direction and I have things running the way I need them to now. Greatly appreciated. Sincerely, Justin
... View more
12-02-2016
08:08 PM
|
0
|
0
|
1283
|
|
POST
|
Thanks Darren, I needed to fix a syntax and I have that working. Now...is it possible for me to assign variables based on the data frame coordinate system? Specifically, if the data frame coordinate system is UTM WGS84, the units are meters. I'd like to establish something like, "if data frame coordinate system units are meters, then variable1 = 'metre', variable2 = 'squareMetre', etc." I don't know how to 'query' the df. Thanks again. Justin
... View more
12-02-2016
02:27 PM
|
0
|
2
|
1283
|
|
POST
|
Is it possible to use the coordinate system from a data frame in the current map document within an update cursor? I have data in GCS WGS84 and I want to update area/perimeter/length fields across a geodatabase with UTM WGS84 units. I want to acquire a coordinate system for the cursor from the current map data frame coordinate system, not a reference feature class. A piece of my current script is below, which would return useless area/length values from GCS coordinates: for fc in fcList:
fc = fc +"\\"
fieldList = arcpy.ListFields(fc, 'lengthSize')#lengthSize field
fieldCount = len(fieldList)
if (fieldCount > 0):
print "perimeterSize field present in: " + fc
arcpy.AddMessage ("perimeterSize field present in: " + fc)
with arcpy.da.UpdateCursor (fc, ['SHAPE@LENGTH', 'lengthSize']) as cursor:
for row in cursor:
row[1] = row[0]
cursor.updateRow(row)
print "Updating 'lengthSize' field in: " + fc
arcpy.AddMessage ("Updating 'lengthSize' field in: " + fc)
else:
print "No lengthSize field in: ", fc
arcpy.AddMessage ("No lengthSize field in: " + fc) Is this possible, or does a "describe" (like that found here: http://pro.arcgis.com/en/pro-app/arcpy/get-started/setting-a-cursor-s-spatial-reference.htm) have to be used? Thanks Justin
... View more
12-02-2016
12:35 PM
|
0
|
4
|
2936
|
|
POST
|
Is it possible to create multiple, check-out replica geodatabases via script? We have a SQL Server, GCS WGS84 sde (all feature datasets are in the same GCS WGS84 coordinate system) database containing data from around 100 locations across the country (continental United States). Each location edits data independently. The schema is quite large, comprised of some 500+ feature classes across 30+ feature datasets. Check-out dbs for each location must each be in local, UTM WGS84 coordinate system (we are using the methodology described here: http://support.esri.com/technical-article/000009764 ). Due to our disparate configuration, along with other network challenges, sde connection speeds are incredibly slow (creating a single check-out takes over 5 hours machine time). If possible, I'd like to script the check-out replica creation process to automate production of the approximately 100 check-out replicas. Is this possible? Thanks Justin
... View more
11-17-2016
10:11 AM
|
0
|
1
|
824
|
|
POST
|
Dan and Melita, Thanks for the replies. We've tested this every way we can, and are simply giving up. We had planned on creating check-outs from sde (which is GCS WGS84 in our fused environment) into local State Plane NAD83, but are giving up and creating check-outs in local UTM WGS84 instead. Justin
... View more
10-30-2016
07:38 PM
|
0
|
0
|
718
|
|
POST
|
For various reasons our organization still uses ArcGIS 10.1. Our geodatabases have multiple feature datasets, but they all have a common coordinate system. Individual geodatabases represent specific sites across the country. I'm using the batch project tool to reproject several gdb that are in UTM WGS84 to the local State Plane NAD83. It doesn't seem to make a difference whether or not I apply a transformation or not during the reprojection, as the outputs behave the same in ArcMap. When adding to ArcMap, if I do not use a transformation in the data frame coordinate system, they don't align but will when I apply a transformation. It does not matter if the data frame is in WGS84 or NAD83. The transformation I'm using is WGS_1984_(ITRF00)_To_NAD_1983. If I apply a transformation during the reprojection, shouldn't that negate the need to manually apply a transformation in ArcMap? Thanks Justin
... View more
10-28-2016
04:40 AM
|
0
|
3
|
1349
|
|
POST
|
Dan and Josh - thank you very much for the nudge in the right direction. It's still far from elegant, but it is now working: #*********************************
#v1.0
#*********************************
import arcpy
from arcpy import env
import os
#Set variables
inputgdb = sys.argv[1]
#Set workspace
arcpy.env.workspace = inputgdb
#populate areaSize fields in polygon feature classes
datasetList = arcpy.ListDatasets(feature_type = 'Feature')
datasetList = [''] + datasetList if datasetList is not None else []
print "Getting Feature Datasets..."
arcpy.AddMessage ("Getting Feature Datasets...")
print datasetList
arcpy.AddMessage (datasetList)
for dataset in datasetList:
env.workspace = inputgdb + "\\" + dataset
dataset = dataset + "\\"
fcList = arcpy.ListFeatureClasses('*', 'polygon', '')
print "Getting Feature Classes..."
arcpy.AddMessage ("Getting Feature Classes...")
print "Feature Class list..."
arcpy.AddMessage (fcList)
for fc in fcList:
fc = fc +"\\"
#fieldList = [f.name for f in arcpy.ListFields(fc, "areaSize")]
with arcpy.da.UpdateCursor (fc, ['SHAPE@AREA', 'areaSize']) as cursor:
for row in cursor:
row[1] = row[0]
cursor.updateRow(row)
print "Updating 'areaSize' field in: " + fc
arcpy.AddMessage ("Updating 'areaSize' field in: " + fc) Changing lines 30 and 32 is really all it took. I still have some cleanup to do, then expand it to populate other fields, etc. But this is a great start. Thanks again!
... View more
05-12-2016
08:19 PM
|
0
|
2
|
874
|
|
POST
|
Wasn't sure how to name this post... I have a geodatabase with multiple feature datasets, each containing multiple feature classes of various polygon, line and point geometry type. Every polygon fc has a 'areaSize' field that I need to populate with square feet (all of the fds are in State Plane feet). I think I'm getting close here, but still getting an error. (Eventually I will expand this to perform a similar calculation for length of line fc types as well. The error I receive is attached. Any help is greatly appreciated. Thanks. #*********************************
#v1.0
#*********************************
import arcpy
from arcpy import env
import os
#Set variables
inputgdb = sys.argv[1]
#Set workspace
arcpy.env.workspace = inputgdb
#populate areaSize fields in polygon feature classes
datasetList = arcpy.ListDatasets(feature_type = 'feature')
datasetList = [''] + datasetList if datasetList is not None else []
print "Getting Feature Datasets..."
arcpy.AddMessage ("Getting Feature Datasets...")
print datasetList
arcpy.AddMessage (datasetList)
for dataset in datasetList:
env.workspace = inputgdb + "\\" + dataset
dataset = dataset + "\\"
fcList = arcpy.ListFeatureClasses('*', 'polygon', '*')
print "Getting Feature Classes..."
arcpy.AddMessage ("Getting Feature Classes...")
print "Feature Class list..."
arcpy.AddMessage (fcList)
for fc in fcList:
fc = fc +"\\"
fieldList = [f.name for f in arcpy.ListFields(fc, "areaSize")]
with arcpy.da.UpdateCursor (fc, fieldList) as cursor:
for row in cursor:
row[1] = row[0].area
cursor.updateRow(row)
print "Updating 'areaSize' field in: " + fc
arcpy.AddMessage ("Updating 'areaSize' field in: " + fc)
... View more
05-12-2016
03:08 PM
|
0
|
5
|
2829
|
|
POST
|
Thank you so much to everyone; it's working. import arcpy
from arcpy import env
import os
#Set variables
inputgdb = sys.argv[1]
nullCount = 0
#Set workspace
arcpy.env.workspace = inputgdb
#Populate Nulls with TBD
datasetList = arcpy.ListDatasets(feature_type = 'feature')
datasetList = [''] + datasetList if datasetList is not None else []
print "Getting Feature Datasets..."
arcpy.AddMessage ("Getting Feature Datasets...")
print datasetList
arcpy.AddMessage (datasetList)
for dataset in datasetList:
env.workspace = inputgdb + "\\" + dataset
dataset = dataset + "\\"
fcList = arcpy.ListFeatureClasses()
print "Getting Feature Classes..."
arcpy.AddMessage ("Getting Feature Classes...")
print fcList
arcpy.AddMessage (fcList)
for fc in fcList:
fc = fc +"\\"
fieldList = [f.name for f in arcpy.ListFields(fc, "*", "STRING")]
with arcpy.da.UpdateCursor (fc, fieldList) as cursor:
for row in cursor:
row = [(fld if fld is not None else 'TBD') for fld in row]
cursor.updateRow(row)
print "Updating value..."
arcpy.AddMessage ("Updating value...")
print fieldList
arcpy.AddMessage (fieldList)
... View more
03-16-2016
02:52 PM
|
1
|
0
|
2070
|
|
POST
|
I think I'm getting closer, but it does not like the fieldList in cursor. import arcpy
from arcpy import env
import os
#Set variables
inputgdb = sys.argv[1]
nullCount = 0
#Set workspace
arcpy.env.workspace = inputgdb
#Populate Nulls with TBD
datasetList = arcpy.ListDatasets(feature_type = 'feature')
datasetList = [''] + datasetList if datasetList is not None else []
print "Getting Feature Datasets..."
arcpy.AddMessage ("Getting Feature Datasets...")
print datasetList
arcpy.AddMessage (datasetList)
for dataset in datasetList:
env.workspace = inputgdb + "\\" + dataset
dataset = dataset + "\\"
fcList = arcpy.ListFeatureClasses()
print "Getting Feature Classes..."
arcpy.AddMessage ("Getting Feature Classes...")
print fcList
arcpy.AddMessage (fcList)
for fc in fcList:
fc = fc +"\\"
fieldList = arcpy.ListFields(fc,["String"])
with arcpy.da.UpdateCursor (fc, fieldList) as cursor:
for row in cursor: #for each row in the feature class
for i in len(row): #for each value in row (i.e., field values)
if row == None:
row = 'TBD'
cursor.updateRow(row)
print "Updating value..."
arcpy.AddMessage ("Updating value...")
print fieldList
arcpy.AddMessage (fieldList)
... View more
03-16-2016
01:59 PM
|
0
|
2
|
2070
|
|
POST
|
Thanks Blake - applied to original post. Working through the other suggestions/help now. Much appreciated.
... View more
03-16-2016
01:09 PM
|
0
|
0
|
351
|
|
POST
|
Darren and Wes, Thanks for the suggestions. I did add some messaging and it is at least returning the feature datasets, feature classes and fields as I was anticipating. If I understand Darren's edit 2, I don't need to cursor through a list of fields, just the list of feature classes? Thanks again.
... View more
03-16-2016
12:31 PM
|
0
|
5
|
2070
|
|
POST
|
I'm running ArcGIS 10.3 and have a geodatabase with multiple feature datasets each containing multiple feature classes. Each feature class has multiple string type fields containing <Null> values. I want to change the <Null> values to "TBD" (without the quotation marks). I feel I'm very close, but at 'for row in cursor:' I'm receiving the error "Too few parameters. Expected 1." I guess the cursor isn't actually returning any rows at all? Below is what I currently have; I haven't added any documentation or messaging yet. Any help would be greatly appreciated. import arcpy
from arcpy import env
import os
#Set variables
inputgdb = sys.argv[1]
nullCount = 0
#Set workspace
arcpy.env.workspace = inputgdb
#Populate Nulls with TBD
datasetList = arcpy.ListDatasets(feature_type = 'feature')
datasetList = [''] + datasetList if datasetList is not None else []
for dataset in datasetList:
env.workspace = inputgdb + "\\" + dataset
dataset = dataset + "\\"
fcList = arcpy.ListFeatureClasses()
for fc in fcList:
fc = fc +"\\"
fieldList = arcpy.ListFields(fc,["String"])
for field in fieldList:
with arcpy.da.UpdateCursor (fc, 'fieldList') as cursor:
for row in cursor:
if row[0] == None:
row[0] = 'TBD'
cursor.updateRow(row)
... View more
03-16-2016
10:40 AM
|
0
|
11
|
4973
|
|
POST
|
When using data driven pages, is there a way to use python to control the individual page names as they appear in the table of contents in Adobe? By default they begin 1, 2, 3... I'd like them to appear in Adobe using the index page name. I am currently using ddp to create multi-page .pdf map books, but then using Adobe to rename each page to match the index name. data.zip contains sample .pdf examples and index .shp Any help would be greatly appreciated. Thanks!
... View more
04-06-2012
07:10 AM
|
0
|
1
|
585
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-16-2021 01:50 PM | |
| 2 | 12-09-2020 12:51 PM | |
| 1 | 12-04-2018 01:23 PM | |
| 1 | 03-16-2016 02:52 PM | |
| 1 | 05-10-2019 10:54 AM |
| Online Status |
Offline
|
| Date Last Visited |
08-06-2025
06:29 AM
|