Invalid column name 'Envelope_MinX'

Topics: Data Access, General Topics
Jul 30, 2007 at 2:18 PM
Hi,

I am new to both the SharpMap and MsSQLSpatial projects. I have successfully loaded some points into a new point table stored in MS SQL Express. When trying to instantiate the map and zoom to the extent of my three points I get the following error when calling the ZoomToExtents method:

Invalid column name 'Envelope_MinX'.
Invalid column name 'Envelope_MinY'.
Invalid column name 'Envelope_MaxX'.

Has anyone seen this before? Thanks.

Cheers,
Blair
Developer
Jul 30, 2007 at 6:38 PM
How did you load the data?
Make sure you used one of the methods described here

Best regards,
Ricardo Stuven.
Jul 30, 2007 at 8:18 PM
Ricardo,

Thanks for the response. I loaded my shapefile point data set that consists of only four points via the msscmd command utility using the following tutorial: http://arbfranklin.com/wp/2007/01/07/spatial-data-support-for-sql-server-2005

I am able to perform queries on the data table. Is this the prefered method? I thought that it might be something with my data but I seem to have the same problem with the sample SharpMap data loaded into SQL Server.

Any thoughts?

Cheers,
Blair


rstuven wrote:
How did you load the data?
Make sure you used one of the methods described here

Best regards,
Ricardo Stuven.

Developer
Jul 30, 2007 at 9:42 PM
Please, provide the full exception message (call stack and everything...)

Best regards,
Ricardo Stuven.
Jul 30, 2007 at 10:32 PM
Hi Ricardo,

Thanks again for your assistance. I simply just modified the maphelper.cs class from using a shapefile to using my test point. Here is a stub of the code and the associated stack trace...
.
.
.

SharpMap.Layers.VectorLayer layCountries = new SharpMap.Layers.VectorLayer("gRobPoint");
string ConnStr = @"Data Source=it01315\sqlexpress;;Initial Catalog=gistesting;User Id=gisuser;Password=gisuser";
layCountries.DataSource = new SharpMap.Data.Providers.MsSql(ConnStr, "gRobPoint", "the_geom", "oid");
layCountries.SRID = 4269;
layCountries.Style.Symbol = new Bitmap(HttpContext.Current.Server.MapPath(@"~\App_data\icon.png"));
layCountries.Style.SymbolScale = 0.8f;
map.Layers.Add(layCountries);
.
.
.

[SqlException (0x80131904): Invalid column name 'Envelope_MinX'.
Invalid column name 'Envelope_MinY'.
Invalid column name 'Envelope_MaxX'.
Invalid column name 'Envelope_MaxY'.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +862234
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +739110
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1956
System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +31
System.Data.SqlClient.SqlDataReader.get_MetaData() +62
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +903
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +122
System.Data.SqlClient.SqlCommand.ExecuteReader() +84
SharpMap.Data.Providers.MsSql.GetExtents() +163
SharpMap.Layers.VectorLayer.get_Envelope() +43
SharpMap.Map.GetExtents() +74
SharpMap.Map.ZoomToExtents() +10
Simple.Page_Load(Object sender, EventArgs e) in c:\Inetpub\wwwroot\OSMap\Simple.aspx.cs:30
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061




rstuven wrote:
Please, provide the full exception message (call stack and everything...)

Best regards,
Ricardo Stuven.

Developer
Jul 31, 2007 at 2:59 PM

SharpMap.Data.Providers.MsSql.GetExtents() +163


You have to use the MsSqlSpatial provider. MsSql is a provider for MS SQL Server without MsSqlSpatial extensions.

Best regards,
Ricardo Stuven.