georchestra / mapstore2-georchestra

geOrchestra newest viewer
Other
6 stars 23 forks source link

GeoJSON file created in QGIS not accepted for import #443

Open severinmenard opened 2 years ago

severinmenard commented 2 years ago

This GeoJSON file is rejected, though it was simply created in QGIS OSM data downloaded with QuickOSM and saved as a GeoJSON file with the default options. Conakry_banques.zip

Gaetanbrl commented 2 years ago

@severinmenard works fine with this dataset if you export geojson as GeometryCollection geom types.

image

Gaetanbrl commented 2 years ago

@severinmenard issue to close ?

jusabatier commented 1 year ago

Just tried to export this data via QGIS : https://cloud.lepuyenvelay.fr/index.php/s/GmcmfBmeWaRrtoA

exactly as you did :

image Notice : the wrning for SRS is because I transform from 2154 to 4326 and there is a loss of precision.

But it doesn't work :

image

Version de QGis : 3.22.4

Gaetanbrl commented 1 year ago

@jusabatier could you share the localConfig section for this plugin please ?

See https://mapstore.geosolutionsgroup.com/mapstore/docs/api/plugins#plugins.MapImport

(=> I'm not sur but GeoJSON seems activate by default)

jusabatier commented 1 year ago

I have no specific configuration, just the "MapImport".

Gaetanbrl commented 1 year ago

Toolip display something like "Out of limit" when i import your GeoJSON.

After reproject GeoJSON in 3857, @jusabatier it works

Gaetanbrl commented 1 year ago

@tdipisa nothing in the doc talk about "no reprojection available" or something like "default pojection to use is 3857 or 4326" :

https://docs.mapstore.geosolutionsgroup.com/en/latest/user-guide/import/

jusabatier commented 1 year ago

I just tried to export it as 3857, but it still not work : https://cloud.lepuyenvelay.fr/index.php/s/EiDjJmXMnppsKDR

Gaetanbrl commented 1 year ago

Ok, i test locally, so diff version...

image

Gaetanbrl commented 1 year ago

Ok @jusabatier my bad, my geojson was in 4326 and works here :

https://geoportail.lepuyenvelay.fr/mapstore/#/

image

image

jusabatier commented 1 year ago

Did you export it from QGis ? Because when I export it as GeometryCollection and 4326, it still not work ...

Gaetanbrl commented 1 year ago

yes from Qgis. See param and here i don't use specific params.

image

jusabatier commented 1 year ago

It still not work :

image

https://cloud.lepuyenvelay.fr/index.php/s/TsYR6mTxSrnGzec

I tested all possibility, 2154 / 3857 / 4326 with Automatic and GeometryCollection but nothing work

Gaetanbrl commented 1 year ago

A little analyse to understand because it's weird :

  1. On import, MapStore will detect if we import layer or map, and will check extent validity

https://github.com/geosolutions-it/MapStore2/blob/master/web/client/components/import/dragZone/enhancers/useFiles.js#L42

  1. Next The test will be :

https://github.com/geosolutions-it/MapStore2/blob/master/web/client/utils/CoordinatesUtils.js#L1069

If i use 4326 layer it works well with 3857 BBOX because 4326 BBOX values are lower than 3857 bbox values...

==== Example 1

with @jusabatier original 2154 layer

image

Will return False : return minx >= crsMinX && minY >= crsMinY && maxX <= crsMaxX && maxY <= crsMaxY;

== Example 2 - not better

with 3857 data

image

Gaetanbrl commented 1 year ago

Here, 3857 and 4326 seems suported but 3857 seems not detect as valid by the importer :

https://github.com/geosolutions-it/MapStore2/blob/fb3cafc486c2e03e093a957ccd891c4fe50b7bad/web/client/components/import/dragZone/enhancers/processFiles.jsx#L67-L68

Next, on import, the original file contain the correct CRS :

image

Later, MapStore will transform GeoJSON here :

https://github.com/geosolutions-it/MapStore2/blob/fb3cafc486c2e03e093a957ccd891c4fe50b7bad/web/client/components/import/dragZone/enhancers/processFiles.jsx#L151

... but harcode 4326 CRS here even if features have 3857 or 2157 CRS :

https://github.com/geosolutions-it/MapStore2/blob/ded5b4bf431187b0d32ccc8a87e7551a1609cf5b/web/client/utils/LayersUtils.js#L515-L522

... :/

severinmenard commented 1 year ago

No tag, update, or planed fix for this issue, @GeoSolutions?

landryb commented 1 year ago

hardcoding the CRS is gross, it should be taken (if available) from crs.properties.name and also translated from its urn: form.. i guess there's probably already a nodejs library handling such things, like https://www.npmjs.com/package/proj4

Gaetanbrl commented 7 months ago

Up with this geosolution topic (mail) :

https://groups.google.com/g/mapstore-developers/c/ZzBjY4zZ_F0