7

I have a script that calculating vertices angles on Polyline layer and the selecting features in that layer at a specified angle. at the end of the script i'm using select by attribute and getting error 000840 the value is not raster layer, the value is not mosaic layer

SelectLayerByAttribute_management(my_shp_name, 'NEW_SELECTION', myquery)
PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Dror Har Gil
  • 2,524
  • 1
  • 30
  • 53
  • 1
    Maybe you can add some context and additional information? Screenshots are always useful :) Also, I'm not sure what you really are asking about: what do you want to do and what have you tried? – Martin Jul 25 '13 at 14:00
  • I've edit my question. – Dror Har Gil Jul 25 '13 at 14:10
  • 2
    The question is still mystifying because nothing you mention involves rasters at all. More details of your script would be helpful. – whuber Jul 25 '13 at 14:23
  • Are you running the select against the .shp file directly, or against a feature layer of the .shp? Select by Attribute won't work when run directly against a feature class or shapefile. You have to run arcpy.MakeFeatureLayer_management first, then select against that. – DPierce Jul 25 '13 at 14:34
  • I don't think that the error can come from the line the OP has quoted. As well as more of the script as asked for by @whuber, a more fulsome transcript of the error message would be helpful. – MappaGnosis Jul 25 '13 at 14:44

1 Answers1

19

This is a common error that I have run across, and I am pretty sure it is related to attempting to run the selection against a raw featureclass/shapefile output, as opposed to the "layer" representation of the featureclass/shapefile.

For example: You cannot select features from a shapefile without using ArcMap, but once you load the shapefile into ArcMap (which makes it a "layer"), you can now select the features from the layer.

Try using the MakeFeatureLayer_management(my_shp_name, my_shp_layer) function between the previous function's output and the SelectLayerByAttribute_management(). I think you will find that this resolves your error.

RyanKDalton
  • 23,068
  • 17
  • 110
  • 178