This project has moved and is read-only. For the latest updates, please go here.

Attribute data is not supported by the GeometryProvider

Topics: SharpMap v2.0, WinForms Controls
Aug 14, 2013 at 8:09 PM
Dear all,

I am currently trying to use query tool provided by SharpMap. What I am doing is to use querybox to select a set of points with attributes and highlight them on the map. From searching in the Discussion I understand FeatureEnquery toolstrip could help me.

I defined two variables:
        private GeometryFeatureProvider _geometryProvder;

        private VectorLayer vl;
I hook the event in Window Form Load() as
            this.mapBox1.MapQueried += mapBox1_FeatureQueried;
I then create a method
        private void mapBox1_FeatureQueried(FeatureDataTable features)
            OnClear(this, EventArgs.Empty);

            if (mapBox1 == null) return;

            _geometryProvder = new SharpMap.Data.Providers.GeometryFeatureProvider(features);
            vl = new SharpMap.Layers.VectorLayer("QueriedFeatures", _geometryProvder);
            vl.IsQueryEnabled = false;

            var map = mapBox1.Map;


        private void OnClear(object sender, EventArgs e)
            if (mapBox1 == null) return;

            var map = mapBox1.Map;
            if (vl != null && map.Layers.Contains(vl))
                vl = null;
This actually is the same like the sample project. But when I compiled it, it displayed

Attribute data is not supported by the GeometryProvider,
But here I actually have defined the GeometryFeatureProvider to do the work? I am totally confused, and looking for your helps?
Aug 15, 2013 at 5:51 AM
What version of SharpMap are you using?

For the code above there is no querying going on, just display of results. The error seems to come from the actual querying of data. What datasource does contain the sourcedata?
Aug 16, 2013 at 12:59 PM
Sorry for the late reply.

for both SharpMap and SharpMap.UI, I used a v4.030319 version.

I have tesed different data sources:

If I did not put any data in Mapbox and just a empty mapbox, if I do the query, I can apply a grey rectangle box and map box but one mouse up, it shows "Attribute data is not supported by the GeometryProvider" .

If I try to upload a tile google map and do same operation,it shows the same like above .

If I try to other sharpfiles(e.g. a point and a line layer), it also show same information like above.

I am therefore confused about the data source.
Aug 18, 2013 at 8:01 PM
You need to set MapBox.QueryLayerIndex to the layer you wish to query.

AFAIK, if you draw your own geometries they are stored using a GeometryProvider. If that is your only layer you are bound to get that error, because you cannot query a GeometryProvider for data.