AnsweredAssumed Answered

How to upload CSV file (address) into point SDE feature class that is connect automatically to web map?

Question asked by apena12 on Aug 28, 2017
Latest reply on Oct 4, 2017 by apena12

How to upload CSV file (address) into point SDE feature class that is connect automatically to web map? For example, a new information add in CSV file (address) that is connect automatically add new point in SDE feature class? Please advise. Thank you.

 

EDIT:

Hello,

I tried to use ModelBuilder and it is running but I realized something is not right. I am missing automation and I also don't think delete part (arcpy.detele_managment) is right because the layer is actually delete. What is the script for automation? Please advise. I put modelbuilder and python script below.

 



# Import arcpy module
import arcpy


# Local variables:
sde.GIS.code_case = "Database Connections\\SDE.sde\\sde.GIS.code_case_1"
code_case_bak = "Database Connections\\SDE.sde\\sde.GIS.CodeEnforcement_1\\sde.GIS.code_case_bak_1"
code_case_orig = "Database Connections\\SDE.sde\\sde.GIS.code_case_orig"
sde_GIS_code_case_1 = "Database Connections\\SDE.sde\\sde.GIS.code_case_1"
GIS_geoaddressLocator = "Database Connections\\SDE.sde\\GIS.geoaddressLocator"
sde_GIS_code_case_violation_old_2 = "Database Connections\\SDE.sde\\sde.GIS.CodeEnforcement_1\\sde.GIS.code_case_violation_old_2"
sde_GIS_code_case_bak_1 = "sde.GIS.code_case_bak_1"
sde_GIS_code_case_orig = "Database Connections\\SDE.sde\\sde.GIS.code_case_orig"
SDE_Code_Case_3 = "SDE_Code_Case_3"
sde_GIS_code_case_new_2 = "Database Connections\\SDE.sde\\sde.GIS.CodeEnforcement_1\\sde.GIS.code_case_new_2"
gis_code_case_lat = "Database Connections\\SDE.sde\\sde.GIS.CodeEnforcement_1\\sde.GIS.code_case_new_2"
code_case_temp = "Database Connections\\SDE.sde\\sde.GIS.code_case_temp"
code_case_bak_trunc = "sde.GIS.code_case_bak_1"

# Process: Make Query Table
arcpy.MakeQueryTable_management("'Database Connections\\SDE.sde\\sde.GIS.code_case_1'", CDPlus_Code_Case_3, "USE_KEY_FIELDS", "", "sde.GIS.code_case_1.CASE_NBR #;sde.GIS.code_case_1.STATUS #;sde.GIS.code_case_1.OPEN_DATE #;sde.GIS.code_case_1.CLOSE_DATE #;sde.GIS.code_case_1.FOLIO_NBR #;sde.GIS.code_case_1.VIOL_CATEGORY #;sde.GIS.code_case_1.LOCATION #", "")

# Process: Copy Rows
arcpy.CopyRows_management(SDE_Code_Case_3, code_case_temp, "")

# Process: Delete Features
arcpy.DeleteFeatures_management(sde_GIS_code_case_bak_1)

# Process: Append_bak
arcpy.Append_management("'Database Connections\\SDE.sde\\sde.GIS.CodeEnforcement_1\\sde.GIS.code_case_violation_old_2'", code_case_bak_trunc, "NO_TEST", "Loc_name \"Loc_name\" true true false 14 Text 0 0 ,First,#;Status \"Status\" true true false 1 Text 0 0 ,First,#;Score \"Score\" true true false 8 Double 2 21 ,First,#;Match_type \"Match_type\" true true false 2 Text 0 0 ,First,#;Match_addr \"Match_addr\" true true false 120 Text 0 0 ,First,#;X \"X\" true true false 8 Double 8 38 ,First,#,Database Connections\\SDE.sde\\sde.GIS.CodeEnforcement_1\\sde.GIS.code_case_violation_old_2,X,-1,-1;Y \"Y\" true true false 8 Double 8 38 ,First,#,Database Connections\\SDE.sde\\sde.GIS.CodeEnforcement_1\\sde.GIS.code_case_violation_old_2,Y,-1,-1;User_fld \"User_fld\" true true false 120 Text 0 0 ,First,#;Addr_type \"Addr_type\" true true false 20 Text 0 0 ,First,#;Side \"Side\" true true false 1 Text 0 0 ,First,#;ARC_Street \"Street or Intersection\" true true false 100 Text 0 0 ,First,#;ARC_City \"City or Placename\" true true false 40 Text 0 0 ,First,#;ARC_State \"State\" true true false 20 Text 0 0 ,First,#;ARC_ZIP \"ZIP Code\" true true false 10 Text 0 0 ,First,#;CASE_NBR \"CASE_NBR\" true false false 4 Long 0 10 ,First,#,Database Connections\\SDE.sde\\sde.GIS.CodeEnforcement_1\\sde.GIS.code_case_violation_old_2,Case_Nbr,-1,-1;STATUS_1 \"STATUS\" true true false 10 Text 0 0 ,First,#;CASE_TYPE \"CASE_TYPE\" true true false 10 Text 0 0 ,First,#;OPEN_DATE \"OPEN_DATE\" true true false 36 Date 0 0 ,First,#,Database Connections\\SDE.sde\\sde.GIS.CodeEnforcement_1\\sde.GIS.code_case_violation_old_2,Open_Date,-1,-1;CLOSE_DATE \"CLOSE_DATE\" true true false 36 Date 0 0 ,First,#,Database Connections\\SDE.sde\\sde.GIS.CodeEnforcement_1\\sde.GIS.code_case_violation_old_2,Close_Date,-1,-1;FOLIO_NBR \"FOLIO_NBR\" true true false 25 Text 0 0 ,First,#;VIOL_CATEGORY \"VIOL_CATEGORY\" true true false 10 Text 0 0 ,First,#;LOCATION \"LOCATION\" true true false 60 Text 0 0 ,First,#,Database Connections\\SDE.sde\\sde.GIS.CodeEnforcement_1\\sde.GIS.code_case_violation_old_2,Location,-1,-1;DESCRIPTION \"DESCRIPTION\" true true false 0 Blob 0 0 ,First,#;Description \"Description\" true true false 100 Text 0 0 ,First,#;Description \"Description\" true true false 100 Text 0 0 ,First,#;Description \"Description\" true true false 100 Text 0 0 ,First,#;Description \"Description\" true true false 100 Text 0 0 ,First,#,Database Connections\\SDE.sde\\sde.GIS.CodeEnforcement_1\\sde.GIS.code_case_violation_old_2,Description,-1,-1", "")

# Process: Delete Code_Case
arcpy.Delete_management(sde_GIS_code_case_orig, "Table")

# Process: Geocode Addresses
arcpy.GeocodeAddresses_geocoding(code_case_temp, GIS_geoaddressLocator, "Street sde_GIS_code_case_1_LOCATION VISIBLE NONE;City <None> VISIBLE NONE;State <None> VISIBLE NONE;ZIP <None> VISIBLE NONE", sde_GIS_code_case_new_2, "STATIC")

# Process: Add Latitude
arcpy.AddField_management(sde_GIS_code_case_new_2, "latitude", "DOUBLE", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")

# Process: Add Longitude
arcpy.AddField_management(gis_code_case_lat, "longitude", "DOUBLE", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")

# Process: Delete
arcpy.Delete_management(code_case_temp, "Table")

Outcomes