How to work with XML

Topics: Data Access
Jan 24, 2013 at 10:34 AM
Edited Jan 24, 2013 at 10:35 AM

Hello everyone.

I'm new to sharpmap and I'd like to know if it is possible to work with xml. I've been seeing examples but they are all about oledb.

 I want to draw an image to the map thru xml at a certain coordinate.

 

The XML file's content is 

 

<?xml version="1.0" encoding="utf-8" ?>
<root>
  <Points>
    <Point>
    <X>13457786.5961983</X>
    <Y>1629064.58490612</Y>
    </Point>
  </Points>
  
</root>

 

 

 And the code in the event is..
DataTable DataTableW = new DataTable();
                DataTableW.TableName = "Points";
              //  DataTableW.ReadXml(
                DataTableW.Columns.Add("X");
                DataTableW.Columns.Add("Y");
                DataTableW.ReadXml("C:\\XMLFile1.xml");
                SharpMap.Data.FeatureDataTable fdt = new SharpMap.Data.FeatureDataTable();
                
               


                SharpMap.Layers.VectorLayer layAddresses = new SharpMap.Layers.VectorLayer("Points");
                layAddresses.DataSource = new SharpMap.Data.Providers.GeometryProvider(fdt);
                
              //  layAddresses.DataSource = new SharpMap.Data.Providers.GeometryFeatureProvider(fdt)
                MessageBox.Show(DataTableW.Rows.Count.ToString());
                SharpMap.Styles.VectorStyle defaultStyle = new SharpMap.Styles.VectorStyle();
                defaultStyle.Symbol = new System.Drawing.Bitmap(@"C:\\Users\\user\\Desktop\\image.png");
                layAddresses.Style = defaultStyle;
                defaultStyle.SymbolScale = 0.5f;

I hope someone could enlighten me on this one. Thanks!

Coordinator
Jan 25, 2013 at 8:21 AM

http://sharpmap.codeplex.com/SourceControl/changeset/101325#file_diff_2042194

Hth FObermaier

Oct 30, 2013 at 3:25 AM
Hi,
I am trying convert sharpmap to mxd arcmap file. Arcgis can read XML(GML?) file to IFeatureClass, with ESRI XML Schema.
Can I have use XML export from Sharpmap to load in mxd file?
Thanks,