private void AddPictureMarkerAndTextGraphics()
{
string gpsNMEASentences = "$GPGGA, 92204.9, -35.6334, N, -60.2343, W, 1, 04, 2.4, 25.7, M,,,,*75\r\n" +
"$GPGGA, 92510.5, -49.9334, N, -65.2131, W, 1, 04, 2.6, 1.7, M,,,,*75\r\n";
string[] gpsNMEASentenceArray = gpsNMEASentences.Split('\n');
GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
for (int i = 0; i < gpsNMEASentenceArray.Length - 1; i++)
{
string[] gpsNMEASentence = gpsNMEASentenceArray[i].Split(',');
MapPoint mp = new MapPoint(Convert.ToDouble(gpsNMEASentence[4]), Convert.ToDouble(gpsNMEASentence[2]));
MapPoint conv_mp = wm.FromGeographic(mp) as MapPoint;
Graphic graphic = new Graphic()
{
Geometry = conv_mp,
Symbol = GlobePictureSymbol
};
graphicsLayer.Graphics.Add(graphic);
TextSymbol textSymbol = new TextSymbol()
{
FontFamily = new System.Windows.Media.FontFamily("Arial"),
Foreground = new System.Windows.Media.SolidColorBrush(Colors.Black),
FontSize = 18,
Text = gpsNMEASentence[9]
};
Graphic graphicText = new Graphic()
{
Geometry = conv_mp,
Symbol = textSymbol
};
graphicsLayer.Graphics.Add(graphicText);
}
}