
import arcpy
import random
import math
import os
import shutil
newpath = r"C:\\geomask_data\\"
if not os.path.exists(newpath): os.makedirs(newpath)

arcpy.env.overwriteOutput = True

def setupReport():
    OriginalPoints = arcpy.GetParameterAsText(0)
    NewPoints = arcpy.GetParameterAsText(1)
    BasePolygon = arcpy.GetParameterAsText(2)
    #density = arcpy.GetParameterAsText(3)
    
    Output = arcpy.GetParameterAsText(3)
    Report(OriginalPoints,NewPoints,BasePolygon,Output)

def Report(OriginalPoints,NewPoints,BasePolygon,Output):
    #den_field = density
    target_features = BasePolygon

    feature1 = OriginalPoints
    feature2 = NewPoints
    outputname = Output

    outputjoin1 = "C:\\geomask_data\\ori_join.shp"
    outputjoin2 = "C:\\geomask_data\\new_join.shp"
    arcpy.SpatialJoin_analysis(feature1,target_features,outputjoin1)
    arcpy.SpatialJoin_analysis(feature2,target_features,outputjoin2)
    arcpy.JoinField_management(outputjoin1,"FID",outputjoin2,"FID")
    arcpy.CopyFeatures_management(outputjoin1,Output)
    
if __name__ == "__main__":
    setupReport()
    print 'Finish'
