Skip to content

Commit

Permalink
Added survey questions
Browse files Browse the repository at this point in the history
  • Loading branch information
ArcGISLocalGov committed Apr 16, 2015
1 parent 6f99f8c commit 61ab91c
Show file tree
Hide file tree
Showing 8 changed files with 406 additions and 32 deletions.
4 changes: 4 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/photo-survey-python.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/scopes/scope_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

303 changes: 303 additions & 0 deletions .idea/workspace.xml

Large diffs are not rendered by default.

100 changes: 68 additions & 32 deletions loadphotopoints.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""
@author: bus
@contact: [email protected]
@company: Esri
@version: 1.0.0
@description: Photo Survey Tool to load photos
@requirements: Python 2.7.x, ArcGIS 10.2, 10.3, 10.3.1
@copyright: Esri, 2015
@author: bus
@contact: [email protected]
@company: Esri
@version: 1.0.0
@description: Photo Survey Tool to load photos
@requirements: Python 2.7.x, ArcGIS 10.2, 10.3, 10.3.1
@copyright: Esri, 2015
"""
# Import modules
Expand Down Expand Up @@ -54,30 +54,30 @@
fields = ['SHAPE@XY', AngleField]

def shift_photopoints(in_features, x_shift=None, y_shift=None):
with arcpy.da.UpdateCursor(in_features, fields) as cursor:
for row in cursor:
x = row[0][0] + x_shift * math.cos(math.degrees(int(row[1])))
y = row[0][1] + y_shift * math.sin(math.degrees(int(row[1])))
row[0] = (x, y)
cursor.updateRow(row)
return
with arcpy.da.UpdateCursor(in_features, fields) as cursor:
for row in cursor:
x = row[0][0] + x_shift * math.cos(math.degrees(int(row[1])))
y = row[0][1] + y_shift * math.sin(math.degrees(int(row[1])))
row[0] = (x, y)
cursor.updateRow(row)
return


if AngleField:

shift_photopoints(PhotoFeatureClass2, 15, 15)
shift_photopoints(PhotoFeatureClass2, 15, 15)

else:

pass
pass

SnapHelper = """{} EDGE '30 Unknown'""".format(ParcelsFeatureClass)
arcpy.Snap_edit(PhotoFeatureClass2, SnapHelper)

Nearhelper = """{}\\NEAR""".format(Geodatabase)
NEAR = Nearhelper
arcpy.GenerateNearTable_analysis(PhotoFeatureClass2, ParcelsFeatureClass, NEAR,
"5 Feet", "NO_LOCATION", "NO_ANGLE", "CLOSEST", "0", "GEODESIC")
"5 Feet", "NO_LOCATION", "NO_ANGLE", "CLOSEST", "0", "GEODESIC")

arcpy.AddMessage("Step 4: Associating passenger photo points to nearest parcel")

Expand All @@ -93,8 +93,8 @@ def shift_photopoints(in_features, x_shift=None, y_shift=None):

whereclause = "PIN is Null"
with arcpy.da.UpdateCursor(PhotoFeatureClass2, "PIN", whereclause) as cursor:
for row in cursor:
cursor.deleteRow()
for row in cursor:
cursor.deleteRow()

# Cleanup matched Photos (intermediate data)

Expand Down Expand Up @@ -126,30 +126,30 @@ def shift_photopoints(in_features, x_shift=None, y_shift=None):


def shift_photopoints(in_features, x_shift=None, y_shift=None):
with arcpy.da.UpdateCursor(in_features, fields) as cursor:
for row in cursor:
x = row[0][0] + x_shift * math.cos(math.degrees(int(row[1])))
y = row[0][1] + y_shift * math.sin(math.degrees(int(row[1])))
row[0] = (x, y)
cursor.updateRow(row)
return
with arcpy.da.UpdateCursor(in_features, fields) as cursor:
for row in cursor:
x = row[0][0] + x_shift * math.cos(math.degrees(int(row[1])))
y = row[0][1] + y_shift * math.sin(math.degrees(int(row[1])))
row[0] = (x, y)
cursor.updateRow(row)
return


if AngleField:

shift_photopoints(PhotoFeatureClass3, 15, 15)
shift_photopoints(PhotoFeatureClass3, 15, 15)

else:

pass
pass

SnapHelper = """{} EDGE '100 Unknown'""".format("PARCELSFL2")
arcpy.Snap_edit(PhotoFeatureClass3, SnapHelper)

Nearhelper = """{}\\NEAR""".format(Geodatabase)
NEAR = Nearhelper
arcpy.GenerateNearTable_analysis(PhotoFeatureClass3, ParcelsFeatureClass, NEAR,
"5 Feet", "NO_LOCATION", "NO_ANGLE", "CLOSEST", "0", "GEODESIC")
"5 Feet", "NO_LOCATION", "NO_ANGLE", "CLOSEST", "0", "GEODESIC")
arcpy.AddMessage("Step 6: Associating driver photo points to nearest parcel")
arcpy.JoinField_management(NEAR, "NEAR_FID", ParcelsFeatureClass, "OBJECTID", ParcelPIN)

Expand All @@ -163,8 +163,8 @@ def shift_photopoints(in_features, x_shift=None, y_shift=None):

whereclause = "PIN is Null"
with arcpy.da.UpdateCursor(PhotoFeatureClass3, "PIN", whereclause) as cursor:
for row in cursor:
cursor.deleteRow()
for row in cursor:
cursor.deleteRow()

# Cleanup matched Photos (intermediate data)

Expand Down Expand Up @@ -196,7 +196,43 @@ def shift_photopoints(in_features, x_shift=None, y_shift=None):
arcpy.Delete_management(PhotoFeatureClass3)
arcpy.Delete_management(ParcelsFeatureClass)
arcpy.AddMessage("Step 9: Cleaning up staging geodatabase")
arcpy.AddMessage("Step 10: Finalizing photo survey feature class")
arcpy.AddMessage("Step 10: Adding survey questions")
arcpy.CreateDomain_management(Geodatabase, "YesNoMaybe", "YesNoMaybe", "TEXT", "CODED")
DomainDict1 = {"Yes": "Yes", "No": "No", "Maybe": "Maybe"}
for code in DomainDict1:
arcpy.AddCodedValueToDomain_management(Geodatabase, "YesNoMaybe", code, DomainDict1[code])

arcpy.CreateDomain_management(Geodatabase, "FoundationType", "FoundationType", "TEXT", "CODED")
DomainDict2 = {"Crawlspace": "Crawlspace", "Raised": "Raised", "Elevated": "Elevated", "Slab on Grade": "Slab on Grade"}
for codex in DomainDict2:
arcpy.AddCodedValueToDomain_management(Geodatabase, "FoundationType", codex, DomainDict2[codex])

arcpy.AddField_management(ParcelPointHelper, "Structure", "TEXT", "", "", "5", "", "NULLABLE", "REQUIRED", "")
arcpy.AssignDomainToField_management(ParcelPointHelper, "Structure", "YesNoMaybe")
arcpy.AddField_management(ParcelPointHelper, "Lot", "TEXT", "", "", "5", "", "NULLABLE", "REQUIRED", "")
arcpy.AssignDomainToField_management(ParcelPointHelper, "Lot", "YesNoMaybe")
arcpy.AddField_management(ParcelPointHelper, "FoundationType", "TEXT", "", "", "25", "", "NULLABLE", "NON_REQUIRED", "")
arcpy.AssignDomainToField_management(ParcelPointHelper, "FoundationType", "FoundationType")
arcpy.AddField_management(ParcelPointHelper, "RoofDamage", "TEXT", "", "", "5", "", "NULLABLE", "NON_REQUIRED", "")
arcpy.AssignDomainToField_management(ParcelPointHelper, "RoofDamage", "YesNoMaybe")
arcpy.AddField_management(ParcelPointHelper, "ExteriorDamage", "TEXT", "", "", "5", "", "NULLABLE", "NON_REQUIRED", "")
arcpy.AssignDomainToField_management(ParcelPointHelper, "ExteriorDamage", "YesNoMaybe")
arcpy.AddField_management(ParcelPointHelper, "Graffiti", "TEXT", "", "", "5", "", "NULLABLE", "NON_REQUIRED", "")
arcpy.AssignDomainToField_management(ParcelPointHelper, "Graffiti", "YesNoMaybe")
arcpy.AddField_management(ParcelPointHelper, "Boarded", "TEXT", "", "", "5", "", "NULLABLE", "NON_REQUIRED", "")
arcpy.AssignDomainToField_management(ParcelPointHelper, "Boarded", "YesNoMaybe")

arcpy.AddMessage("Step 11: Adding application fields")
arcpy.CreateDomain_management(Geodatabase, "YesNo", "YesNo", "TEXT", "CODED")
DomainDict3 = {"Yes": "Yes", "No": "No"}
for codev in DomainDict3:
arcpy.AddCodedValueToDomain_management(Geodatabase, "YesNo", codev, DomainDict3[codev])
arcpy.AddField_management(ParcelPointHelper, "BestPhotoID", "TEXT", "", "", "5", "", "NULLABLE", "NON_REQUIRED", "")
arcpy.AssignDomainToField_management(ParcelPointHelper, "BestPhotoID", "YesNo")
arcpy.AddField_management(ParcelPointHelper, "Surveyed", "TEXT", "", "", "5", "", "NULLABLE", "NON_REQUIRED", "")
arcpy.AssignDomainToField_management(ParcelPointHelper, "Surveyed", "YesNo")
arcpy.AddMessage("Step 12: Finalizing photo survey feature class")




Expand Down

0 comments on commit 61ab91c

Please sign in to comment.