[Geoserver-users] SQL Server Problem

I'm new to GeoServer but I have been able to get it up and running and
connecting to my SQL Server 2008 R2. I am working through the Book
"GeoServer Beginner's Guide" from Packt Publishing. I figured out how to
get the U.S. Census Counties shape file in to SQL Server and it shows as
spatial objects in SQL management studio so I think the data is OK.

My first problem is that when I ask it to compute the bounding box from data
I get the following:
/Oops, something went wrong...

Sorry, something unexpected happened on the server.

Here's an error report you can include in a JIRA bug report about this
issue:
java.lang.RuntimeException: java.io.IOException: Error occured calculating
bounds at
org.geotools.jdbc.JDBCFeatureSource.getBoundsInternal(JDBCFeatureSource.java:508)/

Ok so I go ahead and enter the bounding box manually and and I am able to
publish the layer. However,
now when I preview the layer it is blank and when I click in the map area I
get the following:

/Internal error occurred java.io.IOException null A .NET Framework error
occurred during execution of user-defined routine or aggregate "geometry":
System.ArgumentException: 24144: This operation cannot be completed because
the instance is not valid. Use MakeValid to convert the instance to a valid
instance. Note that MakeValid may cause the points of a geometry instance to
shift slightly. System.ArgumentException: at
Microsoft.SqlServer.Types.SqlGeometry.ThrowIfInvalid() at
Microsoft.SqlServer.Types.SqlGeometry.STIntersects(SqlGeometry other) at
Microsoft.SqlServer.Types.SqlGeometry.Filter(SqlGeometry other) . /

Apparently this was a problem back in 2010 with version 2.0.2. I am running
version 2.3.2. on windows server 2008 R2 and SQL Server 2008 R2 I don't want
to post a JIRA bug report, because I'm to new of a user to tell if it is a
bug or something I'm doing wrong.

Thanks,
Mark

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/SQL-Server-Problem-tp5060024.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

Hi,

I do not know anything about SQL Server but the error message makes me think that there are perhaps topology errors in your data. I would make a try with another dataset or by following the hint in the error message and running the MakeValid function in the SQL Server.

This operation cannot be completed because
the instance is not valid. Use MakeValid to convert the instance to a valid
instance. Note that MakeValid may cause the points of a geometry instance to
shift slightly.

-Jukka Rahkonen-
________________________________________
txrpls wrote:

I'm new to GeoServer but I have been able to get it up and running and
connecting to my SQL Server 2008 R2. I am working through the Book
"GeoServer Beginner's Guide" from Packt Publishing. I figured out how to
get the U.S. Census Counties shape file in to SQL Server and it shows as
spatial objects in SQL management studio so I think the data is OK.

My first problem is that when I ask it to compute the bounding box from data
I get the following:
/Oops, something went wrong...

Sorry, something unexpected happened on the server.

Here's an error report you can include in a JIRA bug report about this
issue:
java.lang.RuntimeException: java.io.IOException: Error occured calculating
bounds at
org.geotools.jdbc.JDBCFeatureSource.getBoundsInternal(JDBCFeatureSource.java:508)/

Ok so I go ahead and enter the bounding box manually and and I am able to
publish the layer. However,
now when I preview the layer it is blank and when I click in the map area I
get the following:

/Internal error occurred java.io.IOException null A .NET Framework error
occurred during execution of user-defined routine or aggregate "geometry":
System.ArgumentException: 24144: This operation cannot be completed because
the instance is not valid. Use MakeValid to convert the instance to a valid
instance. Note that MakeValid may cause the points of a geometry instance to
shift slightly. System.ArgumentException: at
Microsoft.SqlServer.Types.SqlGeometry.ThrowIfInvalid() at
Microsoft.SqlServer.Types.SqlGeometry.STIntersects(SqlGeometry other) at
Microsoft.SqlServer.Types.SqlGeometry.Filter(SqlGeometry other) . /

Apparently this was a problem back in 2010 with version 2.0.2. I am running
version 2.3.2. on windows server 2008 R2 and SQL Server 2008 R2 I don't want
to post a JIRA bug report, because I'm to new of a user to tell if it is a
bug or something I'm doing wrong.

Thanks,
Mark

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/SQL-Server-Problem-tp5060024.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Mark,

First,
as error log says, you have to check and validate [MakeValid()] your spatial
objects in SQL server database. This is related to topology (for example its
not allowed to have two vertex with the same coordinate in line or polyline
object etc.etc...). I dont know which method you have used to upload data
via shapefile but some methods, like uploading through some GIS software
(MapInfo), automatically execute MakeValid() function.

Second,
all spatial objects in your SQL server table MUST HAVE a valid SRID if you
want to publish them in GeoServer. Also on the other side (in GeoServer) you
have to set the same coordinate system (SRID).

So, execute MakeValid() and set SRID for all objects in SQL server table.
Dont forget that you will have that SRID defined also in GeoServer.

After this, you will be able to populate bounding box fields and see objects
in preview.

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/SQL-Server-Problem-tp5060024p5060360.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

Ok, I jumped through a lot of hoops to get this working. The original shape
file that I downloaded works fine in GeoServer so I figured it was ok. I
then converted the shape using ESRI's Data Interoperability Module (FME) and
got the original error. So then I tired the free web app that converts from
shape to SQL Server and still the same problem. Next step, I went and
downloaded a free trial of FME and used that and it worked with the
following log entry:

/MS SQL Server (Spatial) Writer: Invalid Bounding Box values for Auto
Spatial Index for feature type 'tl_2011_us_county'. XMax must be greater
than XMin and YMax must be greater than YMin. Change the Spatial Index Type
or Bounding Box values in the Format Parameters tab (of the writer feature
type)/

Tried to run make valid, but was unable to do so. What I fnally got to work
was the ESRI check geometry and the use the Data Interoperability to convert
to SQL Server.

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/SQL-Server-Problem-tp5060024p5060611.html
Sent from the GeoServer - User mailing list archive at Nabble.com.