0

I want to create parametric SQL View, which provide feature collection of my route, which bbox is in depending on entered parameters. I add some SQL Script which is returned some columns, and one of them is geometry column of type LineString with SRID 4326.

When I tried refresh atributes and check Guess geometry type and srid geometry was not set up as you can see on screen:

enter image description here

Type is still Geometry not Linestring, and SRID is -1. So my questions are:

  • Should I set this manualy to LineString? And if yes, should I set SRID of my column in database (4326) or that SRID what I need (900913).
  • Geoserver layer display this area which is covered in bbox, so if I understad, I have to set bbox of whole area, which is my route could contains? So if my data are whole planet so I need set bbox of whole planet or what ?

enter image description here

1 Answer 1

2

GeoServer "guesses" by asking the underlying database, which sometimes cannot provide a good answer, for example:

  • PostGIS without a declaration of the subtype and srid in the table
  • Oracle in most cases, as the information can be only provided as a constraint while creating the spatial index and very few people enter it

In case they are missing, it's up to you to enter the values (that's why they are editable):

  • The right type of geometry
  • The srid matching what you actually have in the table

Publishing should normally retain the native CRS, all OGC service can do reprojection on the fly.

5
  • I forgot to mention, I am using PostGIS. So I tried enter linestring of geometry and srid 900913 and when I confirm, and click calculate bbox from SRS nothing be added. Commented Mar 18, 2017 at 13:33
  • I believe GeoServer does not have noticed that a native SRS appeared. Try creating the layer from scratch again, giving it a SRID right away. Commented Mar 18, 2017 at 13:44
  • I have native SRS that what I enter during SQL View configuration to geometry column. I enter 900913 because I need that, but my data in PostGIS has 4326. Do you think is it OK? And next I click to compute bbox and nothing happened. Herese is screen where you can see I have set native srs ctrlv.cz/shots/2017/03/18/fX59.png I also tried add manualy these values: -20037508.34,-20037508.34,20037508.34,20037508.34 but from this when I tried compute lat/lon give me some wrong values 0,-1,0 and so on Commented Mar 18, 2017 at 13:50
  • 1
    No, it's not ok, you have to put the actual srid of the geometries. Commented Mar 18, 2017 at 16:23
  • Just one question, in geoserver API, how to implement this feature? I mean how to guess the SRID of the SQL View? Commented Mar 14, 2022 at 2:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.