This project is read-only.

Load data into Digitiser?!

Sep 1, 2010 at 4:09 PM

Hi,

 

does anyone have any experiences with the digitizer? I Added it to my map, and I generally able to load data from my sql server 2008 via a wcf service, but i don´t know how to load the data in my digitiser, edit it and store it back to my DB. It would be great if anyone could help me!

Thanks,

Dru

Sep 1, 2010 at 7:19 PM
Edited Sep 2, 2010 at 9:37 AM
If I remember right you can set the Geometry property to read and write your geometries.

From: dru_ms

Hi,

 

does anyone have any experiences with the digitizer? I Added it to my map, and I generally able to load data from my sql server 2008 via a wcf service, but i don´t know how to load the data in my digitiser, edit it and store it back to my DB. It would be great if anyone could help me!

Thanks,

Dru

Sep 1, 2010 at 9:44 PM

thank you for your answer... do you have an example?

i tried to orientate me at the layer example, but it doesn´t work... I am really desperate, I don´t know how to go on

Sep 2, 2010 at 9:36 AM

Here is a code snippet from a previos project I worked with, StyledGeometry is just an object to store geometry properteis. You have to listen to digitizer.Save.

 

void digitizer_Save(object sender, DeepEarth.Client.Controls.Digitizer.GeometryChangedEventArgs args)
        {
            if (args != null && args.NewGeometry != null)
            { 
                Guid uniqueid;
                if (string.IsNullOrEmpty(args.UniqueID))
                    uniqueid = Guid.NewGuid();
                else
                    uniqueid = new Guid(args.UniqueID);

                StyledGeometry styledGeom = new StyledGeometry()
                {
                    KMLStyle = args.StyleSpecification.ToKML(),
                    WKTGeom = args.NewGeometry.ToString(),
                    UniqueID = uniqueid.ToString(),
                };
                
                RenderGeometry(args.NewGeometry, args.StyleSpecification, styledGeom.UniqueID, true);
            }
        }
Per
Sep 2, 2010 at 11:00 AM

Hi,

thank you for the snippet. I will try to understand it...

What I first wanted to do is to load my WKB into the Digitiser...

I created a WCF which loads WKB,then I added a service reference to my mainpage to get the data:

private Collection<byte[]> Features = new Collection<byte[]>(); 

my data is now in my byte Collection called Features.

Now I want to visualize the the data with the digitiser. I thought this should work, but it didn´t:

var data = new ObservableCollection<VectorLayerData>();

            GisSharpBlog.NetTopologySuite.IO.WKBReader f = new GisSharpBlog.NetTopologySuite.IO.WKBReader();
            foreach (var feature in Features)
            {
                data.Add(new VectorLayerData
                {
                    Geo = f.Read(feature).AsBinary(),
                    ID = (new Guid()).ToString(),
                    Label = (new Guid()).ToString()
                });
            }
            vectorData["1"] = data;


Do I have to use a Layer to load the data into my digitiser?
Thanks,
Thomas