Select Layer By Location gives ERROR 000840 (select_features as arcpy.Polygon)

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
2
down vote

favorite












I tried to select SC27060054 point object using polygon.
r"Projectproject.DBO.Qo" is a point layer.



import arcpy

p1 = arcpy.Point(254426.380, 4664270.258)
p2 = arcpy.Point(254432.730, 4664270.258)
p3 = arcpy.Point(254432.730, 4664264.967)
p4 = arcpy.Point(254426.380, 4664264.967)

poly = arcpy.Polygon(arcpy.Array([p1, p2, p3, p4]))

arcpy.SelectLayerByLocation_management(r"Projectproject.DBO.Qo", "CONTAINS", poly)
Runtime error Traceback (most recent call last): File "<string>", line 1, in <module>
File "C:Program Files (x86)ArcGISDesktop10.3ArcPyarcpymanagement.py", line 7279, in SelectLayerByLocation
raise e ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000840: The value is not a Boolean. Failed to execute (SelectLayerByLocation).

desc = arcpy.Describe(r"Projectproject.DBO.Qo")
print desc.shapeType
Point


enter image description here










share|improve this question





























    up vote
    2
    down vote

    favorite












    I tried to select SC27060054 point object using polygon.
    r"Projectproject.DBO.Qo" is a point layer.



    import arcpy

    p1 = arcpy.Point(254426.380, 4664270.258)
    p2 = arcpy.Point(254432.730, 4664270.258)
    p3 = arcpy.Point(254432.730, 4664264.967)
    p4 = arcpy.Point(254426.380, 4664264.967)

    poly = arcpy.Polygon(arcpy.Array([p1, p2, p3, p4]))

    arcpy.SelectLayerByLocation_management(r"Projectproject.DBO.Qo", "CONTAINS", poly)
    Runtime error Traceback (most recent call last): File "<string>", line 1, in <module>
    File "C:Program Files (x86)ArcGISDesktop10.3ArcPyarcpymanagement.py", line 7279, in SelectLayerByLocation
    raise e ExecuteError: Failed to execute. Parameters are not valid.
    ERROR 000840: The value is not a Boolean. Failed to execute (SelectLayerByLocation).

    desc = arcpy.Describe(r"Projectproject.DBO.Qo")
    print desc.shapeType
    Point


    enter image description here










    share|improve this question

























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      I tried to select SC27060054 point object using polygon.
      r"Projectproject.DBO.Qo" is a point layer.



      import arcpy

      p1 = arcpy.Point(254426.380, 4664270.258)
      p2 = arcpy.Point(254432.730, 4664270.258)
      p3 = arcpy.Point(254432.730, 4664264.967)
      p4 = arcpy.Point(254426.380, 4664264.967)

      poly = arcpy.Polygon(arcpy.Array([p1, p2, p3, p4]))

      arcpy.SelectLayerByLocation_management(r"Projectproject.DBO.Qo", "CONTAINS", poly)
      Runtime error Traceback (most recent call last): File "<string>", line 1, in <module>
      File "C:Program Files (x86)ArcGISDesktop10.3ArcPyarcpymanagement.py", line 7279, in SelectLayerByLocation
      raise e ExecuteError: Failed to execute. Parameters are not valid.
      ERROR 000840: The value is not a Boolean. Failed to execute (SelectLayerByLocation).

      desc = arcpy.Describe(r"Projectproject.DBO.Qo")
      print desc.shapeType
      Point


      enter image description here










      share|improve this question















      I tried to select SC27060054 point object using polygon.
      r"Projectproject.DBO.Qo" is a point layer.



      import arcpy

      p1 = arcpy.Point(254426.380, 4664270.258)
      p2 = arcpy.Point(254432.730, 4664270.258)
      p3 = arcpy.Point(254432.730, 4664264.967)
      p4 = arcpy.Point(254426.380, 4664264.967)

      poly = arcpy.Polygon(arcpy.Array([p1, p2, p3, p4]))

      arcpy.SelectLayerByLocation_management(r"Projectproject.DBO.Qo", "CONTAINS", poly)
      Runtime error Traceback (most recent call last): File "<string>", line 1, in <module>
      File "C:Program Files (x86)ArcGISDesktop10.3ArcPyarcpymanagement.py", line 7279, in SelectLayerByLocation
      raise e ExecuteError: Failed to execute. Parameters are not valid.
      ERROR 000840: The value is not a Boolean. Failed to execute (SelectLayerByLocation).

      desc = arcpy.Describe(r"Projectproject.DBO.Qo")
      print desc.shapeType
      Point


      enter image description here







      arcpy arcgis-10.3 python-2.7 select-by-location error-000840






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 33 mins ago









      PolyGeo♦

      51.8k1777231




      51.8k1777231










      asked 1 hour ago









      dimmed

      143




      143




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          3
          down vote













          For Select Layer by Location in_layer and select_features needs to be feature layers, for example created with MakeFeatureLayer (or by adding a feature class to ArcMap and execute code in the Python window using the name of the feature layer from table of contents).
          So both "Projectproject.DBO.Qo" and poly need to be layers.



          Try:



          arcpy.MakeFeatureLayer_management("Projectproject.DBO.Qo" , "Qolyr")
          arcpy.CopyFeatures_management(poly, r"in_memorypoly") #You need a feature class to create a feature layer
          arcpy.MakeFeatureLayer_management(r"in_memorypoly", "polylyr")


          And then use "Qolyr" and "polylyr" in Select Layer by Location.



          Also, if Qolyr is a Point layer it can never contain polygons:




          CONTAINS —The features in the input layer will be selected if they
          contain a selecting feature.




          You probably want intersect:




          INTERSECT —The features in the input layer will be selected if they
          intersect a selecting feature. This is the default.







          share|improve this answer






















          • I've tried what you wrote, but same error ... arcpy.SelectLayerByLocation_management("Qolyr", "CONTAINS", "polylyr")
            – dimmed
            32 mins ago











          • @dimmed, if Qolyr are Points, they can never contain polygons. Try Another overlap type, for example INTERSECT, to see if this is what is causing the error
            – BERA
            28 mins ago











          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "79"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f295921%2fselect-layer-by-location-gives-error-000840-select-features-as-arcpy-polygon%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          3
          down vote













          For Select Layer by Location in_layer and select_features needs to be feature layers, for example created with MakeFeatureLayer (or by adding a feature class to ArcMap and execute code in the Python window using the name of the feature layer from table of contents).
          So both "Projectproject.DBO.Qo" and poly need to be layers.



          Try:



          arcpy.MakeFeatureLayer_management("Projectproject.DBO.Qo" , "Qolyr")
          arcpy.CopyFeatures_management(poly, r"in_memorypoly") #You need a feature class to create a feature layer
          arcpy.MakeFeatureLayer_management(r"in_memorypoly", "polylyr")


          And then use "Qolyr" and "polylyr" in Select Layer by Location.



          Also, if Qolyr is a Point layer it can never contain polygons:




          CONTAINS —The features in the input layer will be selected if they
          contain a selecting feature.




          You probably want intersect:




          INTERSECT —The features in the input layer will be selected if they
          intersect a selecting feature. This is the default.







          share|improve this answer






















          • I've tried what you wrote, but same error ... arcpy.SelectLayerByLocation_management("Qolyr", "CONTAINS", "polylyr")
            – dimmed
            32 mins ago











          • @dimmed, if Qolyr are Points, they can never contain polygons. Try Another overlap type, for example INTERSECT, to see if this is what is causing the error
            – BERA
            28 mins ago















          up vote
          3
          down vote













          For Select Layer by Location in_layer and select_features needs to be feature layers, for example created with MakeFeatureLayer (or by adding a feature class to ArcMap and execute code in the Python window using the name of the feature layer from table of contents).
          So both "Projectproject.DBO.Qo" and poly need to be layers.



          Try:



          arcpy.MakeFeatureLayer_management("Projectproject.DBO.Qo" , "Qolyr")
          arcpy.CopyFeatures_management(poly, r"in_memorypoly") #You need a feature class to create a feature layer
          arcpy.MakeFeatureLayer_management(r"in_memorypoly", "polylyr")


          And then use "Qolyr" and "polylyr" in Select Layer by Location.



          Also, if Qolyr is a Point layer it can never contain polygons:




          CONTAINS —The features in the input layer will be selected if they
          contain a selecting feature.




          You probably want intersect:




          INTERSECT —The features in the input layer will be selected if they
          intersect a selecting feature. This is the default.







          share|improve this answer






















          • I've tried what you wrote, but same error ... arcpy.SelectLayerByLocation_management("Qolyr", "CONTAINS", "polylyr")
            – dimmed
            32 mins ago











          • @dimmed, if Qolyr are Points, they can never contain polygons. Try Another overlap type, for example INTERSECT, to see if this is what is causing the error
            – BERA
            28 mins ago













          up vote
          3
          down vote










          up vote
          3
          down vote









          For Select Layer by Location in_layer and select_features needs to be feature layers, for example created with MakeFeatureLayer (or by adding a feature class to ArcMap and execute code in the Python window using the name of the feature layer from table of contents).
          So both "Projectproject.DBO.Qo" and poly need to be layers.



          Try:



          arcpy.MakeFeatureLayer_management("Projectproject.DBO.Qo" , "Qolyr")
          arcpy.CopyFeatures_management(poly, r"in_memorypoly") #You need a feature class to create a feature layer
          arcpy.MakeFeatureLayer_management(r"in_memorypoly", "polylyr")


          And then use "Qolyr" and "polylyr" in Select Layer by Location.



          Also, if Qolyr is a Point layer it can never contain polygons:




          CONTAINS —The features in the input layer will be selected if they
          contain a selecting feature.




          You probably want intersect:




          INTERSECT —The features in the input layer will be selected if they
          intersect a selecting feature. This is the default.







          share|improve this answer














          For Select Layer by Location in_layer and select_features needs to be feature layers, for example created with MakeFeatureLayer (or by adding a feature class to ArcMap and execute code in the Python window using the name of the feature layer from table of contents).
          So both "Projectproject.DBO.Qo" and poly need to be layers.



          Try:



          arcpy.MakeFeatureLayer_management("Projectproject.DBO.Qo" , "Qolyr")
          arcpy.CopyFeatures_management(poly, r"in_memorypoly") #You need a feature class to create a feature layer
          arcpy.MakeFeatureLayer_management(r"in_memorypoly", "polylyr")


          And then use "Qolyr" and "polylyr" in Select Layer by Location.



          Also, if Qolyr is a Point layer it can never contain polygons:




          CONTAINS —The features in the input layer will be selected if they
          contain a selecting feature.




          You probably want intersect:




          INTERSECT —The features in the input layer will be selected if they
          intersect a selecting feature. This is the default.








          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 16 mins ago

























          answered 57 mins ago









          BERA

          11.3k41435




          11.3k41435











          • I've tried what you wrote, but same error ... arcpy.SelectLayerByLocation_management("Qolyr", "CONTAINS", "polylyr")
            – dimmed
            32 mins ago











          • @dimmed, if Qolyr are Points, they can never contain polygons. Try Another overlap type, for example INTERSECT, to see if this is what is causing the error
            – BERA
            28 mins ago

















          • I've tried what you wrote, but same error ... arcpy.SelectLayerByLocation_management("Qolyr", "CONTAINS", "polylyr")
            – dimmed
            32 mins ago











          • @dimmed, if Qolyr are Points, they can never contain polygons. Try Another overlap type, for example INTERSECT, to see if this is what is causing the error
            – BERA
            28 mins ago
















          I've tried what you wrote, but same error ... arcpy.SelectLayerByLocation_management("Qolyr", "CONTAINS", "polylyr")
          – dimmed
          32 mins ago





          I've tried what you wrote, but same error ... arcpy.SelectLayerByLocation_management("Qolyr", "CONTAINS", "polylyr")
          – dimmed
          32 mins ago













          @dimmed, if Qolyr are Points, they can never contain polygons. Try Another overlap type, for example INTERSECT, to see if this is what is causing the error
          – BERA
          28 mins ago





          @dimmed, if Qolyr are Points, they can never contain polygons. Try Another overlap type, for example INTERSECT, to see if this is what is causing the error
          – BERA
          28 mins ago


















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f295921%2fselect-layer-by-location-gives-error-000840-select-features-as-arcpy-polygon%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          What does second last employer means? [closed]

          List of Gilmore Girls characters

          Confectionery