Error: "Attribute data is not supported by the GeometryProvider"

Topics: SharpMap v0.9 / v1.x
Mar 10, 2009 at 9:42 PM
hi all,

ich have to read polygon on Postgres and dynamicaly generate my map. I use the following source. But a received this error: "Attribute data is not supported by the GeometryProvider." and the layer can't generate.

The source code:

                            StringBuilder cmdText = new StringBuilder();
                            cmdText.Append(string.Format("SELECT AsEWKT(geo_value) as geo_value, group_value as ID, geo_coordinate FROM {0}.tx_shapes", dbschema));
                            DataTable geoTable = DataManager.Reader(cmdText.ToString());  // read data from postgres database
                            foreach(DataRow row in geoTable.Rows)
                            {
                                SharpMap.Geometries.Geometry geo = Geometry.GeomFromText(row["geo_value"].ToString());
                                geoList.Add(geo);
                            }
                            SharpMap.Layers.VectorLayer vLayer = new SharpMap.Layers.VectorLayer("My Layer");
                            vLayer.DataSource = new GeometryProvider(geoList);
                            vLayer.Theme = new SharpMap.Rendering.Thematics.CustomTheme(GetTXStyle);
                            vLayer.CoordinateSystem = CreateCoordinateSystemFromWKT(geoTable.Rows[0][2].ToString());
                            ...
                            map.Layers.Add(vLayer);
                           
                            System.Drawing.Image img = map.GetMap();        // I receive the error at this position of my source code.



What is wrong on the code ? Can someone help me please?

thanks.
abongs
Coordinator
Mar 10, 2009 at 10:19 PM
Hi abongs, use a FeatureProvider instead hth jd
Mar 10, 2009 at 11:33 PM
Hi johndiss,

thanks for your answers. But can you tel me more abour FeatureProvider? How can i use it with SharpMap 0.9? or 2.0?

thanks
abongs
Coordinator
Mar 11, 2009 at 12:43 AM
Hi abongs, I meant GeometryFeatureProvider  for 0.9, FeatureProvider is conceptually equivalent in v2 hope this clears things up. Both are like the GeometryProvider but allow access to attributes as well cheers jd
Mar 11, 2009 at 1:26 AM
Hi johndiss,

i am sorry, but can't find the GeometryFeatureProvider class in both version v0.9 and v2.0. I have installe the 2.0 version to day but.
It will very helfull for me if you can post a sample for that.

thanks a lot
abongs
Coordinator
Mar 11, 2009 at 12:18 PM
Hi abongs, make sure you build 0.9 from the source not the downlaod on the 'Releases' tab, then you will find GeometryFeatureProvider in the SharpMap.Data.Providers namespace hth jd
Mar 16, 2009 at 3:49 PM
Not sure how old this discussion is,  but I am getting same error.

I have downloaded and built source,  but cannot find the provider you list above.

Any suggestions?
Coordinator
Mar 16, 2009 at 4:03 PM
Hi seevo, see http://sharpmap.codeplex.com/SourceControl/changeset/view/48252#393256 the path on your disk will match the left hand tree.. hth jd
Mar 16, 2009 at 4:15 PM
JD - thanks for the reply.

All I see under my source tree in the SharpMap\Data\Providers\Pooling folder is Connctor.cs and ConnectorPool.cs.

Somehow I have the wrong code -

Could you post the proper URL for the source I'm looking for -


Thank You
Seevo the geo-n00bie
Coordinator
Mar 16, 2009 at 4:21 PM
Hi seevo, it isnt in the pooling directory it is @ SharpMap\Data\Providers\.
The latest 0.9 source is @ http://sharpmap.codeplex.com/SourceControl/ListDownloadableCommits.aspx I would recommend using tortoise to keep your local source up to date.. hth jd
Mar 16, 2009 at 5:23 PM
Hey thanks again

I was looking under the "Branch" folder instead of the "Trunk" -

seevo