|
POST
|
I suppose that when you flip a line, you reverse the order of the points. I assume that the M-values remain the same, since the coordinates themselves don't change. You could write an enhanced Flip script that reverses the order of the M-value too, or maintains the points in the same order and only reverses the M-values...
... View more
01-06-2015
05:06 PM
|
0
|
0
|
2020
|
|
POST
|
I did a test with the code below and noticed a small error: Change the code on line 52 from fcs = arcpy.ListFeatureClasses(feature_dataset=fds) to fcs = arcpy.ListFeatureClasses(feature_dataset=fd) Since I don't know what you are specifying as parameters I did the test with the adapted code below, which updated the featureclasses in the fgdb: import arcpy
import os
import sys
#Set Overwrite Option
arcpy.env.overwriteOutput = True
###Sets parameters (attributes)
##AFENumber = sys.argv[1]
##RequestID = sys.argv [2]
##CreatedDate = sys.argv[3]
##CompletionDate = sys. argv [4]
##AssetArea = sys.argv[5]
##County = sys.argv[6]
##State = sys.argv [7]
##Country = sys.argv[8]
##Datum = sys.argv[9]
##CreatedBy = sys.argv[10]
##DeliverableStatus = sys.argv[11]
##CollectionMethod = sys.argv [12]
##GPSType = sys.argv[13]
##Geoid = sys.argv[14]
##
### additional parameter to provide the workspace
##ws = sys.argv[15]
import datetime
date = datetime.datetime.now()
AFENumber = "AFENumber"
RequestID = "ReqID01"
CreatedDate = date
CompletionDate = date
AssetArea = "Asset01"
County = "myCounty"
State = "myState"
Country = "myCountry"
Datum = "01/06/2015"
CreatedBy = "Xander"
DeliverableStatus = "Deliverable"
CollectionMethod = "CollectMethod01"
GPSType = "myGPS"
Geoid = "GeoID01"
# additional parameter to provide the workspace
ws = r"D:\Xander\GeoNet\MultiAttsUpdate\gdb\Sample.gdb"
# create a dictionary with the field name and corresponding value
dct_fld_val = {'STD_AFE_NUMBER': AFENumber,
'STD_DATUM_D': Datum,
'STD_CREATED_DATE': CreatedDate,
'STD_APC_ASSET_CODE_D': AssetArea,
'STD_COUNTRY_D': Country,
'STD_COUNTY_D': County,
'STD_CREATED_BY_D': CreatedBy,
'STD_DELIVERABLE_STATUS_D': DeliverableStatus,
'STD_GPS_TYPE': GPSType,
'STD_GEOID_D': Geoid,
'STD_STATE_D': State,
'STD_SURVEY_COLLECTION_METHOD_D': CollectionMethod,
'STD_SURV_COMPLT_DATE': CompletionDate,
'STD_SURVEY_REQ_NUMBER': RequestID}
# fields to update
flds_upd = dct_fld_val.keys()
# you have to set the workspace to be able to use the ListDatasets and ListFeatureClasses
arcpy.env.workspace = ws
fds = arcpy.ListDatasets(feature_type='Feature')
fds.append('') # to include featureclasses that are not within a feature dataset
for fd in fds:
fcs = arcpy.ListFeatureClasses(feature_dataset=fd)
# fcs = arcpy.ListFeatureClasses(feature_dataset=fds) ######
for fc in fcs:
# verify that the fields are actually in the featureclass
fc_pathname = os.path.join(ws, fd, fc)
flds_fc = [fld.name for fld in arcpy.ListFields(fc_pathname)]
flds = list(set(flds_upd) & set(flds_fc))
# loop through rows of fc
with arcpy.da.UpdateCursor(fc_pathname, flds) as curs:
for row in curs:
for fld in flds:
row[flds.index(fld)] = dct_fld_val[fld]
curs.updateRow(row) I attach the updated file geodatabase for you to verify. If you don't get it to work, then we have to take a look at the parameters (since there are date field and those may require some extra attention).
... View more
01-06-2015
03:05 PM
|
0
|
0
|
3220
|
|
POST
|
If the spatial join worked for you, than I would stick to that. Do have a look at the distance field to verify that points are not joined to distant features. In case you change your mind in the future, Python is relatively easy to learn and there are many capable people at this forum that are willing to guide you in the process. Just don't forget to mark the answer from Mike Cusi as the correct answer.
... View more
01-06-2015
02:55 PM
|
1
|
0
|
1682
|
|
POST
|
I wonder if you would create a script tool that does the same and include that in your model, if it still presents the same error...
... View more
01-06-2015
02:47 PM
|
0
|
0
|
1418
|
|
POST
|
The alternative is to include a file geodatabase in the model, using he proposed folder structure by Esri: ArcGIS Desktop
... View more
01-05-2015
04:11 PM
|
0
|
3
|
4287
|
|
POST
|
Maybe you should write to the in_memory workspace: ArcGIS Help (10.2, 10.2.1, and 10.2.2)
... View more
01-05-2015
04:02 PM
|
0
|
5
|
4287
|
|
POST
|
If you have "exclude null values on false", maybe you should set this to true... (to exclude the null values)...
... View more
01-05-2015
03:33 PM
|
0
|
1
|
1207
|
|
POST
|
Yeah, 150 GBs is a little big to load into memory. See the answer by Curtis Price for alternative methods. Remember that the resulting raster will be big too...
... View more
01-05-2015
03:27 PM
|
0
|
0
|
2183
|
|
POST
|
If I look carefully I do see a vertice near the "missing point" (red box): I have seen something similar when a XY domain (with decimal degrees coordinates) was specified to large, resulting in a low precision, but that doesn't explain the other points that are on the line. Is there perhaps something in your environment settings with the tolerance that might be to big? The following environment settings influence the behavior of this tool: Current Workspace, Scratch Workspace, XY Resolution, XY Tolerance, Output has M values, M Resolution, M Tolerance, Output has Z values, Default Output Z Value, Z Resolution, Z Tolerance, Qualified Field Names, Output CONFIG Keyword, Auto Commit, Output Spatial Grid 1, Output Spatial Grid 2, Output Spatial Grid 3, Output XY Domain, Output M Domain, Output Z Domain
... View more
01-05-2015
03:19 PM
|
0
|
0
|
1418
|
|
POST
|
What if you run it with: ws = r"Y:\GIS\MU Geodatabase.gdb" ... without specifying "Sanitary_Sewer" what I assume is a feature dataset. If that does not work, please attach a sample of you data to debug the code.
... View more
01-05-2015
03:12 PM
|
1
|
0
|
5543
|
|
POST
|
The code would look something like this. Now be aware that I don't have any data to test the code against. I added an extra parameter where you should provide the path to the workspace (eg file geodatabase). This is required to be able to use the list featureclasses correctly. I excluded the mxd part in the beginning of the code since it is not used and requires the code to be execute Please make a copy of your data before you execute the code! The idea behind the code is that you collect the parameters (although i would probably use the arcpy.GetParameterAsText(#) for this purpose) and then you create a dictionary that related the fieldnames (key) to the value to be stored in that field (value). There is also a check to exclude fields from the list that are not present in the featureclass. Since Python is case sensitive a field that has the same name, but does not match case wise, will not be updated. import arcpy
import os
import sys
#Set Overwrite Option
arcpy.env.overwriteOutput = True
#Sets parameters (attributes)
AFENumber = sys.argv[1]
RequestID = sys.argv [2]
CreatedDate = sys.argv[3]
CompletionDate = sys. argv [4]
AssetArea = sys.argv[5]
County = sys.argv[6]
State = sys.argv [7]
Country = sys.argv[8]
Datum = sys.argv[9]
CreatedBy = sys.argv[10]
DeliverableStatus = sys.argv[11]
CollectionMethod = sys.argv [12]
GPSType = sys.argv[13]
Geoid = sys.argv[14]
# additional parameter to provide the workspace
ws = sys.argv[15]
# create a dictionary with the field name and corresponding value
dct_fld_val = {'STD_AFE_NUMBER': AFENumber,
'STD_DATUM_D': Datum,
'STD_CREATED_DATE': CreatedDate,
'STD_APC_ASSET_CODE_D': AssetArea,
'STD_COUNTRY_D': Country,
'STD_COUNTY_D': County,
'STD_CREATED_BY_D': CreatedBy,
'STD_DELIVERABLE_STATUS_D': DeliverableStatus,
'STD_GPS_TYPE': GPSType,
'STD_GEOID_D': Geoid,
'STD_STATE_D': State,
'STD_SURVEY_COLLECTION_METHOD_D': CollectionMethod,
'STD_SURV_COMPLT_DATE': CompletionDate,
'STD_SURVEY_REQ_NUMBER': RequestID}
# fields to update
flds_upd = dct_fld_val.keys()
# you have to set the workspace to be able to use the ListDatasets and ListFeatureClasses
arcpy.env.workspace = ws
fds = arcpy.ListDatasets(feature_type='Feature')
fds.append('') # to include featureclasses that are not within a feature dataset
for fd in fds:
fcs = arcpy.ListFeatureClasses(feature_dataset=fds)
for fc in fcs:
# verify that the fields are actually in the featureclass
fc_pathname = os.path.join(ws, fd, fc)
flds_fc = [fld.name for fld in arcpy.ListFields(fc_pathname)]
flds = list(set(flds_upd) & set(flds_fc))
# loop through rows of fc
with arcpy.da.UpdateCursor(fc_pathname, flds) as curs:
for row in curs:
for fld in flds:
row[flds.index(fld)] = dct_fld_val[fld]
curs.updateRow(row) If you run into problems, please post the error you get and if possible a small part of the data, so I can see where the code fails.
... View more
01-05-2015
03:08 PM
|
2
|
3
|
3220
|
|
POST
|
Why would you want to include Null values in your statistics calculation? What value do the Null values represent? Normal behavior would be to return Null if Null values are not excluded.
... View more
01-05-2015
02:34 PM
|
0
|
3
|
1207
|
|
POST
|
There are easier ways to do this with less code. What version of ArcGIS are you using? If you have 10.1 SP1 or higher you can make use of the data access module. If can you tell me the version I can rewrite the code.
... View more
01-05-2015
02:31 PM
|
0
|
5
|
3220
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-09-2020 09:26 AM | |
| 6 | 12-20-2019 08:41 AM | |
| 1 | 01-21-2020 07:21 AM | |
| 2 | 01-30-2020 12:46 PM | |
| 1 | 05-30-2019 08:24 AM |
| Online Status |
Offline
|
| Date Last Visited |
Monday
|