In MS SQL, you can set the SRID with something along the lines of UPDATE 
MyTable SET geom.STSrid = 4326 (or whatever your SRID is).

If you have already published the layer in Geoserver, you will likely want to 
delete and republish it to make sure it picks up the SRID correctly.

Alternatively, I believe you should be able to set a Declared SRS when 
publishing the layer and set "Force Declared" as the SRS handling.  But getting 
the SRID into the geometry in the database would seem like your best move to me.

Matt

________________________________
From: Russ Hore <r...@russ-hore.co.uk>
Sent: Thursday, June 20, 2024 7:35 AM
To: Cristian Apostol <a.cristi231...@gmail.com>
Cc: geoserver-users@lists.sourceforge.net 
<geoserver-users@lists.sourceforge.net>
Subject: Re: [Geoserver-users] Layer preview error

You can update the Geom column to set an SRID.

Under Postgis it is ST_SetSRID(Geom,srid). Not sure about SQLServer

Russ

> On 20 Jun 2024, at 11:15, Cristian Apostol <a.cristi231...@gmail.com> wrote:
>
> Hello,
>
> I have a layer that is coming from a SQL Server Database, the database has 
> been linked to GeoServer and I can import all the layers from database in my 
> GeoServer.
>
> When I publish a layer and I'm trying to preview it, i receive the error 
> message that is displayed in the image (geoserver1.png).
>
> I made some research and I came to conclusion that the GeoServer is not able 
> to display my layer because the layers doesn't have the SRID (projection 
> defined) inside of the SQL Server Database. I will attach an image of the 
> records that of the layer (sql_data.png).
>
> Is there a solution to this problem?
>
>
> <geoserver1.PNG><sql_data.PNG>_______________________________________________
> Geoserver-users mailing list
>
> Please make sure you read the following two resources before posting to this 
> list:
> - Earning your support instead of buying it, but Ian Turton: 
> http://www.ianturton.com/talks/foss4g.html#/
> - The GeoServer user list posting guidelines: 
> http://geoserver.org/comm/userlist-guidelines.html
>
> If you want to request a feature or an improvement, also see this: 
> https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer
>
>
> Geoserver-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geoserver-users



_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to