Select Layer By Location gives ERROR 000840 (select_features as arcpy.Polygon)
Clash 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
arcpy arcgis-10.3 python-2.7 select-by-location error-000840
add a comment |Â
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
arcpy arcgis-10.3 python-2.7 select-by-location error-000840
add a comment |Â
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
arcpy arcgis-10.3 python-2.7 select-by-location error-000840
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
arcpy arcgis-10.3 python-2.7 select-by-location error-000840
arcpy arcgis-10.3 python-2.7 select-by-location error-000840
edited 33 mins ago
PolyGeo♦
51.8k1777231
51.8k1777231
asked 1 hour ago
dimmed
143
143
add a comment |Â
add a comment |Â
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.
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
add a comment |Â
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.
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
add a comment |Â
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.
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
add a comment |Â
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.
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.
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
add a comment |Â
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
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password