def test_table_to_point(self):
        '''Test Table To Point for ArcGIS Desktop'''

        Configuration.Logger.info(
            ".....TableToPointTestCase.test_table_to_point")

        # Delete the output feature class if already exists
        if arcpy.Exists(self.outputPoints):
            arcpy.Delete_management(self.outputPoints)

        arcpy.TableToPoint_mt(self.inputTable, "DD_2", "x", "y",
                              self.outputPoints)

        self.assertTrue(arcpy.Exists(self.outputPoints),
                        "Output features do not exist or were not created")
        pointCount = int(
            arcpy.GetCount_management(self.outputPoints).getOutput(0))
        expectedFeatures = int(1000)
        self.assertEqual(
            pointCount, expectedFeatures, "Expected %s features, but got %s" %
            (str(expectedFeatures), str(pointCount)))

        attribute_tolerances = 'DDLat 0.00001;DDLon 0.00001'
        xy_tolerance = 0.0001
        self.assertFeatureClassEqualSimple(self.baseFC, self.outputPoints, \
                                     "OID", xy_tolerance, attribute_tolerances)

        return
    def test_table_to_point_UTM_BANDS(self):
        '''Test Table To Point for ArcGIS Desktop_UTM_BANDS'''

        Configuration.Logger.info(
            ".....TableToPointTestCase.test_table_to_point_UTM_BANDS")

        # Delete the output feature class if already exists
        if arcpy.Exists(self.outputPoints):
            arcpy.Delete_management(self.outputPoints)

        arcpy.TableToPoint_mt(self.inputSingleTable, "UTM_BANDS", "UTM", None,
                              self.outputPoints)

        self.assertTrue(arcpy.Exists(self.outputPoints),
                        "Output features do not exist or were not created")
        pointCount = int(
            arcpy.GetCount_management(self.outputPoints).getOutput(0))
        expectedFeatures = int(1000)
        self.assertEqual(
            pointCount, expectedFeatures, "Expected %s features, but got %s" %
            (str(expectedFeatures), str(pointCount)))

        # TODO: Needs correct known good results featureclass
        # self.assertFeatureClassEqualSimple(self.baseFC, self.outputPoints, \
        #                             "OID", 0.0001)

        return
 def test_table_to_point_desktop_MGRS(self):
     '''Test Table To Point for ArcGIS Desktop_MGRS'''
     runToolMessage = ".....TableToPointTestCase.test_table_to_point_desktop_MGRS"
     arcpy.ImportToolbox(Configuration.military_DesktopToolboxPath, "mt")
     arcpy.AddMessage(runToolMessage)
     Configuration.Logger.info(runToolMessage)
     arcpy.TableToPoint_mt(self.inputSingleTable, "MGRS", "MGRS", None, self.outputPoints)
     self.assertTrue(arcpy.Exists(self.outputPoints), "Output features do not exist or were not created")
     pointCount = int(arcpy.GetCount_management(self.outputPoints).getOutput(0))
     expectedFeatures = int(288)
     self.assertEqual(pointCount, expectedFeatures, "Expected %s features, but got %s" % (str(expectedFeatures), str(pointCount)))
     compareFeatures = arcpy.FeatureCompare_management(self.BaseFC, self.outputPoints, "OID")         
     # identical = 'true' means that there are no differences between the baseFC and the output feature class
     identical = compareFeatures.getOutput(1)
     self.assertEqual(identical, "true", "Feature compare failed: \n %s" % arcpy.GetMessages())
     return
Esempio n. 4
0
    def test_table_to_point_different_SR(self):
        '''Test Table To Point with a different Spatial Reference (SR) for ArcGIS Desktop'''

        Configuration.Logger.info(
            ".....TableToPointTestCase.test_table_to_point_different_SR")

        # Delete the output feature class if already exists
        if arcpy.Exists(self.outputPoints):
            arcpy.Delete_management(self.outputPoints)

        napervilleSR = arcpy.SpatialReference(
            3443
        )  # 3443 = NAD_1983_HARN_StatePlane_Illinois_East_FIPS_1201_Feet

        arcpy.TableToPoint_mt(self.inputTableDifferentSR, "DD_2", "POINT_X",
                              "POINT_Y", self.outputPoints, napervilleSR)

        self.assertTrue(arcpy.Exists(self.outputPoints),
                        "Output features do not exist or were not created")
        pointCount = int(
            arcpy.GetCount_management(self.outputPoints).getOutput(0))
        expectedFeatures = int(1000)
        self.assertEqual(
            pointCount, expectedFeatures, "Expected %s features, but got %s" %
            (str(expectedFeatures), str(pointCount)))

        # Make sure there are no empty geometries

        # Open Search cursor on output points
        inFields = ["SHAPE@", "ORIG_OID"]
        inRows = arcpy.da.SearchCursor(self.outputPoints, inFields)
        for row in inRows:
            featShape = row[0]
            origOid = row[1]

            self.assertIsNotNone(featShape,
                                 "Output feature shape should not be None")
            self.assertIsNotNone(origOid,
                                 "Output feature field should not be None")

        return