POST
|
Hey there, when I query a featureClass with featureClass.Search(filter, true) I get the exception mentioned above. Unfortunately I cannot reproduce this error in any way, it happens only on production-machine of a customer. But hence the data being queried is quite huge (some millions of points) searching for the one feature that fails nearly impossible or at least quite annoying. My customer also guaranteed that there are no writing processes on the featureClass (SDE-version), so I wonder where this exception may come from. To save memory I release every row after having handled it (calling Marshal.ReleaseComObject within a loop as long as references exist):
List<string> UUIDs = new List<string>();
IQueryFilter filter = new QueryFilter { SubFields = "UUID"}; // this should save us so much time
cursor = ((ITable)dataset).Search(filter, true); // we take a recycling-cursor because we handle only immutable strings (UUIDs)
while ((row = cursor.NextRow()) != null)
{
UUIDs.Add((string)row.get_Value(1));
ReleaseComObject(row); // release the underlying COM-object as often as references exist
}
After many thousands of features handled we get the exception. Unfortunately I could not even print any ID of the faulty feature to handle it manually because I cannot access it. I do not have any clue how I may get around the issue or at least how to avoid it. Kind regards
... View more
08-29-2014
03:33 AM
|
0
|
2
|
1155
|
POST
|
I have found that SQL queries directly to the SQL tables are much faster anyway, so often I will query directly from the SQL tables and extract unique IDs from the returned record set loading them into an array, then in a little loop build a selection string from that. I found it to sometimes be faster doing it that way? That´s more or less why I do at the moment because the alternative way by using IQueryDef won´t work (I already pointed the exception out in previous post). Actually I do a spatial query on my FeatureClass and select only the IDs of the features. Afterwards I put the list of the so obtained IDs into one (or more, depending on the length and the DBMS) whereClause for the attribute-query on the other table. Ofc. doing this by plain SQL might be much faster, but also much more complicated because of archieve-issues and I´d like to take the ArcGIS-way 🙂 However I consider it more a workaround then the actual solution, so I´m still looking for the reason of this irritating exception. Does anyone have any similar problem on opening a virtual/temporal table?
... View more
07-01-2014
01:32 AM
|
0
|
0
|
966
|
POST
|
For some reason I get the SEHException -2147467259, no matter if CopyLocally is set to true or false so its no issue on right-access. Do I have to consider a special syntax for the whereClause on an SDE which may differ from Table.Field? Currently this is the code:
/// <summary>
/// Virtually joins two tables
/// </summary>
/// <param name="objectTable">the businesTable</param>
/// <param name="geometryTable">the geometry-table where the shapes are stored</param>
/// <param name="whereString">an additional whereString to further specify the query</param>
/// <param name="uuidField">the identifier-field within the geometry-table (usually OFID) used for joining the tables</param>
/// <returns>a FeatureClass that contains the the Objektart, the Modellart and the geometries of the joined tables</returns>
/// <remarks>
/// The join is performed by evaluating the UUID-field of the object-table and the UUID-field of the geometry-table
/// (while the former is already "UUID" the latter may vary).<br> />
/// The returned featureClass contains the fields Modellart (MAT) and Objektart (OBA) from the objectTable and all fields of the geometry-table.
/// </remarks>
private IFeatureClass joinTables(string objectTable, string geometryTable, string whereString, string uuidField)
{
// queryDef to perform a join on the object- and the geometry-table
IQueryDef queryDef = ((IFeatureWorkspace)this.Workspace).CreateQueryDef();
// select the Objektart (OBA), the Modellart (MAT) and all columns from the geometry-table (where the ESRI-feature is stored)
queryDef.SubFields = objectTable + ".OBA," + objectTable + ".MAT," + geometryTable + ".*";
queryDef.Tables = objectTable + "," + geometryTable;
queryDef.WhereClause = objectTable + ".UUID = " + geometryTable + "." + uuidField; // the join-criterion
IQueryName2 queryName2 = (IQueryName2)new FeatureQueryNameClass();
queryName2.QueryDef = queryDef;
//queryName2.PrimaryKey = geometryTable + "." + uuidField; // the ID-field of the FeatureClass
//queryName2.CopyLocally = true;
// Set the workspace and name of the new QueryTable.
IDatasetName datasetName = (IDatasetName)queryName2;
datasetName.WorkspaceName = (IWorkspaceName)(((IDataset)this.Workspace).FullName);
datasetName.Name = "tmpTable";
// Open the virtual table.
ESRI.ArcGIS.esriSystem.IName name = (ESRI.ArcGIS.esriSystem.IName)queryName2;
return (IFeatureClass)name.Open();
}
... View more
06-26-2014
07:04 AM
|
0
|
0
|
966
|
POST
|
Thanks for your further replies, Why not just perform a spatial query and then an attribute query to further refine your search results. I guess I'm not reading it right or just misunderstanding what you are trying to do? No, you understand correctly. Honestly this was my first approach and it works, but I looked for a faster way because looping every feature and checking it for the second condition (be it spatial or not) does not seem convenient to me. It can be helpful to some posters, to know what language they are using so that others can provide samples that match. Btw.: Although it won´t matter that much, I´m writing with C# .NET 3.5 @CC4Ever: I have only one further issue on using the TableQueryNameClass on my SDE. I do not understand exactly what the copyLocally-param is for, I suppose I do not have write-access for the destination-machine (I get a really "meaningful" SEHException when calling Open on the IName-instance) in order to build the table locally or where exactly is this table created? Because of this error I left out the parameter and it works but for testing-purposes I´d like to see the data within the table also. So is this even possible when accessing a non-locale SDE? Thanks for all your hints so far
... View more
06-26-2014
12:39 AM
|
0
|
0
|
966
|
POST
|
Thanks for your replies, If you have joined your tables [...]? The question is on how to do this on a query in a non-persistent way. That was why I suggested using IQueryDef in combination with TableQueryName to build a virtual (joined) table and afterwards query that table spatially. Is this the way or is there another one to achieve this? Btw.: Although it won´t matter that much, I´m writing with C# .NET 3.5
... View more
06-25-2014
07:04 AM
|
0
|
0
|
966
|
POST
|
Hey around, I´m trying to build a query that provides access to features within a FC that intersect a given geometry AND that apply to an attribute-based query from another table by a join. For the last one I may use the IQueryDef-interface as it allows joining data based on an attribute-based query, but I need both - a spatial and a attribute-component. Is there any better way then creating one of the filters first, looping the results and checking every feature for the second condition? Maybe by building a temporary table using IQueryTable from the QueryDef-object and than perform a spatial query on it? Thanks in advance 😄
... View more
06-25-2014
03:46 AM
|
0
|
8
|
3172
|
POST
|
The featureClasses are indeed in different datasets, but their tolerance is the same (predefined in our database-schema). Actually this tolerance is much greater then the obtained error, while the former is set to 0.0001m (for the whole SDE) the latter is around 0.0000000009 as mentioned before, so I wonder why the engine recognizes this difference anyway... Both FCs are stored within an SDE.
... View more
03-02-2014
10:27 PM
|
0
|
0
|
179
|
POST
|
Hey around, I have a two featureClasses of type Polygon where the slave-class depends on the master-class. Having said this I want to reshape some portions of the slave-class (I call them Candidates within my code) by the appropriate paths within the master-class. So I start up querying the slaves that belong to a given master-features by using a spatial query (intersect). Now I loop every point within the slave and compare them to the points within the master. I assume the following condition for my candidate: The from-point and the to-point of the Candidate coincide the master-geometry. So I calculate the distance of the points within the slave-geometry to the master-geometry using the IProximityOperator-interface (with master-geom as proxy). A distance of 0 indicates that the point is on the master-geometry. So I build up the candidates as ICurve-members by adding all the points that do NOT coincide the master-geometry and finally append the from- and to-point (which DO coincide). Now I have a set of candidates that represent ICurve-members. The following code retrieves the candidates:
IPointCollection4 points = (IPointCollection4)slave.Feature.Shape; // the points of the slave-feature
IPoint fromPoint = null; // fromPoint of the candidate
IPoint toPoint = null; // toPoint of the candidate
IPolyline curve = new PolylineClass(); // the geometry of the candidate to add to the result-list
IPointCollection curvePoints = (IPointCollection)curve;
for (int j = 19; j < 22; j++) // consider only these three points
{
// iterate through the points of the slave-geometry
IPoint point = points.get_Point(j);
double distance = proxy.ReturnDistance(point); // distance from every point within the slave to the master-geometry
if (distance > TestClass.Tolerance) // point is totally outside
{
// does not happen in our test-case
// ...
}
else if (distance < TestClass.Tolerance && distance > 0) // point is within the tolerance so it might be a candidate
{
curvePoints.AddPoint(point);
}
else
{
// point touches the outline of the feature. These touching points form the borders of the correction
if (fromPoint == null) fromPoint = point; // set the fromPoint if not exists
toPoint = point; // set the toPoint
// terminate the candidate and append it to the result
IRelationalOperator relOp = (IRelationalOperator)fromPoint;
if (!relOp.Equals(toPoint))
{
// terminate the current curve
// add the fromPoint to the curve
object before = (object)0;
object after = Type.Missing;
curvePoints.AddPoint(fromPoint, ref before, ref after);
// add the toPoint to the curve
curvePoints.AddPoint(toPoint);
fromPoint = point; // make the current toPoint the next fromPoint
toPoint = null;
Candidate candidate = new Candidate(curve);// build a new (temporary) candidate from the curve
result.Add(candidate);
}
}
}
What I do next is getting the actual reshaper-geometry from the master-feature. Therefor I extract the portion of the master-geometry that fits from- and to-point of my candidate using this code:
IPoint fromPoint = this.Geometry.FromPoint; // "this" is the candidate we retrieved in the previos code
IPoint toPoint = this.Geometry.ToPoint;
double fromDistance = 0, toDistance = 0; // distances along the curve
// if these variables are not equal 0 the given point does not belong to the curve
double fromAcrossDistance = 0, toAcrossDistance = 0; // distances across the curve
// get the ring that forms the masterGeometry in order to access the methods for querying near points
IRing ring = new RingClass();
((ISegmentCollection) ring).AddSegmentCollection((ISegmentCollection) masterGeometry);
// calculate the distance of the fromPoint to the master-geometries along its curve
ring.QueryPointAndDistance(esriSegmentExtension.esriNoExtension, fromPoint, false, null, ref fromDistance, ref fromAcrossDistance, false);
// calculate the distance of the toPoint to the master-geometries along its curve
ring.QueryPointAndDistance(esriSegmentExtension.esriNoExtension, toPoint, false, null, ref toDistance, ref toAcrossDistance, false);
// when either the from- or the toPoint does not coincide with the geometry we return an empty curve
// obviously here is the problem
// although we got the from- and toPoints of the candidate (this) by checking if their distance to the masterGeometry is 0 we get some (quite small)
// difference to 0 in the distances accross the curve
if (fromAcrossDistance > 0 || toAcrossDistance > 0) return (ICurve) new Path();
What is strange in here is that for the same candidate (whose from- and to-point are on the master-geometry, compare condition) we get from/toAcrossDistances that are not exactly 0 but sth. around 0.0000009 or so. why do IRing#QueryPointAndDistance and IProximityOperator#ReturnDistance behave so different and how can I avoid this? I hope that you can follow my thoughts and help me finding out the issue behind. I append two shape-files with the mentioned features also. Bye
... View more
02-21-2014
01:56 AM
|
0
|
2
|
568
|
POST
|
As I already assumed reproducing this error could become hard...
... View more
07-31-2013
01:59 AM
|
0
|
0
|
957
|
POST
|
I try to... The masterClass serves only for information, this is where the Reshaper came from. The slave (in the code above this is the editGeometry) should be reshaped by the Reshaper that has been derived from the MasterClass. I hope it works...
... View more
07-30-2013
06:29 AM
|
0
|
0
|
957
|
POST
|
Are the shaper geometry and edit geometry simple? Yeap, checked it out bye making QI-call to ITopologicalOperator.
... View more
07-29-2013
12:01 AM
|
0
|
0
|
957
|
POST
|
You may use the from- and toPoint of a given feature store the values to the labels position. But as far as I know the outer rings of polygons are always stored clockwise, inner rings counter-clockwise (at least inside a GDB)
... View more
07-26-2013
05:27 AM
|
0
|
0
|
198
|
POST
|
Thanks for the reply, as I do not enabled m- or z-values I can ensure thats not the problem. I post some code that may help to identify the problem:
IGeometryCollection rings = (IGeometryCollection) editGeometry; // the rings of the edit-geometry
IGeometryCollection paths = (IGeometryCollection) reshaper; // the paths of the reshaper
if (paths.GeometryCount > 1) throw new ArgumentException("The reshape-geometry must be single-part");
for (int i = 0; i < rings.GeometryCount; i++) {
// get the affected rings of the current polygon
IRelationalOperator relOp1 = (IRelationalOperator) reshaper.FromPoint;
IRelationalOperator relOp2 = (IRelationalOperator) reshaper.ToPoint;
// check if Ring touches from- and toPoint of the reshaper
if (relOp1.Touches(singlePolygon) && relOp2.Touches(singlePolygon)) {
IPath path = (IPath) paths.get_Geometry(0);
bool res = ring.Reshape(path);
// only in case of success the ring is reshaped
if (res && !ring.IsEmpty) return editGeometry;
}
}
I just figured out that the spatial-reference of the from- and toPoint of the ring is NULL although the rings reference-system is set. As this was also the problem on my last topic I assume it also has to do with the current one, but I don´t know why the reference gets lost or how I can reset it if the according ring already has one... EDIT: Sry, I had a writing-mistake, the error-code is -2147220935 rather then 936, so it fits to the received error-message: "an internal error has occured in the geometry system".
... View more
07-25-2013
11:37 PM
|
0
|
0
|
957
|
POST
|
Hey there, after being glad to have solved my last problem I just come up with a new one which I can´t figure out. When reshaping a polygon I use Ring#Reshape(IPath), which gives me a boolean if all worked fine. Unfortunelty it won´t give me any return-value but an exception which is -2147220936. I just looked the codes and found NETWORK_E_EDIT_SESSION_IN_PROGRESS but as the last problem wasn´t related with any Network-features (since I do not use them at all) I´ll bet this error has also nothing to do with this confusing message. So I googled for the error-code and found out that the actual error-message to this code is "The coordinates or measures are out of bounds." (which I cannot conform again as I do not receive any error-message). But as the concerned feature is located in the centre of my featureClass I cannot imagine this is really the clue. So which error is right and what exactly does it have to do with my problem of reshaping an IRing?
... View more
07-25-2013
07:36 AM
|
0
|
8
|
1760
|
POST
|
Thanks for the hint, actually the spatial references of the concerned featureClasses is set correctly, it seems its getting lost while doing some geometric operations on the features. This is why I have to reset it to the reference set in the featureClass.
... View more
07-25-2013
06:35 AM
|
0
|
0
|
327
|
Title | Kudos | Posted |
---|---|---|
1 | 08-29-2019 02:09 AM | |
4 | 10-02-2018 02:03 AM | |
1 | 10-01-2018 06:19 AM | |
1 | 02-26-2018 06:57 AM | |
1 | 11-18-2016 01:43 AM |
Online Status |
Offline
|
Date Last Visited |
02-21-2024
06:38 AM
|