Python arcpy.CheckExtension() Examples
The following are 3
code examples of arcpy.CheckExtension().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
arcpy
, or try the search function
.
Example #1
Source File: arcapi_test.py From arcapi with GNU Lesser General Public License v3.0 | 6 votes |
def testint_to_float(self): _dir = os.path.join(self.testingfolder, r'testing_files\rasters') ndvi = os.path.join(_dir, 'dh_july_ndvi') ob = round(arcpy.Raster(ndvi).maximum, 5) int_rst = os.path.join(_dir, 'ndvi_int') est = os.path.join(_dir, 'ndvi_tst') if arcpy.CheckExtension('Spatial') == 'Available': arcpy.CheckOutExtension('Spatial') arcpy.sa.Int(arcpy.sa.Times(ndvi, 1000000)).save(int_rst) arcpy.CheckInExtension('Spatial') ap.int_to_float(int_rst, est, 6) self.assertEqual(ob, round(arcpy.Raster(est).maximum, 5)) for rast in [int_rst, est]: try: arcpy.Delete_management(rast) except:pass pass
Example #2
Source File: arcapi_test.py From arcapi with GNU Lesser General Public License v3.0 | 6 votes |
def testfill_no_data(self): _dir = os.path.join(self.testingfolder, r'testing_files\rasters') ndvi = os.path.join(_dir, 'dh_july_ndvi') est = os.path.join(_dir, 'ndvi_fill') null = os.path.join(_dir, 'null_rst') if arcpy.CheckExtension('Spatial') == 'Available': ap.fill_no_data(ndvi, est, 10, 10) arcpy.CheckOutExtension('Spatial') arcpy.sa.IsNull(est).save(null) self.assertEqual(arcpy.Raster(null).maximum, 0) arcpy.CheckInExtension('Spatial') for rast in [est, null]: try: arcpy.Delete_management(rast) except:pass pass
Example #3
Source File: BBB_SharedFunctions.py From public-transit-tools with Apache License 2.0 | 5 votes |
def CheckOutNALicense(): if arcpy.CheckExtension("Network") == "Available": arcpy.CheckOutExtension("Network") else: arcpy.AddError("You must have a Network Analyst license to use this tool.") raise CustomError