且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Geoserver-连接到SQL Server 2008 Express并获取数据

更新时间:2023-02-02 11:05:36

对于遇到相同问题的人:

For those who encounter the same issue:

我找到了它不起作用的原因. "Native-SRC"未正确设置自身(实际上我根本没有任何价值).这实际上是我什么都看不到的主要原因.现在,没有任何理由(或奇迹),在删除所有内容并重新创建所有内容之后,我现在有了一个本机SRC值,并且所有内容均按预期显示.

I found the reason why it was not working. The "Native-SRC" was not setting itself properly (in fact I had no value at all). This is actually the main reason why I wasn't able to see anything. Now for no good reason (or miracle), after removing everything and re-creating everything, I now have a Native SRC value and everything shows up as expected.

实际上,当我将数据库添加到GeoServer时,表的设置是EPSG:0(几何图形的默认值).但是您需要通过执行以下更新将EPSG切换到4326:

In fact the database when I added it to the GeoServer, the tables were setted with EPSG:0 (default for geometry). But you need to switch the EPSG to 4326 by doing an update like this:

update MyTable set MyGeom = geometry::...FromText(MyGeom.STAsText(), 4326)

之后,删除GeoServer中对表的所有引用.实际上,您需要从头开始重新创建所有内容.并且当您将数据库与表重新添加时,它将起作用.实际上,您将看到"Native-SRC"是由其自身设置的,也可以单击表的BBOX的自动设置. (最小X,Y,最大X,Y)

After, remove all the reference in GeoServer to your table. You actually need to recreate everything from scratch. And when you will re-add your database with your table, it will work. In fact, you will see the "Native-SRC" to be set by itself, and you can also click on the autoset the BBOX of your table. (Min X, Y, Max X, Y)