Select to view content in your preferred language

How to autoload a layer of Lat/Long points stored in MS SQL 2008

2791
2
08-17-2013 09:16 PM
LawrenceMaina
Emerging Contributor
I use Arcmap to register a layer into ArcGIS server whose source data is spatial points stored in MS SQL 2008. Everything works fine until a new entry is added into the database table, it doesn't reflect even when I refresh the layer from the viewer. I am forced to use Arcmap to republish the layer again for the new point to be available to the Viewer. Is the any means of loading them automatically right from the database.
0 Kudos
2 Replies
YurongTan
Regular Contributor
GraphicsLayer myFoundGraphicsLayer = MyMap.Layers["MyFoundGraphicslayer"] as GraphicsLayer;
foreach (SQLDataRecord sqlrd in mySQLReturnedList)
{
Graphic myGraphic = new Graphic()
{
       Geometry = mercator.FromGeographic(new MapPoint(sqlrd.LON, sqlrd.LAT)),
       Symbol = LayoutRoot.Resources["myLargeBlueMarker"] as Symbol // : LayoutRoot.Resources["BlackMarkerSymbol"] as Symbol
}; 
myGraphic.Attributes.Add("RID", sqlrd.RID);
myGraphic.Attributes.Add("STA_NO", sqlrd.STA_NO);
myFoundGraphicsLayer.Graphics.Add(myGraphic);
}
0 Kudos
LawrenceMaina
Emerging Contributor
GraphicsLayer myFoundGraphicsLayer = MyMap.Layers["MyFoundGraphicslayer"] as GraphicsLayer;
foreach (SQLDataRecord sqlrd in mySQLReturnedList)
{
Graphic myGraphic = new Graphic()
{
       Geometry = mercator.FromGeographic(new MapPoint(sqlrd.LON, sqlrd.LAT)),
       Symbol = LayoutRoot.Resources["myLargeBlueMarker"] as Symbol // : LayoutRoot.Resources["BlackMarkerSymbol"] as Symbol
}; 
myGraphic.Attributes.Add("RID", sqlrd.RID);
myGraphic.Attributes.Add("STA_NO", sqlrd.STA_NO);
myFoundGraphicsLayer.Graphics.Add(myGraphic);
}


Thanks, I will try to make sense of how to get this into ArcGIS Viewer for Silverlight, am still new into this.
0 Kudos