MsSqlSpatial: function missing

Topics: Data Access, General Topics
Jun 20, 2007 at 10:28 AM
I can not verify if I am using the correct version is MSSql.cs but I don't see GeometryExpression funtion.

I wanted to test this funtion in the thread http://www.codeplex.com/SharpMap/Thread/View.aspx?ThreadId=1544

// Simplify with 100 meters of tolerance.
datasource.GeometryExpression = "ST.Simplify({0}, 100)";

Can someone or Ricardo verify this.

Does anyone have more examples for MsSqlSpatial using SharpMap?
Coordinator
Jun 20, 2007 at 12:14 PM

brianelley wrote:
I can not verify if I am using the correct version is MSSql.cs but I don't see GeometryExpression funtion.

I wanted to test this funtion in the thread http://www.codeplex.com/SharpMap/Thread/View.aspx?ThreadId=1544

// Simplify with 100 meters of tolerance.
datasource.GeometryExpression = "ST.Simplify({0}, 100)";

Can someone or Ricardo verify this.

Does anyone have more examples for MsSqlSpatial using SharpMap?


Hi,

Have you tried to cast your data source into MsSqlSpatial class and after that you should be able to assign your expression.

regards
Christian
Developer
Jun 20, 2007 at 6:01 PM

I can not verify if I am using the correct version is MSSql.cs but I don't see GeometryExpression funtion.


MsSql.cs is not the MsSqlSpatial provider. Look for MsSqlSpatial.cs

Best regards,
Ricardo Stuven.
Jun 22, 2007 at 10:16 AM
Yup, I got it from the latest change set.

I tryed this:
datasource.GeometryExpression = "ST.Buffer(the_geom, 20)";

It seems like the query is still looking for _definitionQuery variable than _GeometryExpression. So, the application is failing with the exception: "System.NullReferenceException was unhandled" in GetExtents() function.

Again, am I looking at the correct version? Because this seems like an obvious error.
Jun 23, 2007 at 6:38 AM
Edited Jun 23, 2007 at 9:03 AM
Is this function
datasource.GeometryExpression = "ST.Buffer(the_geom, 20)";
working for anyone else?

I edited MsSqlSpatial to assign _GeometryExpression value to _definitionQuery.

Still it is failing with the following exception:
Msg 6522, Level 16, State 1, Line 1
A .NET Framework error occurred during execution of user-defined routine or aggregate "EnvelopeQueryWhere": 
System.Data.SqlClient.SqlException: An expression of non-boolean type specified in a context where a condition is expected, near ')'.
System.Data.SqlClient.SqlException: 
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnectionSmi.EventSink.ProcessMessagesAndThrow(Boolean ignoreNonFatalMessages)
   at Microsoft.SqlServer.Server.SmiEventSink_Default.ProcessMessagesAndThrow(Boolean ignoreNonFatalMessages)
   at Microsoft.SqlServer.Server.SmiEventSink_Default.ProcessMessagesAndThrow(Boolean ignoreNonFatalMessages)
   at System.Data.SqlClient.SqlDataReaderSmi.InternalNextResult(Boolean ignoreNonFatalMessages)
   at System.Data.SqlClient.SqlDataReaderSmi.NextResult()
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderSmi(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader()
   at UserDefinedFunctions.EnvelopeQueryWhere(SqlString table_name, SqlString column_name, SqlString condition)
Jun 26, 2007 at 5:53 AM
I might be doing some small mistake. Can some one please with my testing?
Developer
Jun 27, 2007 at 10:56 AM
Check out the latest version.

Best regards,
Ricardo Stuven.
Jun 27, 2007 at 11:28 AM
Just did. Amazing to see how it works...
Thanks!