ThinkGeo.com    |     Documentation    |     Premium Support

Sql Stored Data to Points

I want to put bus stops as points. I have a small data that stores latitude ,longitude and bus stop name. And stored in sql server. How can i put this signs over my map? And which way can be the best, receiving from sqlserver or creating local dbf? 


If its possible can i convert my data to shp & dbf file with using thinkgeo?


Thanks,



Tolga, 
  
   I can help you with this but need a little more information.  There are a few ways to go with this depending on your requirements. 
  
   The first way is to keep the data in your SQL server and use OLEDB to access the data.  We have a sample of this kind of FeatureSource and FeatureLayer at the link below.  This would allow you to keep the data in SQL.  The advantage is that if this data changes frequently then your map will always have the most up to data data.  The minute you refresh it will reflect change in the database.  I only suggest this for point data in SQL Server.  If you have lines or areas then I suggest you use with the SQL 2008 with spatial support or you convert to shape file.  The drawback to this approach is that it is not as fast as a shape file.  For each refresh we will execute a SQL query and depending on your connection and network speed it could take various times to return. 
  
 In the link below we show you have to create your own feature source.  Even though you do not need to do this the project comes with a sample of creating a OlePointFeatureSource and FeatureLayer.  This is exactly what you need.  Our sample uses Access however if you change the connection string to use  a SQL Server one the sample should work just fine. 
  
 gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/16/aft/4769/afv/topic/Default.aspx 
  
 The second way would be to conver the points from SQL to a shape file.  To do this you would want to call the static API one the ShapeFileFeatureLayer called CreateShapeFile and follow the API.  Next you should open the created shape file.  Then you need to query the points from the database and loop through them.  When you start you can use QueryTools.BeginTransaction and then for every point call the add on the QueryTools.  When you are done with your records then call the QueryTools.CommitTransaction.  The advantage of this is that the drawing time will be faster.  The drawback is that if the data changes you need to do this process again and coordinate the replacing of the old shape files. 
  
   In the end I suggest you try the first approach and keep the data in SQL server. 
  
 David