Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add layer wrong proj transformation #660

Open
1 task
tudorbarascu opened this issue Sep 12, 2024 · 10 comments
Open
1 task

Add layer wrong proj transformation #660

tudorbarascu opened this issue Sep 12, 2024 · 10 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@tudorbarascu
Copy link
Contributor

Checklist

  • I've searched through the existing issues and this bug has never been reported before

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

  • g3w-admin: v3.8.1
  • g3w-client: 3.10.2
    • qtimeseries: 3.8.0
  • browser: Firefox 129.0
  • operating system: Linux 64-bit

Link to your project

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

Additional info

No response

@tudorbarascu tudorbarascu added the bug Something isn't working label Sep 12, 2024
@tudorbarascu
Copy link
Contributor Author

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
Copy link
Member

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
Copy link
Contributor Author

tudorbarascu commented Sep 12, 2024

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
Copy link
Member

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
Copy link
Member

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

@volterra79
Copy link
Member

volterra79 commented Sep 13, 2024

@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 volterra79 added this to the v3.10 milestone Sep 13, 2024
@volterra79
Copy link
Member

volterra79 commented Sep 13, 2024

@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
Copy link
Member

volterra79 commented Sep 16, 2024

@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
Copy link
Contributor Author

tudorbarascu commented Sep 16, 2024

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
Copy link
Member

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

volterra79 added a commit that referenced this issue Sep 26, 2024
…rol (#647)

* Remove duplicate added by merge

* Wrong reference due merge

* Replace d.resolve with resolve due merge

* use GUI.getService

* remove unusued stuff

* wrong context

* replace: `state.components` → `GUI.getComponent()`

* Use reactive state vue. Need to fix showPanel on sidebar

* Remove push

* use import { $promisify, promisify } from 'utils/promisify' instead $.Deferred

* use import { $promisify } from 'utils/promisify' instead $.Deferred

* use import { $promisify } from 'utils/promisify' instead $.Deferred

* use import { $promisify } from 'utils/promisify' instead $.Deferred

* use import { $promisify } from 'utils/promisify' instead $.Deferred

* use import { $promisify } from 'utils/promisify' instead $.Deferred

* use import { $promisify } from 'utils/promisify' instead $.Deferred

* use import { $promisify } from 'utils/promisify' instead $.Deferred

* Fix double get data from querybypolygon async nature of GUI.closeContent

* use $promisify instead of $.Deferred

* use $promisify instead of $.Deferred

* use $promisify instead of $.Deferred

* use $promisify instead of $.Deferred

* use $promisify instead of $.Deferred

* use $promisify instead of $.Deferred

* Comment and return $.Deferred

* 🐛 Mispelling variable name

* Clean code - space

* 🐛 Use Promise.resolve instead resolve of $promisify

* 💡 Comments

* 💡 Comments

* Clean code - Comments and readability

* Clean code - readability

* 🐛 call panel show twice. Remove panel.show(). It is called automatically due opts.show = true

* Return panel if usefully

* Clean code - readability

* Clean code - readability

* Clean code - readability

* Clean code - readability

* Clean code - readability

* Clean code - readability

* Clean code - readability

* Clean code - readability

* Clean code - readability

* Clean code - readability

* Clean code - readability

* Replace $.get with XHR.get

* 🐛 Pass config and opts to TableLayer parent class

* Clean code - Readability

* Clean code - Readability

* add check on querybycircle onselectLayer event

* Remove config.js. Move content on APP_CONFIG constant

* Clean code - Readability

* Remove action button class

* Clean code - Readability

* 💄 Change style

* use inludes instead indexOf

* Clean code - Readability

* Replace -1 == indexOf with .includes

* Clean code - spaces

* Clean code - spaces

* Clean code - spaces

* Clean code - spaces and replace with includes

* 🐛 spite.state.slip. Wrong refactoring

* 🐛 Wrong refactoring. Need to create getDefaultExpression and getFilterExpression utils

* Comments

* Fix an isse on .clear collection

* Move code in one place

* Fix in case of missing source map file

* 🐛 add immediate attribute to watch otherwise for v-select2 createSelect2 it called twice at creation

* Bind multiple boolean value

* Add forec options to delete plugin.js.map source map file

* 🐛 Fix wrong variable name

* Clean code - Change variable name

* race condition: `GUI.closeContent()`

* shorter function names

* avoid `new promise()` + remove dead code

* avoid `new Promise()`

* ✨ Add text on input form fields that belong to a relation

* remove dead code

* move `getTimeoutPromise()` into providers factory

* Remove duplicate method closeLayerMenu

* 🐛 Move this.last_map_control = on mounted hook. Move from created beacause when open attribute table twice without close content, new create hook method is called befoare beforeDestroy hook of previous Table.vue component

* 🌐 Change translation

* Move below input label

* remove unused utils

* explicit `promise.race` (promise with timeout)

* 🐛 Fix bind reference

* code cleanup

* remove abstract class: `BaseService`

* 🐛 Back to name query beacause it used by project querymultilayers attribute

* Use querybypolygon fro alla querybypolygon','querybydrawpolygon', 'querybycircle' query control to check if isQueryMultiLayer

* Fix parser application/vnd.ogc.gml fro multilayer

* Simplify code

* css

* move `currentoutputplaces` into GUI

* refactor multilayers logic

* move `getQueryLayersPromisesByCoordinates` into data service

* restore `excludeSelected` param

* remove class: `RelationsService`

* ♻️ parser application/vnd.ogc.gml

* add `persistent` option

* convert `<layerspositions>` into a plain `<select>` within `MapAddLayer.vue`

* 🐛 Fix single query for layers

* Uniform getQueryLayersPromisesByGeometry and getQueryLayersPromisesByCoordinates with same resposte handler

* remove `search_endpoint`

* avoid `new Promise`

* simplify promises

* jsdoc

* simplify `GUI.outputDataPlace`

* Refactor application/vnd.ogc.gml parser

* 🐛 check if features have geometries

* remove constant: `APP_CONFIG`

* Set right features fid for multi layer wms response

* remove `Filter` and `Expression` classes

* console.trace

* ♻️ getGeometryAndExtentFromFeatures method

* highLightLayerFeatures also when result layer has one feature

* Clean code - Readability

* 🐛 Missing await

* Add comment

* 🐛 Fix loading query result content when multi request are done

* slim down class: `ApplicationService`

* unusued imports

* Clean code

* remove browser prefix

* fix page flash

* Add loading type String to bar-loader

* BACKOMP: `ApplicationService.isIframe()`

* remove: `ProjectsRegistry.init(initConfig)` and `ApiService.init(initConfig)`

* remove class: `BarStack`

* remove unusued css

* console.trace

* remove unusued css

* refactor `MetadataProject.vue`

* Update index.prod.js

* slim down class: `ProjectsRegistry`

* extract files from `src/app/core` folder

* remove unusued utils

* missing service

* remove `g3wsdk.core.layer.geometry`

* remove unusued utils

* convert `$.ajax`  requests to `fetch` API

* simplify code

* simplify code

* remove class: `ProjectsRegistry`

* slim down: `createMeasureTooltip`

* convert to ES6 exports

* 🐛 Fix XHR.get using fetch. Use params for streetview call api

* Add console.warn

* Remove $.fileDownload from fileDownload suing fetch

* Simplify fileDownload

* Simplify fileDownload

* #660 (comment)

* Merge #658

* Remove merge file

* remove `jquery.fileDownload.js`

* try .. finally

* Merge fix

* Mispelling merge options

* Space

* remove `console.warn`

* slim down `FeaturesStore`

* native promise

* invalid variable name

* missing id

* console.log

* remove `g3wsdk.core.geoutils.getFeaturesFromResponseVectorApi`

* Rempce lodash dependency

* Replace _.trim() lodash dependency with trim()

* remove: `utils/splitFeatures.js`

* Update splitFeature.js

* Delete splitGeometryLine.js

* Update createRelationsUrl.js

* delete `isSameBaseGeometryType.js`

* remove utils: `getAllPolygonGeometryTypes`, `getAllPointGeometryTypes`,  `getAllLineGeometryTypes`

* backcomp

* remove: 'utils/dissolve.js'

* Update distance.js

* Update sanitizeFidFeature.js

* move `QgsFilterToken` into `Layer` class

* Comment

* Need to add null check beacuse we substitute _.trim() with trim()

* Need to add null check because we substitute _.trim() with trim()

* remove: `utils/validators/index.js`

* remove: `utils/getMetersFromDegrees.js`

* remove: `multiGeometryToSingleGeometries`,  `singleGeometriesToMultiGeometry`

* 🐛 select2 dropdownParent:$('.g3w-search-form:visible')

* 🐛 Create gey map print area only if the template is not atlas and has at least one maps

* remove `utils/print`

* ✨ Show loading content during load image or pdf

* remove `utils/isSingleGeometry.js`

* remove `capitalize_first_letter`

* slim down: `store/catalog-layers` and `store/plugins`

* same as: 6d0c94e

* Remove merge file

* space

* 💄 css tool and sidebar-item icon space

* Comment

* Clean code - simplify

* ✨ Add Application.gui.sidebar.open attribute to show tooltip when sidebar is collapsed

* 💄 show arrow up or arrow down when map theme is open or closed

* 🐛 using feature variable for ol feature and feature

* 💄 change button toggled color and background

* Remove merge wrong empty files

* 💄 Show sidebar item tooltip when sidebar is collapsed

* move: `src/assets/style/less/app.less` into `src/assets/app.css`

* Delete app.less

* wrong merge

* move v-tooltip to parent container

* Show tooltip on sidebar item only when sidebar is collapsed

* Remove skin color to v-t-tooltip

* Dynamic tooltip on tool

* update css

* useful: `:current-tooltip`

* 🐛 In case of layer title with strange character, fix show title on context

* left align map control tooltips

* 🐛 Hide tooltip when current-tooltip is null or empty

* 🐛 :Bug: Show error message in case of error when zoom to layer. It can happen if strange bbox is set by server to layer

* remove `ApiService`

* Clena code - space and console.log removed

* 🐛 Change layer position

* 🐛 emit event change position instead change position pros directly

* remove `directives/v-selected-first.js`

* remove `directives/v-plugins.js`

* remove `directives/v-online.js`

* simplify `v-disabled`

* 🐛 return state

* Clean code - spaces

* Clean code - spaces

* Clean code - readability

* 🐛 Shor layers result sort by TOC layers order

* 🐛 Missing ARCGISMAPSERVER base layer

* remove `v-t-placeholder`

---------

Co-authored-by: Raruto <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants