Attached is a small file geodatabase with one featureclass. When I query with the point shown on the attached map(expanded slightly to make an envelope), I get three results. The correct one, David James, but also Tandy and Hamilton, which is obviously wrong. There should be only one row returned, but I am getting three.
Thanks
Code:
static void Main(string[] args) { Geodatabase geodatabase = null; Table table = null; try { geodatabase = Geodatabase.Open(@C:\Temp\test.gdb); Esri.FileGDB.Point pt = new Esri.FileGDB.Point(); double x = 1204123.4375; double y = 273148.87152777775; pt.x = x; pt.y = y; Envelope envelope = new Envelope(); envelope.xMin = x - .00001; envelope.yMin = y - .00001; envelope.xMax = x + .00001; envelope.yMax = y + .00001; table = geodatabase.OpenTable("MetroCouncil"); RowCollection spQueryRows = table.Search("*", "", envelope, RowInstance.Recycle); foreach (Row spQueryRow in spQueryRows) { Console.WriteLine(spQueryRow.GetString("COUN_NAME").ToString()); } Console.ReadLine(); } catch (Exception ex) { } finally { table.Close(); geodatabase.Close(); } }
THanks, I will provide a data and code sample in the morning when I am back at my PC.
It's only a bug if the three returned shapes do not overlap the requested envelope. Do they? Can you provide a FGDB data sample and the corners of the envelope with which you're querying?
ALL application code must handle the possibility that a point-in-poly query could return zero, one, or many features. With a simple envelope search, the probability of multiple return rows approaches unity.
Since there's no way to alter the design without including a full geometry processing library in the FGDBAPI DLL (and that doesn't seem likely), the best possible solution is going to be a simple helper function to test point-in-polygon (and even that will need to return a ternary response -- {"IN", "OUT", "ON"}).
- V
I am having the same issue. I have a point that I have converted to an extremely small envelope, but I get get 3 results back from my query and should only be getting one. This seems like a bug.
Anyone from ESRI reading these?
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.