Select to view content in your preferred language

Wrong attributes when executing query on shapefile

589
1
11-20-2017 06:53 AM
HaukeStieler
New Contributor

Dear esri community,

we have the following problem searching for a feature at a certain map position:

We load a shapefile with ShapefileTable.OpenAsync and save its content in a FeatureTable variable. The shapefile contains a large number of features with Geometry which do not overlap.
Later, in a method in a different class, we use QueryAsync with a SpatialQueryFilter to find the feature at a certain MapPoint:

FeatureTable shapefile = ShapefileTable.OpenAsync(@"C:\Polygon.shp").Result;

...

public Feature GetFeatureAt(FeatureTable featureTable, MapPoint point)
{
    SpatialQueryFilter spatialQueryFilter = new SpatialQueryFilter
    {
        Geometry = point,
        SpatialRelationship = SpatialRelationship.Within
    };

    var features = featureTable.QueryAsync(spatialQueryFilter).Result;

    return features.FirstOrDefault();
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

This works fine the first time after the shapefile was opened, but never again after that. We get the same seemingly random result with wrong feature attributes for any MapPoint each time we execute the query, but the geometry we get is always correct. As a workaround, reopening the file before each query works fine.

The exact same code where the same FeatureTable is loaded via an online FeatureService equally works without problem.

We use ArcGis .net runtime 10.2.5 and tried 10.2.7 as well. We tried running the code under Windows 7, 8 and 10 with the same results.

Does anyone have an idea why this error occurs or whether this might be an error in the Esri framework?

Regards,

Hauke Stieler

0 Kudos
1 Reply
MichaelBranscomb
Esri Frequent Contributor

Hi,

I have not been able to reproduce this using v10.2.7. Please can you provide a code example (and ideally the shapefile) that repeatably shows this problem?

If you are not able to share the code/data here, please email mbranscomb@esri.com.

Cheers

Mike

0 Kudos