AnsweredAssumed Answered

Help with Python Script - Selecting by Location - Sql string

Question asked by mmanisca on Jul 23, 2013
Latest reply on Jul 23, 2013 by mmanisca
My goal with this script is to select points within a polygon based on a sql statement that identifies the polygon to base the extraction on.  If anyone has any ideas, it would be greatly appreciated.



# Import arcpy module
import arcpy


# Local variables:
SQL_Expression = "SELECT * FROM Public_Seed_Grounds WHERE \"SEEDGRND\" = 'Lake Felicity'"
Public_Seed_Grounds_shp = "C:\\Path\\Public_Seed_Grounds.shp"
VMS_InsideSDG = "VMS_InsideSDG"
Lake_Felicity = "VMS_InsideSDG"
FelicityVMS_PointsforAnalysis100_shp = "C:\\Path\\FelicityVMS_PointsforAnalysis100.shp"
FelicityVMS_PointsforAnalysis100_Collect_shp = "C:\\Path\\FelicityVMS_PointsforAnalysis100_Collect.shp"
FelicityVMS_PointsforAnalysi_shp = "C:\\Path\\FelicityVMS_PointsforAnalysi.shp"
FelicityVMS_PointsforAnalysi_lyr = "C:\\Path\\FelicityVMS_PointsforAnalysi.lyr"

# Process: Select Layer By Location
arcpy.SelectLayerByLocation_management(VMS_InsideSDG, "INTERSECT", Public_Seed_Grounds_shp, "1 Miles", "NEW_SELECTION")

# Process: Copy Features
arcpy.CopyFeatures_management(Lake_Felicity, FelicityVMS_PointsforAnalysis100_shp, "", "0", "0", "0")

# Process: Integrate
arcpy.Integrate_management("C:\\Path\\FelicityVMS_PointsforAnalysis100.shp #", "100 Feet")

# Process: Collect Events
arcpy.CollectEvents_stats(FelicityVMS_PointsforAnalysis100_shp, FelicityVMS_PointsforAnalysis100_Collect_shp)

# Process: Hot Spot Analysis (Getis-Ord Gi*)
arcpy.HotSpots_stats(FelicityVMS_PointsforAnalysis100_Collect_shp, "ICOUNT", FelicityVMS_PointsforAnalysi_shp, "INVERSE_DISTANCE", "EUCLIDEAN_DISTANCE", "NONE", "", "", "")

# Process: ZScore Rendering
arcpy.ZRenderer_stats(FelicityVMS_PointsforAnalysi_shp, "GiZScore", FelicityVMS_PointsforAnalysi_lyr)

Outcomes