ThinkGeo.com    |     Documentation    |     Premium Support

MsSql2008FeatureLayers

Hi Guys,


Couple of questions:-


1.  Might be missing something here but I can't seem to find a way to create a layer using an SQL query, can see the ConnectionString and TableName but how to you use a query?


2. MsSql"008FeatureLayers seem to work fine with Planar data but things seem to go wrong when using Spheric geometry, is this supported yet? 


Regards


 


John



John,


1, there is a method ExecuteNonQuery() in MsSql2008FeatureLayer 
 

MsSql2008FeatureLayer sqlLayer = new MsSql2008FeatureLayer();
sqlLayer.ExecuteNonQuery("Sql Statement");

 
2, Spheric geometry is supported in our system. When importing data to SQL server if the type is set to “Geography Data” instead of “Geometry Data”, our product we will see the data as spheric geometry instead of Planar.

 


Ben























v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}










Hi Ben,


Thanks for the reply.


Time for a little more information from my end I feel.


What I am endeavouring to do here is to test ThinkGeo against a table we have on our SQL 2008 server. The table consists of a very tiny subset (47,000 rows) of our Marine shipping route database.  Each record simply represents a polyline from one location to another, these are in spheric geometry format rather than Planar. Thus a Pacific record is something like Geography::STGeomFromText('LINESTRING(-112.7 24.7,139.4 34.2)’,4236) which represents a line from West to East crossing the 180 meridian.


We have been running tests against this table using the Sql Spatial Query Visualizer from Morton Nielsen, using this tool against the record above gets you the see in the image below.























What I am attempting to do is to build this utility using ThinkGeo as an exercise in getting to grips with ThinkGeo 3.0 and our data.


Obviously there is a need to be able to run a query against the server, obtain the results and display them.  It is this sort of query I was after, the ExecuteNonQuery you mention does not return a result set.  I am now wondering if the MsSql2008FeatureLayer is the right thing or if it’s a custom data provider that is needed?


Secondly, the SSQV does handle the 180 meridian as shown in the screen shot, hence the question about spheric geometry.


Regards


John



John, 



Thanks for your reply; it makes much clearer for me. 



It is a bug that we don't have the method for getting SQL result. We have added the following method which will be available in the coming release. Sorry for the inconvenience. 


MsSql2008FeatureLayer sqlLayer; 
DataTable dataTable = sqlLayer.QueryTools.ExecuteQuery("query statement"); 



We can handle the 180 meridian with polylines. Here below is the API, Just have a try on this one. 


PointShape firstPoint = new PointShape(); 
firstPoint.GreatCircle(LastPoint) 



Seems you just started with Map Suite, I am sure you will have a good experience. Any queries just let us know 



Ben. 

 



Hi Ben,


Thanks for the update.


We will wait for the next release.


I saw the GreatCircle stuff but have a question.  I see that this draws the GC between the points but does it result in a line that can be selected by clicking on it in the map or is this just a projected line?


Regards


John



John, 
  
 The function returns a MultiLineShape, which just presents a shape without any rendering info of it. If you want to show it on the map, you need to provide a style (the width, the color) for it. If you want to select it by clicking, you need to hook up map’s MapClick event and do a spatial query. Please have a look at the sample Features->DetermineTheAreaOfAnAreaFeature for reference.  
  
 Ben 


Hi Ben,


Thanks for the heads up.


John



Let us know for any more queries. Hope you have a good time with Map Suite Products.