GeometryFeatureProvider add points and lines by code with Attributes

Topics: Data Access
Feb 26, 2010 at 12:21 PM

Ciao,

i would like to use the GeometryFeatureProvider adding by code some Points and some Lines    each of this points and lines can have differents attributes....

How can i add this type of elements in my map?

P.s. basing on that attributes i'll use a specific VectorStyle....  but this is clear to me... i'll use a Theme and the delegate ecc ecc  that's ok...  but now my problem is how to build the data....

 

Thanks

Alberto

Coordinator
Feb 26, 2010 at 12:33 PM

Hi Alberto, just create A FeatureDataTable (like a normal DataTable but with the extra Geometry column /functionality)  add columns and populate it  then use that in the constructor of the GeometryFeatureProvider. hth jd

Feb 26, 2010 at 12:42 PM

Ciao Johndiss...  i knew even the Feature Data Table...  but not how to fill ....

For example:  i wuould like to add a Point:

Point aPoint = new Point(1, 1);

But i wuold like to have a row of a Feature Data Table "linked" to that point...  how can i do that?

I didn't know even if i can add "Point" like for the GeometryProvider or if i have to put this Featuers informatioin directly inside the FeatureDataTable?

Thanks again

Alberto

Coordinator
Feb 26, 2010 at 12:59 PM
FeatureDataTable fdt = new FeatureDataTable();
fdt.Columns.Add("MyAttributeColumn", typeof(TMyAttribute));

FeatureDataRow fdr = fdt.NewRow();
fdr.Geometry = new Point(someX, someY);
fdr["MyAttributeColumn"] = someVariable;

fdt.AddRow(fdr);

 

//may not be perfect but should get you started.. jd

Feb 26, 2010 at 1:17 PM

AH OK!

this is the KEY of the post...   fdr.Geometry

A Feature Data Row has its own Geometry property!...   veeery nice!