Select By Location fails with XY event layer

3362
6
02-15-2013 10:25 AM
HarryBowman
New Contributor III
I create an XY event layer in GCS_WGS_1984.

Using this layer as the selecting features in Select by Location fails with a 999999 error.

If I use this layer as the target, or in Buffer, the tool fails with 000339: ...does not have OIDs.

Is this why it is failed in Select by Location? I inherited a python script that was written to use such as layer as the selecting features. Did this used to work? Why doesn't it now? I would think that the OIDs for the selecting layer should not matter.
6 Replies
DanPatterson_Retired
MVP Emeritus
Did you trying exporting the event layer out to a shapefile first?
0 Kudos
HarryBowman
New Contributor III
Did you trying exporting the event layer out to a shapefile first?


Yes, that works fine. Why doesn't using the XY event layer directly work OK? I inherited a working Python script that as of last year (February 2012) used an XY layer directly. Now it doesn't work. I can even use a hand-built arcpy geometry object as the input for Select By Location. If that works, this should too.
0 Kudos
MelanieSummers
Occasional Contributor III
Hi Harry,

ObjectIDs are required to make selections, many delimited text files or tables from OLE DS connections do not have ObjectID fields. Exporting to a shapefile creates an ObjectID field which is why you are then able to use Select by Location.

You can export your table as a .dbf, this will add an ObjectID field and the resulting XY Event Layer will then be selectable.

Best,
Melanie S.
0 Kudos
HarryBowman
New Contributor III
Thanks for the reply, Melanie:

I might not have been clear. The features to be selected are in a file geodatabase feature class, so they do have Object IDs. The XY events are going to be used to do the selecting - they are not being selected themselves. I can do such selecting with an arcpy geometry object, so it should also work with the XY events.

Does this make sense? Maybe I am still missing something.

- Harry
MelanieSummers
Occasional Contributor III
Hi Harry,

ObjectIDs are required for the layer to be used in either part of the Select by Location process.

I wouldn't expect XY Event layers to behave the same way as Geometry Objects; Geometry Objects are made specifically to work with data in a temporary state, XY Event Layers are used to display XY data, if the tabular data being displayed does not have ObjectIDs, further steps are necessary to be able to interact with the data spatially.

Best,
Melanie S.
0 Kudos
SolanaFoo4
New Contributor III

Looks like this is unresolved still?

0 Kudos