g3w-suite / g3w-client

Map viewer addon for G3W-SUITE
https://g3w-suite.readthedocs.io/en/latest/g3wsuite_client.html
Mozilla Public License 2.0
21 stars 17 forks source link

Add layer wrong proj transformation #660

Open tudorbarascu opened 2 months ago

tudorbarascu commented 2 months ago

Checklist

Subject of the issue

I have a map in EPSG:3844 at https://workshop.qcooperative.net/map/testadd/ that has a Point at position 400 000, 400 000

I also have a zipped shapefile called bad_boy.zip in the same projection that I'm uploading for test in the client using the Add layer tool. When you add the new layer in the client, the points should be overlayed but there's a different transform and the points are far away exactly like in this picture!

image

I've attached the QGIS project + the zipped shapefile.

add_layer_problem.zip

Steps to reproduce

  1. Go to a 3844 project
  2. Add a Shapefile using the Client Add Layer tool
  3. Your geometries are shown in other place

Environment

Link to your project

https://workshop.qcooperative.net/map/testadd/

Additional info

No response

tudorbarascu commented 2 months ago

I also have this defined for in the settings so that geolocation works

G3W_PROJ4_EPSG = {
  3844: {
    "proj4": "+proj=sterea +lat_0=46 +lat_ts=46 +lon_0=25 +k=0.99975 +x_0=500000 +y_0=500000 +ellps=krass towgs84=2.3287,-147.0425,-92.0802,-0.3092483,0.32482185,0.49729934,5.68906266 +units=m +axis=neu +no_defs",
    "extent": [0,0,8388608,8388608]
  }
}
volterra79 commented 2 months ago

I also have this defined for in the settings so that geolocation works

G3W_PROJ4_EPSG = {
  3844: {
    "proj4": "+proj=sterea +lat_0=46 +lat_ts=46 +lon_0=25 +k=0.99975 +x_0=500000 +y_0=500000 +ellps=krass towgs84=2.3287,-147.0425,-92.0802,-0.3092483,0.32482185,0.49729934,5.68906266 +units=m +axis=neu +no_defs",
    "extent": [0,0,8388608,8388608]
  }
}

@tudorbarascu with this EPSG definite in setting works?

tudorbarascu commented 2 months ago

I also have this defined for in the settings so that geolocation works

G3W_PROJ4_EPSG = {
  3844: {
    "proj4": "+proj=sterea +lat_0=46 +lat_ts=46 +lon_0=25 +k=0.99975 +x_0=500000 +y_0=500000 +ellps=krass towgs84=2.3287,-147.0425,-92.0802,-0.3092483,0.32482185,0.49729934,5.68906266 +units=m +axis=neu +no_defs",
    "extent": [0,0,8388608,8388608]
  }
}

@tudorbarascu with this EPSG definite in setting works?

Nope, but this is the setting that I have in settings_docker.py so that Geolocation works good (if I don't have that then it puts me around 30-100 meters in other place). So it's the only custom thing that I have. Other than that, it's a base install.

volterra79 commented 2 months ago

I also have this defined for in the settings so that geolocation works

G3W_PROJ4_EPSG = {
  3844: {
    "proj4": "+proj=sterea +lat_0=46 +lat_ts=46 +lon_0=25 +k=0.99975 +x_0=500000 +y_0=500000 +ellps=krass towgs84=2.3287,-147.0425,-92.0802,-0.3092483,0.32482185,0.49729934,5.68906266 +units=m +axis=neu +no_defs",
    "extent": [0,0,8388608,8388608]
  }
}

@tudorbarascu with this EPSG definite in setting works?

Nope, but this is the setting that I have in settings_docker.py so that Geolocation works good (if I don't have that then it puts me around 30-100 meters in other place). So it's the only custom thing that I have. Other than that, it's a base install. @tudorbarascu ok. Let me check and i let you know.

volterra79 commented 2 months ago

@tudorbarascu it seems a issue in transform coordinate from EPSG:4326 to EPSG:3844. I need to investigate in deep.

volterra79 commented 2 months ago

@tudorbarascu a question. How did you create bad_boy.zip file? Thanks P.S

Using QGIS projection definition:

 3844: {
        "proj4": "+proj=sterea +lat_0=46 +lon_0=25 +k=0.99975 +x_0=500000 +y_0=500000 +ellps=krass +units=m +no_defs",
        "extent": [20.26, 43.44, 31.41, 48.27]
    }

it works, but we have a problem with base layer overlapping

volterra79 commented 2 months ago

@tudorbarascu i load your project on:

QGIS 3.16.16-Hannover

Screenshot from 2024-09-13 15-10-42

QGIS 3.34.4-Prizren

Screenshot from 2024-09-13 15-13-52

volterra79 commented 2 months ago

@tudorbarascu i found a way load shp to G3W-SUITE. The issue i related to .prj of shape file.

Follow https://openlayers.org/en/latest/examples/reprojection-by-code.html OL example, i found the right WKT for OL for .prj.

https://api.maptiler.com/coordinates/search/3844.json?exports=true&key=get_your_own_D6rA4zTHduk6KOKTXzGB

{
    "proj4": "+proj=sterea +lat_0=46 +lon_0=25 +k=0.99975 +x_0=500000 +y_0=500000 +ellps=krass +towgs84=2.329,-147.042,-92.08,0.309,-0.325,-0.497,5.69 +units=m +no_defs +type=crs",
    "wkt": "PROJCS[\"Pulkovo 1942(58) / Stereo70\",GEOGCS[\"Pulkovo 1942(58)\",DATUM[\"Pulkovo_1942_58\",SPHEROID[\"Krassowsky 1940\",6378245,298.3],TOWGS84[2.329,-147.042,-92.08,0.309,-0.325,-0.497,5.69]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4179\"]],PROJECTION[\"Oblique_Stereographic\"],PARAMETER[\"latitude_of_origin\",46],PARAMETER[\"central_meridian\",25],PARAMETER[\"scale_factor\",0.99975],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",500000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AUTHORITY[\"EPSG\",\"3844\"]]"
}

Steps:

  1. Unzip bad_boy.zip
  2. Open bad_boy.prj
  3. Replace content with PROJCS["Pulkovo 1942(58) / Stereo70",GEOGCS["Pulkovo 1942(58)",DATUM["Pulkovo_1942_58",SPHEROID["Krassowsky 1940",6378245,298.3],TOWGS84[2.329,-147.042,-92.08,0.309,-0.325,-0.497,5.69]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4179"]],PROJECTION["Oblique_Stereographic"],PARAMETER["latitude_of_origin",46],PARAMETER["central_meridian",25],PARAMETER["scale_factor",0.99975],PARAMETER["false_easting",500000],PARAMETER["false_northing",500000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","3844"]]
  4. Zip files
  5. Load bad_boay.zip to G3W-SUITE
tudorbarascu commented 2 months ago

Thank you for investigating! This is a manual workaround not working for normal users. But why do I choose the EPSG of the layer when uploading when it takes it from the shapefile?

volterra79 commented 2 months ago

Thank you for investigating! This is a manual workaround not working for normal users. But why do I choose the EPSG of the layer when uploading when it takes it from the shapefile?

@tudorbarascu we need to change it . Maybe in the new release we remove the selection when user upload shapefile