Hi Mark, hi list

I think I found a solution, which works for me, which I want to share.
I checked that GeoServer per default does not use the wanted SRS
definition for the EPSG code of my source SRS (EPSG:31468). This is OK,
since there are several definitions for this SRS. Overwriting the SRS
with the wanted parameters (as described here [1]) did not bring any
effect. The overwritten SRS definition was shown in GeoServer UI, but
the transformation returned still the old (unwanted) values. I verified
the transformation with the reprojection console of GeoServer [2], which
is very useful.
After a while I discovered that the "coordinate operations" in the
transformation process (can be shown in the reprojection console as
well) still use the old parameters. So I decided to overwrite the
"coordinate operations" as documented here [3].

So in m special case I had to change the TOWGS84 parameters for
EPSG:31468. As stated above it was necessary to set these TOWGS84
parameters within a custom "coordinate operations". To do this I added a
file epsg_operations.properties to geoserver_data/user_projections with
the following content (maybe useful as example):

31468,3857=CONCAT_MT[INVERSE_MT[PARAM_MT["Transverse_Mercator",\
      PARAMETER["semi_major", 6377397.155],\
      PARAMETER["semi_minor", 6356078.962818189],\
      PARAMETER["central_meridian", 12.0],\
      PARAMETER["latitude_of_origin", 0.0],\
      PARAMETER["scale_factor", 1.0],\
      PARAMETER["false_easting", 4500000.0],\
      PARAMETER["false_northing", 0.0]]],\
  PARAM_MT["Ellipsoid_To_Geocentric",\
    PARAMETER["dim", 2],\
    PARAMETER["semi_major", 6377397.155],\
    PARAMETER["semi_minor", 6356078.962818189]],\
  PARAM_MT["Position Vector transformation (geog2D domain)",\
    PARAMETER["dx", 598.1],\
    PARAMETER["dy", 73.7],\
    PARAMETER["dz", 418.2],\
    PARAMETER["ex", 0.202],\
    PARAMETER["ey", 0.045],\
    PARAMETER["ez", -2.455],\
    PARAMETER["ppm", 6.7]],\
  PARAM_MT["Geocentric_To_Ellipsoid",\
    PARAMETER["dim", 2],\
    PARAMETER["semi_major", 6378137.0],\
    PARAMETER["semi_minor", 6356752.314245179]],\
  PARAM_MT["Popular Visualisation Pseudo Mercator",\
    PARAMETER["semi_major", 6378137.0],\
    PARAMETER["semi_minor", 6378137.0],\
    PARAMETER["latitude_of_origin", 0.0],\
    PARAMETER["central_meridian", 0.0],\
    PARAMETER["scale_factor", 1.0],\
    PARAMETER["false_easting", 0.0],\
    PARAMETER["false_northing", 0.0]]]

[1]
https://docs.geoserver.org/stable/en/user/configuration/crshandling/customcrs.html#override-an-official-epsg-code
[2]
https://docs.geoserver.org/stable/en/user/configuration/demos/index.html#demos-reprojectionconsole
[3]
https://docs.geoserver.org/stable/en/user/configuration/crshandling/coordtransforms.html#coordinate-operations

Cheers
Chris

On 01.02.21 08:38, Christian Mayer wrote:
> Hi Mark,
>
> thanks for your answer and the hints with the NTv2. I'll give it a try
> and report back here.
>
> Thanks again
> Chris
>
> On 29.01.21 17:19, Mark Prins wrote:
>> On 29-01-2021 15:03, Christian Mayer wrote:
>>> Hi list,
>>>
>>> I have the following setup: A geometry table in a PostGIS DB with points
>>> having the projection EPSG:31468 [1]. I am publishing the points as WFS
>>> FeatureType and query them in EPSG:3857 [2] by setting srsName=EPSG:3857
>>> in the WFS GetFeature request. The returned WFS points have a coordinate
>>> shift (1-2 meters) compared to the points transformed directly in
>>> PostGIS or with GDAL.
>>>
>>> Here is an example:
>>>
>>> Native point in EPSG:31468 --> 4355155.403, 5512583.018
>>>
>>> Transformed point with GDAL or ST_Transform of PostGIS    -->
>>> 1112006.22028666, 6400063.79411048
>>>
>>> Transformed point as output of the GeoServer WFS request -->
>>> 1112005.8998, 6400065.9514
>>>
>>> Has anyone an idea what is going wrong here? 
>> There appear to be several well known transformation methods available
>> listed at http://epsg.io/31468, GeoServer may be using a less accurate
>> version than other products by default.
>>
>>> Do the SRS definitions in
>>> GeoServer differ from those in PostGIS or GDAL? 
>> debug logging may show which transformation method is used, it's not
>> my expertise but it looks like NTv2 should be used to get results
>> within 1m accuracy, so you may need to add a Grid Shift file to get
>> better results
>>
>> see also:
>> https://docs.geoserver.org/stable/en/user/configuration/crshandling/coordtransforms.html
>>
>> -M
>>
>>
>> _______________________________________________
>> 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
>>
>>
>>
>> [email protected]
>> 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
>
>
> [email protected]
> 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


[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to