postgresqlqgisgeoserver

GeoServer is inverting the coordinates of the geometries that I draw from QGIS


Good morning, I have a problem using GeoServer. First I explain the system that I have set up, I have a PostgreSQL database, with layers of points, lines and areas, then I have the GeoServer that connects to the database and publishes the different layers using WFS, and to finish, I have the QGis program to be able to view these layers, both the database geom fields and the geoserver layers, like qgis, I have it configured with CRS espg:4326, the problem I have is that qgis displays information that I have in the database through geoserver correctly, but when I want to draw a point, line or area, the coordinates are inverted, I need to know if from geoserver there is some way to prevent the coordinates from being rotated, since if I remove the geoserver service and I connect from qgis to the database directly, the geometries are drawn perfectly, they are not inverted at any time, therefore, it must be a geoserver problem. The version I currently have of geoserver is 2.25, placed in a docker.

I have tried to correct it by testing different geoserver configurations, also using different publication URLs with different parameters to import the layers to QGis (Example: http://localhost:8080/geoserver/insdo/wfs?version=2.0.0&outputFormat=application/json&srsName=urn:x-ogc:def:crs:EPSG:4326) and also to invert the orientation of the axes or ignore the orientation of the axes when importing the WFS into QGis.

Nothing worked, need help please!


Solution

  • This is a common problem when you use EPSG:4326 as the axis order has changed over time. You have added to the problem by using GeoJSON which mandates an fixed axis order (lon, lat) that is at odds with the current axis order of 4326.

    You don't say which version(s) of the WFS protocol you are using but reflecting the changes to axis order over time leads to different behaviour with different versions as is explained in the GeoServer manual, so I would advise you to work through that page to make sure that what you are requesting will return what you expect.