I have a really strange problem which I don't know how to solve.
I have shp file I've import into PostGIS using PostGIS Loader (made sure the srs is 4326 same is shp file) .
In geoserver (2.6.1) I've created a postgres store and published the table I've imported , set it SRS (WGS84) and style (default Polygon).
Now this is where things go weird and I have no idea how to approach this problem:
-
If I Preview the layer via WFS (KML/GeoJson/CSV etc…) I get the txt files with all features inside.
-
If I try to preview via openlayers or any other WMS (like geotiff) either I see empty map or get error
-
When I create a store of shp files with the data I've imported , it shows fine as wms.
Here is example that I do see features via wfs (csv) but error in wms.
Any idea ?!
EDIT 1:
It was pointed out in comments that "width=78450&height=330" is a strange size (although this is what geoserver auto generate in preview) so I've manually edited the request to :
http://localhost:8080/geoserver/Oakland/wms?service=WMS&version=1.1.0&request=GetMap&layers=Oakland:oakland180110&styles=&bbox=-122.502975463867,37.3532028198242,-121.66429901123,37.9185791015625&width=512&height=345&srs=EPSG:4326&format=image/png
and now I get empty image:
Since I do see the data in the shp files preview :
http://localhost:8080/geoserver/Oakland/wms?service=WMS&version=1.1.0&request=GetMap&layers=Oakland:Oakland180110&styles=&bbox=-122.491314021,37.379831195000065,-121.71847960399995,37.89508712800005&width=512&height=341&srs=EPSG:4326&format=image%2Fpng
I tend to think that the problem is somewhere from reading the data from PostGIS.
Last thing I did is comparing the shp layer settings to the postgis layer settings but I don't see anything that might hint on the problem I have:
Update 2:
I've checked geoserver log and noticed that the following query returns null:
SELECT encode(ST_AsBinary(ST_Simplify(ST_Force_2D("the_geom"), 0.002246433788820923)),'base64') as "the_geom" FROM datatable
Now , the_geom column is geometry type and is not null .
When running ST_Simplify it brings back null :
This is working :
SELECT ST_Force_2D("the_geom") as "the_geom" FROM "public"."datatable"
This brings the nulls :
SELECT ST_Simplify(ST_Force_2D("the_geom"), 0.002246433788820923) as "the_geom" FROM "public"."datatable"
Any idea why ?
Best Answer
The solution to this is to remove the checkbox from the store definition :