MapStore2 icon indicating copy to clipboard operation
MapStore2 copied to clipboard

MapStore doesn't normalize longitude when editing geometries

Open giohappy opened this issue 3 years ago • 12 comments

Description

MapStore repeats the world map horizontally because it's a useful feature for the visualization of global data. However, it also permits the editing of geometries outside the valid WGS84 extent (-180<lon<180 ). This raises an exception in Geoserver when the geometries are saved since they have invalid longitudes.

How to reproduce

  • open a map with an editable vector layer
  • move either to the right or to the left of the central map, beyond the DateLine (Pacific)
  • edit a feature's geometry and save
  • an error from Geoserver is returned telling that the geometry has coordinates outside the valid extent

Expected Result Coordinates outside the valid extent should be normalized

Current Result Coordinates are not normalized

giohappy avatar Apr 12 '22 08:04 giohappy

@barema4 we have added a layer that you can edit in our gs-stable geoserver version, so for just when you work on this you can remvoe the proxy configuration used and us directly the default bproxy settings (remove changes to webpack-config.js)

then you can use this layer regioni_test with this user username: barema pwd: barema

also apply this change to localConfig.json at this line https://github.com/geosolutions-it/MapStore2/blob/7a9ffc6eef02e16dd86b224fae28ced49418eb33/web/client/configs/localConfig.json#L349

with the following

{
  "name": "FeatureEditor", 
  "cfg": {
    editingAllowedRoles: ["ADMIN","USER"]
  }
}
  

because by default only ADMIN users can edit layers

NOTE: do not commit this change it's just for a local development

anyway this is the map you can search when you are logged image

MV88 avatar May 20 '22 14:05 MV88

Thanks for the update

barema4 avatar May 25 '22 07:05 barema4

@barema4 moving in blocked because it seems there are issues with GeoFence in gs-stable.

tdipisa avatar May 25 '22 12:05 tdipisa

@barema4 this layer should work now in editing developers:regioni_test. Please try.

tdipisa avatar May 25 '22 13:05 tdipisa

@tdipisa @MV88 the layer is now working.

barema4 avatar May 25 '22 14:05 barema4

With the layer present on this map en error occurs when the user select a feature on attribute table and he try to edit it.

With the layer present on this map, an error occurs when the user selects a feature in the attribute table and attempts to edit it. Errors on the console:

Error in epic "zoomToExtentEpic". Original error: t {code: 25, name: 'AssertionError', message: 'Assertion failed. See https://openlayers.org/en/v5.3.0/doc/errors/#25 for details.'} code: 25 message: "Assertion failed. See https://openlayers.org/en/v5.3.0/doc/errors/#25 for details." name: "AssertionError" [[Prototype]]: Error constructor: ƒ t(t) length: 1 name: "t" prototype: Error constructor: ƒ t(t) [[Prototype]]: Object arguments: (...) caller: (...) [[FunctionLocation]]: mapstore2.js?efa61a6…:2 [[Prototype]]: ƒ Error() [[Scopes]]: Scopes[4] [[Prototype]]: Object

TypeError: Cannot read properties of null (reading 'x') at $ (mapstore2.js?efa61a6cf6cef4edc8d5:2:39723) at Object.forward (mapstore2.js?efa61a6cf6cef4edc8d5:2:40073) at mapstore2.js?efa61a6cf6cef4edc8d5:2:3583255 at Ke (mapstore2.js?efa61a6cf6cef4edc8d5:2:3579912) at mapstore2.js?efa61a6cf6cef4edc8d5:2:3579943 at Array.map () at Ke (mapstore2.js?efa61a6cf6cef4edc8d5:2:3579919) at mapstore2.js?efa61a6cf6cef4edc8d5:2:3579943 at Array.map () at Ke (mapstore2.js?efa61a6cf6cef4edc8d5:2:3579919) at mapstore2.js?efa61a6cf6cef4edc8d5:2:3579943 at Array.map () at Ke (mapstore2.js?efa61a6cf6cef4edc8d5:2:3579919) at e.bbox.e.bbox.t (mapstore2.js?efa61a6cf6cef4edc8d5:2:3583213) at Qe (mapstore2.js?efa61a6cf6cef4edc8d5:2:3580324)

How to Reproduce See the gif below:

https://user-images.githubusercontent.com/56537133/175504109-fc7448dc-aac3-4c20-bf24-05cf63bc71b4.mov

ElenaGallo avatar Jun 24 '22 09:06 ElenaGallo

Any update on this @barema4 @MV88 @tdipisa?

giohappy avatar Jul 01 '22 10:07 giohappy

@giohappy there was a first implementation that as reported by @ElenaGallo has still some problems that have to be investigated

that's why we put this back to Ready column

MV88 avatar Jul 01 '22 11:07 MV88

@giohappy is this for a specific client? is there a specific deadline for this on your side? @MV88 @barema4, I think we need to understand at least the remaining effort we still need to close this.

tdipisa avatar Jul 22 '22 09:07 tdipisa

@tdipisa no specific client. This was discovered inside a project for a client but the fix is not a requirement for it.

giohappy avatar Jul 25 '22 08:07 giohappy

At the moment we don't have resources to employ on this to review the implementation and finalize it. I would like to prevent the risk that the current bugged implementation lands in the next major release. Therefore @MV88 it should be better to revert it from both master and 2022.02.xx.

After the revert, please remove the issue from 2022.02.00 so that I will take care to reschedule the issue as soon as possible.

tdipisa avatar Aug 08 '22 08:08 tdipisa

the commit to revert is only this one https://github.com/geosolutions-it/MapStore2/tree/cbb5a9d9eb1c621f67d309f90a288c40714ce4c9

the pr is this one https://github.com/geosolutions-it/MapStore2/pull/8512

MV88 avatar Aug 26 '22 15:08 MV88