1

I have some XAML based diagrams that consist of Paths embedded in Canvas objects e.g.

<Canvas x:Name="c1" Width="55.2533" Height="18.2933" Canvas.Left="194.606" Canvas.Top="194.131">
<Path x:Name="Path_5" Width="8.02666" Height="13.44" Canvas.Left="0" Canvas.Top="0.559998" Stretch="Fill" Fill="#FF000000" Data="......etc"/>
</Canvas>

Is there a way/tool to convert the XAML to either a ShapeFile or SqlGeometry data? I need to convert as I want to display the graphic in a third party map control that only binds to ShapeFiles or SqlGeometry data.

Any help would be appreciated.

Myles J
  • 2,839
  • 3
  • 25
  • 41
  • Need a little more information. I see you want to go to a map, are the points already lat/long coordinates? Are you in a client/server environment, or strictly a silverlight app? Do you have the points separately already in memory, or are you given the points from the canvas? (i.e. Are they user generated?) – Brad Boyce Jul 25 '11 at 14:28
  • It's strictly a silverlight app. We are using the Infragistics map control and want to use it to display various diagrams of train lines (currently designed in XAML via Expression Blend) etc. We don't have lat/long coordinates. Ideally we want to end up with the equivalent shape file so that we can use the Infragistics control. I found an interesting article (http://channel9.msdn.com/Learn/Courses/SQL2008R2TrainingKit/SpatialSupport/UsingSpatialDataInManagedCodeLab/Exercise-1-Drawing-Spatial-Data) to convert Ink Stokes into SqlGeometry types, however, our diagrams use Paths and not Strokes. – Myles J Jul 25 '11 at 15:19

1 Answers1

0

The first thing to do would be to extract the path points. Then you need to produce your shape.

GETTING POINTS: this stackoverflow answer describes altering a shape, but you see how to get the points from a path.

BUILDING SHAPE:

Cant' use SqlGeometry with Silverlight:

I think part of the answer is you can't go to SqlGeometry directly in silverlight. Your example is using Microsoft.SqlServer.Types, which was not built for the silverlight runtime. If you were going to a service it would be no problem, the service could use the full .NET framework an you can use the path points to build a well-known-text string, and then go directly to a sqlGeometry using

SqlGeometry newGeom = SqlGeometry.STGeomFromText(wktstring, srid).MakeValid();

Best best is to try to create a shapefile

I'm afraid I can't help you with creating a shapefile, sorry. Haven't used them much.

Community
  • 1
  • 1
Brad Boyce
  • 1,248
  • 1
  • 17
  • 34