orbisgis / geoclimate

Geospatial processing toolbox for environmental and climate studies
GNU Lesser General Public License v3.0
59 stars 16 forks source link

Improper .prj from BD_TOPO_V2.2 #763

Closed MGousseff closed 2 years ago

MGousseff commented 2 years ago

The BD_TOPO V2 files one can download here : https://files.opendatarchives.fr/professionnels.ign.fr/bdtopo/BDTOPO_2-2_2018-09/ have improper .prj files. You need to ad an SRID by hand or you will get tthe error : rg.orbisgis.data.jdbc.JdbcDataSource - Cannot link the file COMMUNE.SHP. Once you modify all the .prj of your data, Geoclimate will work OK. It seems the way the prj are parsed needs to be modified (in H2GIS ?).

ebocher commented 2 years ago

This issue is related to H2GIS. H2GIS is not able to find any srid value because the prj files provided don't contain any EPSG code. Proposal to solve this issue

If the srid is equals to zero then stop the workflow and print a message to the user Offer a way to set the input srid in the input parameters. The input srid will be set to the input geometries and the workflow go to green Note : if the user set a bad srid, we have a bad user

ebocher commented 2 years ago

Following @simogeo #755 we can have

"input": {
        "folder": {
            "path": "C:\\mydirectory\\Geoclimate\\BD_TOPO_v2"
        },
       "locations":["Redon"],
       "srid" : 2154
}
ebocher commented 2 years ago

After some considerations, I propose the following changes.

To set a folder as input source

"input": {
        "folder":  "C:\\mydirectory\\Geoclimate\\BD_TOPO_v2",
       "locations":["Redon"],
       "srid" : 2154 //not required
}

To set a database as input source

"input": {
        "database": {
                        "user":user,
                        "password": password,
                        "url": url,
                        "tables": {"commune":"ign_bdtopo_2018.commune",
                                   "bati_indifferencie":"ign_bdtopo_2018.bati_indifferencie",
                                   "bati_industriel":"ign_bdtopo_2018.bati_industriel",
                                   "bati_remarquable":"ign_bdtopo_2018.bati_remarquable",
                                   "route":"ign_bdtopo_2018.route",
                                   "troncon_voie_ferree":"ign_bdtopo_2018.troncon_voie_ferree",
                                   "surface_eau":"ign_bdtopo_2018.surface_eau",
                                   "zone_vegetation":"ign_bdtopo_2018.zone_vegetation",
                                   "terrain_sport":"ign_bdtopo_2018.terrain_sport",
                                   "construction_surfacique":"ign_bdtopo_2018.construction_surfacique",
                                   "surface_route":"ign_bdtopo_2018.surface_route",
                                   "surface_activite":"ign_bdtopo_2018.surface_activite",
                                   "piste_aerodrome":"ign_bdtopo_2018.piste_aerodrome"}
                }}
       "locations":["Redon"],
       "srid" : 2154 //not required
}
"input": {
        "database": {
                        "user":user,
                        "password": password,
                        "url": url
                }}
       "locations":["Redon"],
       "srid" : 2154 //not required
}

if any tables are specified the workflow looks into the public schema

"input": {
        "database": {
                        "user":user,
                        "password": password,
                        "url": url
                        "schema" : "bdtopo_2018"
                }}
       "locations":["Redon"],
       "srid" : 2154 //not required
}

We can also check the tables in a specified schema

Note : The user must choose between a connection to a database or a folder. Both are not allowed

sfaraut commented 2 years ago

+1 This proposal make sense for folder source (relative to #755) and dealing with srid not defined by proj file containing EPSG code definition (i.e. AUTHORITY["EPSG","2154"]), problem described in #617, and personally shared before. This can fix easily problems with direct downloaded IGN data (or surely other data processed by SIG software like QGIS), when we are sure of their data projection but srid not present in exported .prj file.

ebocher commented 2 years ago

Fixed