From e5de5ee83faf7515c9fba51ea20dd456d5dd07d7 Mon Sep 17 00:00:00 2001 From: Thomas André Date: Tue, 24 Jun 2025 13:48:13 +0200 Subject: Preparation V3 : First bases, majority of the code and corrections necessary --- ishtar_common/qfield/model/Context_records.gpkg | Bin 106496 -> 106496 bytes ishtar_common/qfield/model/Finds.gpkg | Bin 106496 -> 106496 bytes ishtar_common/qfield/model/Prospections.qgs | 1338 +++--- .../qfield/model/Prospections_attachments.zip | Bin 1124 -> 1124 bytes ishtar_common/qfield/specific/Context_records.gpkg | Bin 0 -> 106496 bytes ishtar_common/qfield/specific/Finds.gpkg | Bin 0 -> 106496 bytes ishtar_common/qfield/specific/Prospections.qgs | 4453 ++++++++++++++++++++ .../qfield/specific/Prospections_attachments.zip | Bin 0 -> 1124 bytes .../qfield/specific/Prospections_qfield.zip | Bin 0 -> 1103 bytes ishtar_common/qfield/specific/Sites.gpkg | Bin 0 -> 98304 bytes ishtar_common/tests.py | 91 +- ishtar_common/views_item.py | 582 ++- 12 files changed, 5782 insertions(+), 682 deletions(-) create mode 100644 ishtar_common/qfield/specific/Context_records.gpkg create mode 100644 ishtar_common/qfield/specific/Finds.gpkg create mode 100644 ishtar_common/qfield/specific/Prospections.qgs create mode 100644 ishtar_common/qfield/specific/Prospections_attachments.zip create mode 100644 ishtar_common/qfield/specific/Prospections_qfield.zip create mode 100644 ishtar_common/qfield/specific/Sites.gpkg diff --git a/ishtar_common/qfield/model/Context_records.gpkg b/ishtar_common/qfield/model/Context_records.gpkg index 9bca2656c..ceec4e94e 100644 Binary files a/ishtar_common/qfield/model/Context_records.gpkg and b/ishtar_common/qfield/model/Context_records.gpkg differ diff --git a/ishtar_common/qfield/model/Finds.gpkg b/ishtar_common/qfield/model/Finds.gpkg index 79c5e7073..bf00eb2a5 100644 Binary files a/ishtar_common/qfield/model/Finds.gpkg and b/ishtar_common/qfield/model/Finds.gpkg differ diff --git a/ishtar_common/qfield/model/Prospections.qgs b/ishtar_common/qfield/model/Prospections.qgs index 5b54d86be..cc2b18eec 100644 --- a/ishtar_common/qfield/model/Prospections.qgs +++ b/ishtar_common/qfield/model/Prospections.qgs @@ -1,5 +1,5 @@ - + @@ -30,79 +30,86 @@ false - + - + - - + - + - + - - + - - + - + - + - Finds_7595ca92_4128_456d_a700_416cedf9aaa4 - OSM_Standard_88a32e94_cd29_412c_8b66_ee44fe338fab - Ortho_20_cm_f8497a68_e819_4170_a2ce_17cc699ac2d2 - Parcelles_b677c8a6_df4d_4e0a_9f9f_42287fd8263e - Communes_4866eaff_96f1_4af8_820c_6a6e1c2a757b - Context_records_321d8648_b561_45da_9000_6df5d7562f17 + Context_records_50cf56e7_5133_4e57_851f_0e9200feea42 + Finds_5332a9ed_5432_469a_b92a_51e2be96cae6 + OSM_Standard_4ca0243b_81ac_44ed_87fc_33781eca4298 + Ortho_20_cm_7f9f9be9_4781_4138_a86d_0f2dab3d4cdd + Parcelles_13f89f3f_f9b5_4fb6_a174_de5fec4ce298 + Communes_2b8780b8_da43_4f49_b30e_0ac4e9d6ecc9 - + - - - - + + + + - + degrees - -5.01831950074398492 - 42.81767541344365924 - 10.32258959016502331 - 50.06635116171296573 + -4.89729578246241815 + 43.04191573198868781 + 9.8988154313895258 + 50.43175127724932594 0 @@ -123,43 +130,43 @@ - - - + Annotations_61e154b2_8160_463f_af4c_71565a806b89 @@ -220,8 +227,20 @@ - - Communes_4866eaff_96f1_4af8_820c_6a6e1c2a757b + + + -63.08474180000000331 + -21.3896307599999993 + 55.83665386999999924 + 51.08898943999999887 + + + -63.08474180000000331 + -21.3896307599999993 + 55.83665386999999924 + 51.08898943999999887 + + Communes_2b8780b8_da43_4f49_b30e_0ac4e9d6ecc9 pagingEnabled='default' preferCoordinatesForWfsT11='false' restrictToRequestBBOX='1' srsname='EPSG:4326' typename='ADMINEXPRESS-COG.2024:commune' url='https://data.geopf.fr/wfs/ows' url='https://data.geopf.fr/wfs/ows?VERSION=2.0.0' version='auto' @@ -282,13 +301,13 @@ 1 0 - + - + - + - + - + - + - + - + - + - + - + - - Context_records_321d8648_b561_45da_9000_6df5d7562f17 + + Context_records_50cf56e7_5133_4e57_851f_0e9200feea42 ./Context_records.gpkg|layername=Context_records @@ -840,7 +859,7 @@ def my_form_open(dialog, layer, feature): - + @@ -865,13 +884,13 @@ def my_form_open(dialog, layer, feature): 1 0 - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + - - + - + - - + - - + - + + + + + + + - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - + - + - @@ -1500,6 +1556,7 @@ def my_form_open(dialog, layer, feature): + @@ -1512,6 +1569,20 @@ def my_form_open(dialog, layer, feature): + + + + + + + + + + + + + + @@ -1530,6 +1601,7 @@ def my_form_open(dialog, layer, feature): + @@ -1542,6 +1614,20 @@ def my_form_open(dialog, layer, feature): + + + + + + + + + + + + + + @@ -1555,42 +1641,57 @@ def my_form_open(dialog, layer, feature): - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "description" - - Finds_7595ca92_4128_456d_a700_416cedf9aaa4 + + Finds_5332a9ed_5432_469a_b92a_51e2be96cae6 ./Finds.gpkg|layername=Finds @@ -1643,7 +1744,7 @@ def my_form_open(dialog, layer, feature): - + @@ -1668,13 +1769,13 @@ def my_form_open(dialog, layer, feature): 1 0 - + - + - + - + - + - + - + - + - + - + - + - + -20037508.34278924390673637 -20037508.34278924763202667 @@ -2259,7 +2413,7 @@ def my_form_open(dialog, layer, feature): 180 85.05112877980660357 - OSM_Standard_88a32e94_cd29_412c_8b66_ee44fe338fab + OSM_Standard_4ca0243b_81ac_44ed_87fc_33781eca4298 crs=EPSG:3857&format&type=xyz&url=http://tile.openstreetmap.org/%7Bz%7D/%7Bx%7D/%7By%7D.png&zmax=19&zmin=0 @@ -2287,7 +2441,7 @@ def my_form_open(dialog, layer, feature): Tuiles OpenStreetMap OpenStreetMap est construit par une communauté de cartographes qui contribuent et maintiennent des données sur les routes, les sentiers, les cafés, les gares, et bien plus encore, dans le monde entier. - + @@ -2309,7 +2463,7 @@ def my_form_open(dialog, layer, feature): - + wms @@ -2326,13 +2480,13 @@ def my_form_open(dialog, layer, feature): 0 0 - + - + - + - + - + - + - + -20037508.34278924390673637 -15538711.09630922041833401 @@ -2483,7 +2637,7 @@ def my_form_open(dialog, layer, feature): 180 80 - Ortho_20_cm_f8497a68_e819_4170_a2ce_17cc699ac2d2 + Ortho_20_cm_7f9f9be9_4781_4138_a86d_0f2dab3d4cdd crs=EPSG:3857&dpiMode=7&featureCount=10&format=image/jpeg&layers=HR.ORTHOIMAGERY.ORTHOPHOTOS&styles=normal&tileMatrixSet=PM_6_19&tilePixelRatio=0&url=https://data.geopf.fr/wmts?SERVICE%3DWMTS%26VERSION%3D1.0.0%26REQUEST%3DGetCapabilities @@ -2539,16 +2693,16 @@ def my_form_open(dialog, layer, feature): 1 1 - 1 + 0 0 - + - + - + - + - + - + @@ -2655,9 +2820,9 @@ def my_form_open(dialog, layer, feature): - + - + None @@ -2668,15 +2833,27 @@ def my_form_open(dialog, layer, feature): 2 - - + + resamplingFilter 0 - - Parcelles_b677c8a6_df4d_4e0a_9f9f_42287fd8263e + + + -63.1531314100000003 + -21.38974728000000169 + 55.83668585000000206 + 51.08889740000000046 + + + -63.1531314100000003 + -21.38974728000000169 + 55.83668585000000206 + 51.08889740000000046 + + Parcelles_13f89f3f_f9b5_4fb6_a174_de5fec4ce298 pagingEnabled='default' preferCoordinatesForWfsT11='false' restrictToRequestBBOX='1' srsname='EPSG:4326' typename='BDPARCELLAIRE-VECTEUR_WLD_BDD_WGS84G:parcelle' url='https://data.geopf.fr/wfs/ows' url='https://data.geopf.fr/wfs/ows?VERSION=2.0.0' version='auto' @@ -2737,13 +2914,13 @@ def my_form_open(dialog, layer, feature): 1 0 - + - + - + - + - + - + - + - + - + - + - + - - - - - - + + + + + + @@ -3228,6 +3405,9 @@ def my_form_open(dialog, layer, feature): false + + + EPSG:7030 @@ -3257,14 +3437,95 @@ def my_form_open(dialog, layer, feature): 2 + + DCIM + {} - /home/thomas/StageM2/ishtar/ishtar_common/qfield/model + /home/thomas/StageM2/ishtar/ishtar_common/qfield/Tempo/Stock + false 1 + + + + + + + + + + None + false + false + + + + + + 8.983152841195214e-06 + false + conditions unknown + 90 + + + + 1 + + 8 + + false + + false + + false + 0 + + false + + + + + + + + false + + + + + false + + 5000 + + + + false + + - . + + + 10 + + 1024 + 14 + 14 + singleLayer + 0 + + 0 + 30 + 1 + 0 + + 0 + online + {} + 0 + 0 + /home/thomas/StageM2/ishtar/ishtar_common/qfield/specific/Prospections.qgs @@ -3283,12 +3544,21 @@ def my_form_open(dialog, layer, feature): + + + + + + + + + - + Thomas ANDRE - 2025-04-29T16:38:23 + 2025-06-23T11:18:51 @@ -3297,7 +3567,7 @@ def my_form_open(dialog, layer, feature): - + GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]] +proj=longlat +datum=WGS84 +no_defs @@ -3311,16 +3581,16 @@ def my_form_open(dialog, layer, feature): - + - + - + - + - + diff --git a/ishtar_common/qfield/model/Prospections_attachments.zip b/ishtar_common/qfield/model/Prospections_attachments.zip index 463d5b82d..5fd9569f2 100644 Binary files a/ishtar_common/qfield/model/Prospections_attachments.zip and b/ishtar_common/qfield/model/Prospections_attachments.zip differ diff --git a/ishtar_common/qfield/specific/Context_records.gpkg b/ishtar_common/qfield/specific/Context_records.gpkg new file mode 100644 index 000000000..ea90ed4d2 Binary files /dev/null and b/ishtar_common/qfield/specific/Context_records.gpkg differ diff --git a/ishtar_common/qfield/specific/Finds.gpkg b/ishtar_common/qfield/specific/Finds.gpkg new file mode 100644 index 000000000..45af2f92f Binary files /dev/null and b/ishtar_common/qfield/specific/Finds.gpkg differ diff --git a/ishtar_common/qfield/specific/Prospections.qgs b/ishtar_common/qfield/specific/Prospections.qgs new file mode 100644 index 000000000..1417afa10 --- /dev/null +++ b/ishtar_common/qfield/specific/Prospections.qgs @@ -0,0 +1,4453 @@ + + + + + + + + + GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]] + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat + EPSG:7030 + true + + + + + + + 0 + 0 + + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OSM_Standard_161cd79c_bfae_4bf1_babe_43969b1bdbfa + Ortho_20_cm_19add3b3_cd2a_4ee5_916b_c54d5277468f + Sites_86f23ad8_39fd_4fa8_b257_54790f7e0334 + Context_records_9eeccb7f_1d8f_41b0_9df9_03a2b5693f7c + Finds_8d83c7c0_158e_4f32_83ac_1a827219e890 + Parcelles_ad62bf87_a1ae_45bb_acb5_c5684eaedde1 + Communes_6b9e15f4_50f9_4a49_97dd_0b7b246a51f4 + + + + + + + + + + + + + + + degrees + + -4.82273981857531986 + 42.56931658688716169 + 10.12340999663082464 + 50.3322474228680008 + + 0 + + + GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]] + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat + EPSG:7030 + true + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Annotations_82d161b1_c541_4fee_9412_dfa18c699fde + + + + + Annotations + + + GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]] + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat + EPSG:7030 + true + + + + + + + + + + + + + + + + + + 0 + 0 + + + + + false + + + + + + + 1 + 1 + 1 + 0 + + + + 1 + 0 + + + + + Communes_6b9e15f4_50f9_4a49_97dd_0b7b246a51f4 + pagingEnabled='default' preferCoordinatesForWfsT11='false' restrictToRequestBBOX='1' srsname='EPSG:4326' typename='ADMINEXPRESS-COG.2024:commune' url='https://data.geopf.fr/wfs/ows' url='https://data.geopf.fr/wfs/ows?VERSION=2.0.0' version='auto' + + + + Communes + + + GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]] + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat + EPSG:7030 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + + + + + false + + + + + + + + + + + + + WFS + + + + + + + + + + + 1 + 1 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + 0 + generatedlayout + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "nom" + + + + Context_records_9eeccb7f_1d8f_41b0_9df9_03a2b5693f7c + ./Context_records.gpkg|layername=Context_records + + + + Context_records + + + GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]] + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat + EPSG:7030 + true + + + + + + + dataset + + + + + + + + + + + + + + + + + + GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]] + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat + EPSG:7030 + true + + + + + + + + + + + + + ogr + + + + + + + + + + + 1 + 1 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + 0 + generatedlayout + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "description" + + + + Finds_8d83c7c0_158e_4f32_83ac_1a827219e890 + ./Finds.gpkg|layername=Finds + + + + Finds + + + GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]] + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat + EPSG:7030 + true + + + + + + + dataset + + + + + + + + + + + + + + + + + + GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]] + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat + EPSG:7030 + true + + + + + + + + + + + + + ogr + + + + + + + + + + + 1 + 1 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + 0 + generatedlayout + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "champ_id" + + + + + -20037508.34278924390673637 + -20037508.34278924763202667 + 20037508.34278924390673637 + 20037508.34278924763202667 + + + -180 + -85.05112877980660357 + 180 + 85.05112877980660357 + + OSM_Standard_161cd79c_bfae_4bf1_babe_43969b1bdbfa + crs=EPSG:3857&format&type=xyz&url=http://tile.openstreetmap.org/%7Bz%7D/%7Bx%7D/%7By%7D.png&zmax=19&zmin=0 + + + + © OpenStreetMap contributors, CC-BY-SA + OSM Standard + + + PROJCRS["WGS 84 / Pseudo-Mercator",BASEGEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4326]],CONVERSION["Popular Visualisation Pseudo-Mercator",METHOD["Popular Visualisation Pseudo Mercator",ID["EPSG",1024]],PARAMETER["Latitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8801]],PARAMETER["Longitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["False easting",0,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",0,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["easting (X)",east,ORDER[1],LENGTHUNIT["metre",1]],AXIS["northing (Y)",north,ORDER[2],LENGTHUNIT["metre",1]],USAGE[SCOPE["Web mapping and visualisation."],AREA["World between 85.06°S and 85.06°N."],BBOX[-85.06,-180,85.06,180]],ID["EPSG",3857]] + +proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs + 3857 + 3857 + EPSG:3857 + WGS 84 / Pseudo-Mercator + merc + EPSG:7030 + false + + + + Tuiles OpenStreetMap + + + dataset + Tuiles OpenStreetMap + OpenStreetMap est construit par une communauté de cartographes qui contribuent et maintiennent des données sur les routes, les sentiers, les cafés, les gares, et bien plus encore, dans le monde entier. + + + + + + Fond de carte et données d’OpenStreetMap et de la Fondation OpenStreetMap (CC-BY-SA). © les contributeurs de https://www.openstreetmap.org. + Open Data Commons Open Database License (ODbL) + Creative Commons Attribution-ShareAlike (CC-BY-SA) + + + + PROJCRS["WGS 84 / Pseudo-Mercator",BASEGEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4326]],CONVERSION["Popular Visualisation Pseudo-Mercator",METHOD["Popular Visualisation Pseudo Mercator",ID["EPSG",1024]],PARAMETER["Latitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8801]],PARAMETER["Longitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["False easting",0,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",0,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["easting (X)",east,ORDER[1],LENGTHUNIT["metre",1]],AXIS["northing (Y)",north,ORDER[2],LENGTHUNIT["metre",1]],USAGE[SCOPE["Web mapping and visualisation."],AREA["World between 85.06°S and 85.06°N."],BBOX[-85.06,-180,85.06,180]],ID["EPSG",3857]] + +proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs + 3857 + 3857 + EPSG:3857 + WGS 84 / Pseudo-Mercator + merc + EPSG:7030 + false + + + + + + + wms + + + + + + + + + 1 + 1 + 0 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + None + WholeRaster + Estimated + 0.02 + 0.98 + 2 + + + + + + resamplingFilter + + 0 + + + + -20037508.34278924390673637 + -15538711.09630922041833401 + 20037508.34278924390673637 + 15538711.09630922041833401 + + + -180 + -80 + 180 + 80 + + Ortho_20_cm_19add3b3_cd2a_4ee5_916b_c54d5277468f + crs=EPSG:3857&dpiMode=7&featureCount=10&format=image/jpeg&layers=HR.ORTHOIMAGERY.ORTHOPHOTOS&styles=normal&tileMatrixSet=PM_6_19&tilePixelRatio=0&url=https://data.geopf.fr/wmts?SERVICE%3DWMTS%26VERSION%3D1.0.0%26REQUEST%3DGetCapabilities + + + + Ortho 20 cm + + + PROJCRS["WGS 84 / Pseudo-Mercator",BASEGEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4326]],CONVERSION["Popular Visualisation Pseudo-Mercator",METHOD["Popular Visualisation Pseudo Mercator",ID["EPSG",1024]],PARAMETER["Latitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8801]],PARAMETER["Longitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["False easting",0,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",0,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["easting (X)",east,ORDER[1],LENGTHUNIT["metre",1]],AXIS["northing (Y)",north,ORDER[2],LENGTHUNIT["metre",1]],USAGE[SCOPE["Web mapping and visualisation."],AREA["World between 85.06°S and 85.06°N."],BBOX[-85.06,-180,85.06,180]],ID["EPSG",3857]] + +proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs + 3857 + 3857 + EPSG:3857 + WGS 84 / Pseudo-Mercator + merc + EPSG:7030 + false + + + + + + + + + + + + + + + + + + 0 + 0 + + + + + false + + + + + wms + + + + + + + + + 1 + 1 + 0 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + None + WholeRaster + Estimated + 0.02 + 0.98 + 2 + + + + + + resamplingFilter + + 0 + + + Parcelles_ad62bf87_a1ae_45bb_acb5_c5684eaedde1 + pagingEnabled='default' preferCoordinatesForWfsT11='false' restrictToRequestBBOX='1' srsname='EPSG:4326' typename='BDPARCELLAIRE-VECTEUR_WLD_BDD_WGS84G:parcelle' url='https://data.geopf.fr/wfs/ows' url='https://data.geopf.fr/wfs/ows?VERSION=2.0.0' version='auto' + + + + Parcelles + + + GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]] + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat + EPSG:7030 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + + + + + false + + + + + + + + + + + + + WFS + + + + + + + + + + + 1 + 1 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + 0 + generatedlayout + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "nom" + + + + Sites_86f23ad8_39fd_4fa8_b257_54790f7e0334 + ./Sites.gpkg|layername=Sites + + + + Sites + + + GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]] + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat + EPSG:7030 + true + + + + + + + dataset + + + + + + + + + + + + + + + + + + GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]] + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat + EPSG:7030 + true + + + + + + + + + + + + + ogr + + + + + + + + + + + 1 + 1 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + 0 + generatedlayout + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "champ_nom_site" + + + + + + + + + + + + + + + + 0 + + + 255 + 255 + 255 + 255 + 0 + 255 + 255 + + + false + + + + + + EPSG:7030 + + + m2 + meters + + + 5 + 2.5 + false + false + false + 1 + 0 + false + false + true + 0 + 255,0,0,255,rgb:1,0,0,1 + + + false + + + true + 2 + + + + DCIM + + {} + /home/thomas/StageM2/ishtar/ishtar_common/qfield/specific + + false + + 1 + + + + + + + + + + + None + false + false + + + + + + 8.983152841195214e-06 + false + conditions unknown + 90 + + + + 1 + + 8 + + false + + false + + false + 0 + + false + + + + + + + + false + + + + + false + + 5000 + + + + false + + + + + + 10 + + 1024 + 14 + 14 + singleLayer + 0 + + 0 + 30 + 1 + 0 + + 0 + online + {} + 0 + 0 + . + + + + + + + + + + + + + + + + + + + + + + + + + + + + Thomas ANDRE + 2025-06-10T15:23:35 + + + + + + + + + + + GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]] + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat + EPSG:7030 + true + + + + + + + + + + + + + + + + + + + + + + GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]] + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat + EPSG:7030 + true + + + + + + + diff --git a/ishtar_common/qfield/specific/Prospections_attachments.zip b/ishtar_common/qfield/specific/Prospections_attachments.zip new file mode 100644 index 000000000..a82b68b9c Binary files /dev/null and b/ishtar_common/qfield/specific/Prospections_attachments.zip differ diff --git a/ishtar_common/qfield/specific/Prospections_qfield.zip b/ishtar_common/qfield/specific/Prospections_qfield.zip new file mode 100644 index 000000000..3a6bfb756 Binary files /dev/null and b/ishtar_common/qfield/specific/Prospections_qfield.zip differ diff --git a/ishtar_common/qfield/specific/Sites.gpkg b/ishtar_common/qfield/specific/Sites.gpkg new file mode 100644 index 000000000..fc45c4b77 Binary files /dev/null and b/ishtar_common/qfield/specific/Sites.gpkg differ diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index 3540f9cfe..38d7c987d 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -2804,30 +2804,40 @@ class BaseImportTest(TestCase): new_file = os.path.join(root, "qfield", "model", "Test.qgs") with open(filename, 'r', encoding ='utf-8') as file: style = file.read() - modifications = style.replace('champ_','test_modif_') + modifications = style.replace('find_','test_modif_') with open(new_file, 'w', encoding ='utf-8') as file: file.write(modifications) with open(new_file, 'r', encoding='utf-8') as file: style = file.read() bool = 'test_modif_' in style self.assertEqual(bool, True) - bool = 'champ_' in style + bool = 'find_' in style self.assertEqual(bool, False) os.remove(new_file) - def export_qfield(self, mode, root, table_cols, col_names, datas): + def export_qfield(self, mode, model, root, table_cols, col_names, datas): """ :function: Core part of the test for the creation of a .gpkg, the modification of the .qgs and creation of a .zip test """ # 2) Creation of the .gpkg - finds, cr, list_ope, list_crea = views_item.gpkg_creation(root, table_cols, col_names, datas) + if str(model._meta) == 'archaeological_operations.archaeologicalsite': + sites, finds, cr, list_ope, list_crea = views_item.gpkg_creation_sites(root, table_cols, col_names, datas) + # Modification of the source to access the desired project depending on source of the data + source = 'specific' + else: + finds, cr, list_ope, list_crea = views_item.gpkg_creation(model, root, table_cols, col_names, datas) + # Modification of the source to access the desired project depending on source of the data + source = 'model' # 3) Preparations for the modification of the style in the .qgs file - qgs_path = os.path.join(root, 'model', 'Prospections.qgs') + qgs_path = os.path.join(root, source, 'Prospections.qgs') new_qgs = os.path.join(root, 'tests', str(mode), 'Prospections.qgs') if os.path.exists(new_qgs): os.remove(new_qgs) - text = views_item.modification_style(qgs_path, table_cols, col_names, list_ope, list_crea) + if source == 'specific': + text = views_item.modification_style_sites(qgs_path, table_cols, col_names, list_ope, list_crea) + else: + text = views_item.modification_style(qgs_path, table_cols, col_names, list_ope, list_crea) with open(new_qgs, 'w', encoding='utf-8') as file: file.write(text) @@ -2841,6 +2851,9 @@ class BaseImportTest(TestCase): # III. Moving the .gpkg in a copy of the Qfield test project with ZipFile(duplicate, 'a') as zip_file: # Adding the .gpkg to the .zip + if source == 'specific': + # Add only if created + zip_file.write(sites, os.path.basename(sites)) zip_file.write(finds, os.path.basename(finds)) zip_file.write(cr, os.path.basename(cr)) zip_file.write(new_qgs, os.path.basename(new_qgs)) @@ -2855,27 +2868,32 @@ class BaseImportTest(TestCase): self.assertEqual(dir_list, ['Prospections_qfield_export.zip', 'Prospections.qgs']) # Verification of the content of the .zip with ZipFile(os.path.join(folder, 'Prospections_qfield_export.zip'), 'r') as zip_file: - self.assertEqual(len(zip_file.namelist()), 4) - list_files = ['Prospections_attachments.zip', 'Finds.gpkg', 'Context_records.gpkg', 'Prospections.qgs'] - self.assertEqual(zip_file.namelist(), list_files) - zip_file.close() + try: + self.assertEqual(len(zip_file.namelist()), 4) + list_files = ['Prospections_attachments.zip', 'Finds.gpkg', 'Context_records.gpkg', 'Prospections.qgs'] + self.assertEqual(zip_file.namelist(), list_files) + except: + self.assertEqual(len(zip_file.namelist()), 5) + list_files = ['Prospections_attachments.zip', 'Sites.gpkg', 'Finds.gpkg', 'Context_records.gpkg', 'Prospections.qgs'] + self.assertEqual(zip_file.namelist(), list_files) + zip_file.close() # List of modified and new values to verify the absence/presence depending on the situation if mode == 1: - old = ['champ_id', 'champ_ue', 'champ_x', 'champ_y', 'champ_z', 'champ_wkt_modif', 'champ_nom', 'champ_ope', - 'champ_insee', 'champ_section', 'champ_parc', 'champ_type', 'champ_occup', 'champ_desc', 'champ_loca', - 'champ_media_cr', 'champ_periode', 'champ_acti', 'champ_geom'] - new = ['Identifiant', 'UE', 'X', 'Y', 'Z', 'WKT_point', 'Unité_Enregistrement', 'Opération', 'INSEE_Commune', - 'Section', 'Parcelle', 'Type', 'Interprétation', 'Description', 'Localisation', 'Media', 'Periode', 'Type_Activité', 'WKT'] + old = ['finds_id', 'finds_cr', 'finds_x', 'finds_y', 'finds_z', 'cr_name', 'cr_operation', 'cr_insee', + 'champ_type', 'cr_occupation', 'cr_description', 'cr_localisation', 'cr_media', 'cr_periode', 'cr_activity'] + new = ['Identifiant', 'UE', 'X', 'Y', 'Z', 'Unité_Enregistrement', 'Opération', 'INSEE_Commune', 'Type', + 'Interprétation', 'Description', 'Localisation', 'Media', 'Periode', 'Type_Activité'] if mode == 2: - old = ['champ_id', 'champ_ue', 'champ_wkt_simple', 'champ_nom', 'champ_ope', 'champ_insee', 'champ_section', - 'champ_parc', 'champ_type', 'champ_occup', 'champ_desc', 'champ_loca', 'champ_media_cr', - 'champ_periode', 'champ_acti', 'champ_geom'] - new = ['Identifiant', 'UE', 'WKT_point', 'Unité_Enregistrement', 'Opération', 'INSEE_Commune', 'Section', 'Parcelle', - 'Type', 'Interprétation', 'Description', 'Localisation', 'Media', 'Periode', 'Type_Activité', 'WKT'] + old = ['finds_id', 'finds_cr', 'finds_x', 'finds_y', 'finds_z', 'cr_name', 'cr_operation', 'cr_insee', + 'cr_section', 'cr_parcel', 'cr_type', 'cr_occupation', 'cr_description', 'cr_localisation', + 'cr_media', 'cr_periode'] + new = ['Identifiant', 'UE', 'X', 'Y', 'Z', 'Unité_Enregistrement', 'Opération', 'INSEE_Commune', + 'Description', 'Localisation', 'Media', 'Periode', 'Type_Activité'] if mode == 3: - old = ['champ_nom', 'champ_ope', 'champ_geom', 'champ_id', 'champ_ue', 'champ_date', 'champ_x', 'champ_y', - 'champ_z', 'champ_matériaux', 'champ_desc', 'champ_media_finds', 'champ_wkt_modif'] - new = ['Nom', 'Opération', 'WKT_polygon', 'Identifiant', 'UE', 'Date', 'X', 'Y', 'Z', 'Description', 'Media', 'WKT_point'] + old = ['cr_name', 'cr_operation', 'cr_wkt', 'finds_id', 'finds_cr', 'finds_date', 'finds_x', 'finds_y', + 'finds_z', 'champ_matériaux', 'cr_description', 'finds_media', 'finds_wkt_modif'] + new = ['Nom', 'Opération', 'WKT_polygon', 'Identifiant', 'UE', 'Date', 'X', 'Y', 'Z', 'Description', + 'Media', 'WKT_point'] with open(new_qgs, 'r', encoding='utf-8') as file: style = file.read() for elem in old: @@ -2906,6 +2924,12 @@ class BaseImportTest(TestCase): ope, __ = Operation.objects.get_or_create( code_patriarche='Ope_Test', operation_type=ope_type) + ArchaeologicalSite = apps.get_model("archaeological_operations", "ArchaeologicalSite") + site = ArchaeologicalSite.objects.create( + reference="1515", + name="Test_Site", + x=14.18, + y=39.45) ContextRecord = apps.get_model('archaeological_context_records', 'ContextRecord') cr, __ = ContextRecord.objects.get_or_create( operation=ope, @@ -2923,20 +2947,25 @@ class BaseImportTest(TestCase): for mode in range(1, 4): if mode == 1: - table_cols = ['label', 'context_record__label', 'geodata__x', 'geodata__y', 'geodata__z', 'geodata__point_3d'] + table_cols = [['reference'], ['name'], ['operations__code_patriarche'], ['geodata__x'], ['geodata__y'], + ['geodata__point_2d']] + col_names = ['Reference', 'Nom', 'Operation', 'X', 'Y', 'WKT_point'] + datas = [['', '1515', 'Test_site', 'Ope_Test', 14.18, 39.45, 'Point (14.1 39.45)']] + model = apps.get_model("archaeological_operations", "ArchaeologicalSite") + self.export_qfield(mode, model, root, table_cols, col_names, datas) + if mode == 2: + table_cols = ['label', 'context_record__label', 'geodata__x', 'geodata__y', 'geodata__z', + 'geodata__point_3d'] col_names = ['Identifiant', 'UE', 'X', 'Y', 'Z', 'WKT_point'] datas = [['', 'Test_Mobilier', 'Test_UE', 7.0, 1.4, 2.1, 'Point Z (0.7 1.4 2.1)']] - self.export_qfield(mode, root, table_cols, col_names, datas) - if mode == 2: - table_cols = ['label', 'context_record__label', 'geodata__point_3d'] - col_names = ['Identifiant', 'UE', 'WKT_point'] - datas = [['', 'Test_Mobilier', 'Test_UE', 'POINT Z (0.7 1.4 0)']] - self.export_qfield(mode, root, table_cols, col_names, datas) + model = apps.get_model('archaeological_finds', 'Find') + self.export_qfield(mode, model, root, table_cols, col_names, datas) if mode == 3: table_cols = [['label'], ['operation__code_patriarche'], ['geodata__multi_polygon']] col_names = ['Nom', 'Opération', 'WKT_polygon'] datas = [['', 'Test_UE', 'Ope_Test', 'MultiPolygon (((0.0 0.0, 1.0 1.0, 2.0 2.0)))']] - self.export_qfield(mode, root, table_cols, col_names, datas) + model = apps.get_model('archaeological_context_records', 'ContextRecord') + self.export_qfield(mode, model, root, table_cols, col_names, datas) diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py index 001a1437f..5b7c136fd 100644 --- a/ishtar_common/views_item.py +++ b/ishtar_common/views_item.py @@ -3223,7 +3223,7 @@ def get_item( elif data_type == "gpkg": # I. Preparations root = settings.LIB_BASE_PATH + "ishtar_common/qfield/" - # 1) Getting all the column names (copy from below) + # 1) Getting all the columns names (copy from below) if col_names: col_names = [name for name in col_names] else: @@ -3248,18 +3248,30 @@ def get_item( ) continue col_names.append(str(field.verbose_name)) - # 2) Creation of the .gpkg - finds, cr, list_ope, list_crea = gpkg_creation(root, table_cols, col_names, datas) + # 2) Gestion of the project to use + if str(model._meta) == 'archaeological_operations.archaeologicalsite': + sites, finds, cr, list_ope, list_crea = gpkg_creation_sites(root, table_cols, col_names, datas) + # Modification of the source to access the desired project depending on source of the data + source = 'specific' + else: + finds, cr, list_ope, list_crea = gpkg_creation(model, root, table_cols, col_names, datas) + # Modification of the source to access the desired project depending on source of the data + source = 'model' # 3) Preparations for the modification of the style in the .qgs file - qgs_path = os.path.join(root, 'model', 'Prospections.qgs') + qgs_path = os.path.join(root, source, 'Prospections.qgs') new_qgs = os.path.join(root, 'export', 'Prospections.qgs') if os.path.exists(new_qgs): os.remove(new_qgs) - text = modification_style(qgs_path, table_cols, col_names, list_ope, list_crea) + # Use of a specific style modifier depending on the project / source of the data + if source == 'specific': + text = modification_style_sites(qgs_path, table_cols, col_names, list_ope, list_crea) + else: + text = modification_style(qgs_path, table_cols, col_names, list_ope, list_crea) + # Creation of the new modified project with open(new_qgs, 'w', encoding='utf-8') as file: file.write(text) # II. Duplication of the .zip for export - project = os.path.join(root, 'model', 'Prospections_qfield.zip') + project = os.path.join(root, source, 'Prospections_qfield.zip') duplicate = os.path.join(root, 'export', 'Prospections_qfield_export.zip') if os.path.exists(duplicate): os.remove(duplicate) @@ -3267,100 +3279,175 @@ def get_item( # III. Moving the .gpkg in a copy of the Qfield test project with ZipFile(duplicate, 'a') as zip_file: # Adding the .gpkg to the .zip + if source == 'specific': + # Add only if created + zip_file.write(sites, os.path.basename(sites)) zip_file.write(finds, os.path.basename(finds)) zip_file.write(cr, os.path.basename(cr)) zip_file.write(new_qgs, os.path.basename(new_qgs)) # Closing of the .zip zip_file.close() response = HttpResponse(open(duplicate, 'rb'), content_type='application/zip') - response['Content-Disposition'] = 'attachment; filename="Qfield_prospections.zip"' + n = timezone.now() + filename = "Qfield_prospections_{}.zip".format(n.strftime("%Y%m%d-%H%M%S")) + response['Content-Disposition'] = 'attachment; filename={}'.format(filename) return response return HttpResponse('{}', content_type='text/plain') return func -def gpkg_creation(root, table_cols, col_names, datas): - # 1) Creation of the Geopackage - finds = os.path.join(root, 'export', 'Finds.gpkg') - # Verification to delete it if already existing - if os.path.exists(finds): - os.remove(finds) +def gpkg_creation(model, root, table_cols, col_names, datas): + """ + :param model: Table from the query + :param root: Path to the folder to create the geopackage + :param table_cols: List of the columns used in the query + :param col_names: Name of the columns in the new geopackage + :param datas: Data from the query + :function: Creation of the Finds and Context_Records geopackages when the query come from one of these two tables + :return finds: Geopackage for the Finds + :return cr: Geopackage for the Context_Records + :return list_ope: List of the different operations linked to the Finds and Context_Records + :return list_cr: List of the labels/names of the Context_Records used + """ + # Preparation of important values and parameters for the geopackages + finds = '' + cr = '' + list_ope = [] + list_crea = [] driver = ogr.GetDriverByName('GPKG') - datasource = driver.CreateDataSource(finds) srs = osr.SpatialReference() srs.ImportFromEPSG(4326) - # 2) Verufucation of the origin of the export - origin = geometry_attribution(table_cols, datas) - # 3a) Case where the extraction come from Finds - if origin == 'finds': - # 4a) Creation of the finds layer and its attributes + # I. Case where the extraction come from Finds + if str(model._meta) == 'archaeological_finds.find': + # 1) Creation of the Finds geopackage + finds = os.path.join(root, 'export', 'Finds.gpkg') + # Verification to delete it if already existing + if os.path.exists(finds): + os.remove(finds) + # 2) Creation of the finds layer and its attributes + datasource = driver.CreateDataSource(finds) layer = datasource.CreateLayer('Finds', srs, ogr.wkbPoint25D) - layer = attributes_creation_finds_manual(layer, col_names, table_cols) - # 5a) Populating the finds layer with the datas - list_cr = populating_layer_finds(layer,table_cols,col_names,datas) + layer = attributes_creation_finds_query(layer, col_names, table_cols) + # 4a) Populating the finds layer with the datas + list_cr = populating_layer_finds_query(layer,table_cols,col_names,datas) datasource = None - # 6a) Creation of the Context Records file + # 3) Creation of the Context Records file cr = os.path.join(root, 'export', 'Context_records.gpkg') # Verification to delete it if already existing if os.path.exists(cr): os.remove(cr) datasource = driver.CreateDataSource(cr) - srs = osr.SpatialReference() - srs.ImportFromEPSG(4326) - # 7a) Creation of the cr's layer and a list of default attrbutes + # 4) Creation of the Context_Records layer and a list of default attributes layer = datasource.CreateLayer('Context_records', srs, ogr.wkbMultiPolygon) - list_crea = ['Unité_Enregistrement', 'Opération', 'INSEE_Commune', 'Section', 'Parcelle', 'Type', 'Interprétation', - 'Description', 'Localisation', 'Media', 'Periode', 'Type_Activité', 'WKT'] - layer = attributes_creation_cr_automatic(layer, list_crea) - # 8a) Populating the cr's layer with datas from the cr of the extracted finds - list_ope = populating_layer_cr_automatic(layer, list_crea, list_cr) + list_crea = ['Unité_Enregistrement', 'Opération', 'INSEE_Commune', 'Type', 'Interprétation', + 'Description', 'Localisation', 'Media', 'Periode', 'Type_Activité', 'WKT', 'Infos_Parcelle'] + layer = attributes_creation_cr_default(layer, list_crea) + # 5) Populating the Context_Records layer with datas from the Context_Records of the extracted finds + list_ope = populating_layer_cr_default(layer, list_crea, list_cr) datasource = None - # 9a) Preparation of a list of the attributes names for the style modifications + # 6) Preparation of a list of the attributes names for the style modifications list_crea = ['cr', list_crea] - else: - # 4b) Creation of the finds layer and a list of default attrbutes - layer = datasource.CreateLayer('Finds', srs, ogr.wkbPoint25D) - list_crea = ['Identifiant', 'UE', 'Date', 'X', 'Y', 'Z', 'Matériaux', 'Description', 'Media', 'WKT_point'] - attributes_creation_finds_automatic(layer, list_crea) - datasource = None - # 5b) Creation of the Context Records file + # II. Case where the extraction come from Context_Recods + elif str(model._meta) == 'archaeological_context_records.contextrecord': + # 1) Creation of the Context Records geopackage cr = os.path.join(root, 'export', 'Context_records.gpkg') # Verification to delete it if already existing if os.path.exists(cr): os.remove(cr) datasource = driver.CreateDataSource(cr) - srs = osr.SpatialReference() - srs.ImportFromEPSG(4326) - # 6a) Creation of the cr's layer and its attributes + # 2) Creation of the Context_Records layer and its attributes layer = datasource.CreateLayer('Context_records', srs, ogr.wkbMultiPolygon) - layer = attributes_creation_cr_manual(layer, col_names, table_cols) - # 7b) Populating the cr's layer with the datas - list_ope = populating_layer_cr_manual(layer, table_cols, col_names, datas) - # 8b) Preparation of a list of the attributes names for the style modifications + layer = attributes_creation_cr_query(layer, col_names, table_cols) + # 3) Populating the Finds layer with the datas + list_ope, list_cr = populating_layer_cr_query(layer, table_cols, col_names, datas) + datasource = None + # 4) Creation of the Finds geopackage + finds = os.path.join(root, 'export', 'Finds.gpkg') + # Verification to delete it if already existing + if os.path.exists(finds): + os.remove(finds) + datasource = driver.CreateDataSource(finds) + layer = datasource.CreateLayer('Finds', srs, ogr.wkbPoint25D) + list_crea = ['Identifiant', 'UE', 'Date', 'X', 'Y', 'Z', 'Matériaux', 'Description', 'Media', 'WKT_point', 'Infos_Parcelle'] + attributes_creation_finds_default(layer, list_crea) + # 5) Populating the finds layer with the datas + populating_layer_finds_default(layer, list_crea, list_cr) + # 6) Preparation of a list of the attributes names for the style modifications list_crea = ['finds', list_crea] return finds, cr, list_ope, list_crea -def geometry_attribution (table_cols, datas): - # Getting the name of the first element, two cases because in the case of Context Records, all elements are in lists - try: - id_label = table_cols.index('label') - name = datas[0][id_label + 1] - except: - id_label = table_cols.index(['label']) - name = datas[0][id_label + 1][0] - # Recuperation of the BaseFind datas - BaseFind = apps.get_model('archaeological_finds', 'BaseFind') - references = BaseFind.objects.order_by('-pk') - # Verification if the extracted elements come from BaseFind or, by default, from Context Records - if any(elem.label == name for elem in references): - origin = 'finds' - else: - origin = 'cr' - return origin - - -def attributes_creation_finds_manual(layer, col_names, table_cols): +def gpkg_creation_sites(root, table_cols, col_names, datas): + """ + :param root: Path to the folder to create the geopackage + :param table_cols: List of the columns used in the query + :param col_names: Name of the columns in the new geopackage + :param datas: Data from the query + :function: Specific version for the creation of the needed geopackages when the query come from the + Archaeological_Sites table + :return sites: Geopackage for the Sites + :return finds: Geopackage for the Finds + :return cr: Geopackage for the Context_Records + :return list_ope: List of the different operations linked to the Finds and Context_Records + :return list_cr: List of the labels/names of the Context_Records used + """ + # Preparation of important values and parameters for the geopackages + finds = '' + cr = '' + list_ope = [] + list_crea = [] + driver = ogr.GetDriverByName('GPKG') + srs = osr.SpatialReference() + srs.ImportFromEPSG(4326) + # 1) Creation of the sites layer + sites = os.path.join(root, 'export', 'Sites.gpkg') + if os.path.exists(sites): + os.remove(sites) + datasource = driver.CreateDataSource(sites) + layer = datasource.CreateLayer('Sites', srs, ogr.wkbPoint) + # Creation of the attributes + layer = attributes_creation_sites_query(layer, col_names, table_cols) + # Creation of the entities + list_ope, list_cr = populating_layer_sites_query(layer, table_cols, col_names, datas) + # 2) Creation of the Context_Records layer + cr = os.path.join(root, 'export', 'Context_records.gpkg') + # Verification to delete it if already existing + if os.path.exists(cr): + os.remove(cr) + datasource = driver.CreateDataSource(cr) + layer = datasource.CreateLayer('Context_records', srs, ogr.wkbMultiPolygon) + # Creation of the attributes + list_a = ['Unité_Enregistrement', 'Opération', 'INSEE_Commune', 'Type', 'Interprétation', 'Description', + 'Localisation', 'Media', 'Periode', 'Type_Activité', 'WKT', 'Infos_Parcelle'] + layer = attributes_creation_cr_default(layer, list_a) + # # Creation of the entities + populating_layer_cr_default(layer, list_a, list_cr) + datasource = None + # 3) Creation of the finds layer + finds = os.path.join(root, 'export', 'Finds.gpkg') + # Verification to delete it if already existing + if os.path.exists(finds): + os.remove(finds) + datasource = driver.CreateDataSource(finds) + layer = datasource.CreateLayer('Finds', srs, ogr.wkbPoint25D) + # Creation of the attributes + list_b = ['Identifiant', 'UE', 'Date', 'X', 'Y', 'Z', 'Matériaux', 'Description', 'Media', 'WKT_point', 'Infos_Parcelle'] + layer = attributes_creation_finds_default(layer, list_b) + # Creation of the entities + populating_layer_finds_default(layer, list_b, list_cr) + # Recuperation of all created attributes + list_crea = list_a + list_b + return sites, finds, cr, list_ope, list_crea + + +def attributes_creation_finds_query(layer, col_names, table_cols): + """ + :param layer: Finds layer from the linked geopackage + :param col_names: Name of the columns in the new layer + :param table_cols: List of the columns used in the query + :function: Creation of the attributes of the Finds layer with the information from the exporter + :return layer: Finds layer with attributes + """ # print(table_cols) # debugtest # print(col_names) # debugtest # print(datas) # debugtest @@ -3388,7 +3475,15 @@ def attributes_creation_finds_manual(layer, col_names, table_cols): return layer -def populating_layer_finds(layer, table_cols, col_names, datas): +def populating_layer_finds_query(layer, table_cols, col_names, datas): + """ + :param layer: Finds layer from the linked geopackage with attributes + :param table_cols: List of the columns used in the query + :param col_names: Name of the columns in the new layer + :param datas: Data from the query + :function: Population of the Finds layer using all the data from the query + :return list_cr: List of all the Context_Records linked to the Finds from the query + """ max = len(col_names) list_cr = [] # Looping on all the datas extracted to create features @@ -3412,8 +3507,8 @@ def populating_layer_finds(layer, table_cols, col_names, datas): except: # Second version if some values are missing # +1 because the first value in the attributes is '' - feature.SetField(col_names[idx], data[idx + 1].year, data[idx + 1].month, data[idx + 1].day, 0, - 0, 0) + feature.SetField(col_names[idx], data[idx + 1].year, data[idx + 1].month, + data[idx + 1].day, 0, 0, 0) elif 'context_record__label' in table_cols[idx] and data[idx + 1] not in list_cr: list_cr.append(data[idx + 1]) feature.SetField(col_names[idx], str(data[idx + 1])) @@ -3435,7 +3530,11 @@ def populating_layer_finds(layer, table_cols, col_names, datas): point = ogr.Geometry(ogr.wkbPoint25D) point.AddPoint(float(object.x), float(object.y), float(0.0)) except: - pass + try: + point = ogr.CreateGeometryFromWkt(str(object.main_geodata.point_3d).split(';')[-1]) + except: + point = '' + print(point) if point != '': feature.SetGeometry(point) # Addition of the new feature @@ -3444,7 +3543,13 @@ def populating_layer_finds(layer, table_cols, col_names, datas): return list_cr -def attributes_creation_finds_automatic(layer, list_crea): +def attributes_creation_finds_default(layer, list_crea): + """ + :param layer: Finds layer from the linked geopackage + :param list_crea: Name of the columns by default + :function: Population of the Finds layer using default attributes + :return layer: Finds layer with attributes + """ # Gestion of specific types of attributes for the default values for attribute in list_crea: if attribute == 'Date': @@ -3456,15 +3561,105 @@ def attributes_creation_finds_automatic(layer, list_crea): return layer -def attributes_creation_cr_automatic(layer, list_crea): +def populating_layer_finds_default(layer, list_crea, list_cr): + """ + :param layer: Finds layer from the linked geopackage with attributes + :param list_crea: Name of the columns by default + :param list_cr: List of all the Context_Records linked to the Finds from the query + :function: Population of the Finds layer using all the data from a specific query + :return layer: Populated Finds layer + """ + ContextRecord = apps.get_model('archaeological_context_records', 'ContextRecord') + BaseFind = apps.get_model('archaeological_finds', 'BaseFind') + for name in list_cr: + cr, __ = ContextRecord.objects.get_or_create(label=name) + finds = list(BaseFind.objects.filter(context_record=cr.id)) + for find in finds: + if str(find.context_record).split(' | ')[-1] in list_cr: + list_attributes = [] + try:list_attributes.append(find.label) + except:list_attributes.append('') + try:list_attributes.append(str(find.context_record).split(' | ')[-1]) + except:list_attributes.append('') + try:list_attributes.append(find.discovery_date) + except:list_attributes.append('') + try:list_attributes.append(find.x) + except:list_attributes.append('') + try:list_attributes.append(find.y) + except:list_attributes.append('') + try:list_attributes.append(find.z) + except:list_attributes.append('') + try:list_attributes.append(find.material_types) + except:list_attributes.append('') + try:list_attributes.append(find.description) + except:list_attributes.append('') + try:list_attributes.append(find.document.image) + except:list_attributes.append('') + try:list_attributes.append(find.main_geodata.point_3d) + except:list_attributes.append('') + try:list_attributes.append(find.parcel.external_id) + except:list_attributes.append('') + # Creation of a new feature + feature = ogr.Feature(layer.GetLayerDefn()) + for idx in range(0, len(list_crea)): + if idx == 2 : + # Gestion of the dates + try: + # First version if it has all the data necessary for an ogr.OFTDateTime + feature.SetField(list_crea[idx], list_attributes[idx]) + except: + # Second version if some values are missing + feature.SetField(list_crea[idx], int(list_attributes[idx].year), + int(list_attributes[idx].month), int(list_attributes[idx].day), 0, 0, 0.0, 0) + elif idx in [3,4,5]: + # Gestion of the coordinates + try: + feature.SetField(list_crea[idx], float(list_attributes[idx])) + except: + pass + else: + feature.SetField(list_crea[idx], str(list_attributes[idx])) + try: + point = ogr.Geometry(ogr.wkbPoint25D) + point.AddPoint(float(find.x), float(find.y), float(find.z)) + except: + try: + point = ogr.Geometry(ogr.wkbPoint25D) + point.AddPoint(float(find.x), float(find.y), float(0.0)) + except: + try: + point = ogr.CreateGeometryFromWkt(str(find.main_geodata.point_3d).split(';')[-1]) + except: + point = '' + if point != '': + feature.SetGeometry(point) + layer.CreateFeature(feature) + feature = None + return layer + + +def attributes_creation_cr_default(layer, list_crea): + """ + :param layer: Context_Records layer from the linked geopackage + :param list_crea: Name of the columns by default + :function: Population of the Context_Records layer using default attributes + :return layer: Populated Context_Records layer + """ for idx in range(0, len(list_crea)): layer.CreateField(ogr.FieldDefn(list_crea[idx], ogr.OFTString)) return layer -def populating_layer_cr_automatic(layer, list_crea, list_cr): +def populating_layer_cr_default(layer, list_crea, list_cr): + """ + :param layer: Context_Records layer from the linked geopackage with attributes + :param list_crea: Name of the columns by default + :param list_cr: List of all the Context_Records linked to the Finds from the query + :function: Population of the Finds layer using all the data from a specific query + :return list_ope: List of all the Operations linked to the Context_Records from the query + """ list_ope = [] - # Query in the DataBase to get information on the Context Records of the Finds exported + # Query in the DataBase to get information on the Context_Records of the Finds exported ContextRecord = apps.get_model('archaeological_context_records', 'ContextRecord') for name in list_cr: cr, __ = ContextRecord.objects.get_or_create( @@ -3472,40 +3667,43 @@ def populating_layer_cr_automatic(layer, list_crea, list_cr): ) list_attributes = [] try:list_attributes.append(cr.label) - except:list_attributes.append('Null') + except:list_attributes.append('') try:list_attributes.append(str(cr.operation.code_patriarche)) - except:list_attributes.append('Null') + except:list_attributes.append('') try:list_attributes.append(cr.town.numero_insee) - except:list_attributes.append('Null') - try:list_attributes.append(cr.parcel.external_id) - except:list_attributes.append('Null') + except:list_attributes.append('') try:list_attributes.append(str(cr.unit)) - except:list_attributes.append('Null') - try:list_attributes.append(cr.operation.interpretation) - except:list_attributes.append('Null') + except:list_attributes.append('') + try:list_attributes.append(cr.interpretation) + except:list_attributes.append('') try:list_attributes.append(cr.description) - except:list_attributes.append('Null') + except:list_attributes.append('') try:list_attributes.append(cr.location) - except:list_attributes.append('Null') + except:list_attributes.append('') try:list_attributes.append(cr.documents.image) - except:list_attributes.append('Null') + except:list_attributes.append('') try:list_attributes.append(cr.datings.period) - except:list_attributes.append('Null') + except:list_attributes.append('') try:list_attributes.append(str(cr.activity)) - except:list_attributes.append('Null') + except:list_attributes.append('') try:list_attributes.append(str(cr.main_geodata.multi_polygon)) - except:list_attributes.append('Null') + except:list_attributes.append('') + try:list_attributes.append(cr.parcel.external_id) + except:list_attributes.append('') # Creation of a new feature - feature = ogr.Feature(layer.GetLayerDefn()) - for idx in range(0, len(list_crea)-1): + feature = ogr.Feature(layer.GetLayerDefn( + )) + for idx in range(0, len(list_crea)): try: feature.SetField(list_crea[idx], list_attributes[idx]) except: pass - if list_attributes[1] not in list_ope: - list_ope.append(list_attributes[1]) + # Completion of the list of Operations linked to the exported Context_Records + if cr.operation.code_patriarche not in list_ope: + list_ope.append(cr.operation.code_patriarche) + # Gestion of the geometry try: - geom = ogr.CreateGeometryFromWkt(str(list_attributes[-1]).split(';')[-1]) + geom = ogr.CreateGeometryFromWkt(str(cr.main_geodata.multi_polygon).split(';')[-1]) feature.SetGeometry(geom) except: pass @@ -3514,7 +3712,14 @@ def populating_layer_cr_automatic(layer, list_crea, list_cr): return list_ope -def attributes_creation_cr_manual(layer, col_names, table_cols): +def attributes_creation_cr_query(layer, col_names, table_cols): + """ + :param layer: Context_Records layer from the linked geopackage + :param col_names: Name of the columns in the new layer + :param table_cols: List of the columns used in the query + :function: Creation of the attributes of the Context_Records layer with the data from the exporter + :return layer: Layer with attributes + """ for idx in range(0, len(col_names)): if table_cols[idx] != '': # print(table_cols[idx]) # debugtest @@ -3523,13 +3728,23 @@ def attributes_creation_cr_manual(layer, col_names, table_cols): return layer -def populating_layer_cr_manual(layer, table_cols, col_names, datas): +def populating_layer_cr_query(layer, table_cols, col_names, datas): + """ + :param layer: Context_Records layer from the linked geopackage with attributes + :param table_cols: List of the columns used in the query + :param col_names: Name of the columns in the new layer + :param datas: Data from the query + :function: Population of the Context_Records layer using all the data from the query + :return list_ope: List of all the Operations linked to the Context_Records from the query + """ #print(table_cols) #debugtest #print(col_names) #debugtest #print(datas) #debugtest list_ope = [] + list_cr = [] geom = '' max = len(col_names) + # Looping on all the datas extracted to create features for data in datas: # Creation of a new feature feature = ogr.Feature(layer.GetLayerDefn()) @@ -3542,6 +3757,7 @@ def populating_layer_cr_manual(layer, table_cols, col_names, datas): feature.SetField(col_names[idx], str(data[idx + 1])) id_label = table_cols.index(['label']) name = datas[0][id_label + 1] + list_cr.append(name) ContextRecord = apps.get_model('archaeological_context_records', 'ContextRecord') cr, __ = ContextRecord.objects.get_or_create( label=name @@ -3557,26 +3773,120 @@ def populating_layer_cr_manual(layer, table_cols, col_names, datas): feature.SetGeometry(geom) layer.CreateFeature(feature) feature = None - return list_ope + return list_ope, list_cr + + +def attributes_creation_sites_query(layer, col_names, table_cols): + """ + :param layer: Sites layer from the linked geopackage + :param col_names: Name of the columns in the new layer + :param table_cols: List of the columns used in the query + :function: Creation of the attributes of the Sites layer with the data from the exporter + :return layer: Layer with attributes + """ + for idx in range(0, len(col_names)): + if table_cols[idx] != '': + # Gestion of the attribute's type + if table_cols[idx] in ['geodata__x', 'geodata__y']: + layer.CreateField(ogr.FieldDefn(col_names[idx], ogr.OFTReal)) + else: + layer.CreateField(ogr.FieldDefn(col_names[idx], ogr.OFTString)) + return layer + + +def populating_layer_sites_query(layer, table_cols, col_names, datas): + """ + :param layer: Sites layer from the linked geopackage with attributes + :param table_cols: List of the columns used in the query + :param col_names: Name of the columns in the new layer + :param datas: Data from the query + :function: Population of the Sites layer using all the data from the query + :return list_cr: List of all the Context_Records linked to the Sites from the query + """ + max = len(col_names) + list_ope = [] + # Looping on all the datas extracted to create features + for data in datas: + # Creation of a new feature + feature = ogr.Feature(layer.GetLayerDefn()) + # Looping on the attributes to add them to the feature + for idx in range(0, max): + if col_names[idx] != '': + # print(table_cols[idx]) # debugtest + # print(data[idx + 1]) # debugtest + if table_cols[idx] == ['operations__code_patriarche'] and data[idx + 1] not in list_ope: + list_ope.append(data[idx + 1]) + feature.SetField(col_names[idx], str(data[idx + 1])) + elif table_cols[idx] in [['geodata__x'], ['geodata__y'], ['geodata__point_2d']]: + feature.SetField(col_names[idx], str(data[idx + 1]).split(' & ')[-1]) + else: + # +1 because the first value in the attributes is '' + feature.SetField(col_names[idx], str(data[idx + 1])) + ArchaeologicalSite = apps.get_model("archaeological_operations", "ArchaeologicalSite") + try: + id_label = table_cols.index(['name']) + label = data[id_label + 1] + object = ArchaeologicalSite.objects.filter( + name=label, + ) + except: + id_label = table_cols.index(['reference']) + label = data[id_label + 1] + object = ArchaeologicalSite.objects.filter( + reference=label, + ) + # Preparations for the geometry + print(object[0],object[0].main_geodata.x,object[0].main_geodata.y,object[0].main_geodata.point_2d) + try: + point = ogr.Geometry(ogr.wkbPoint) + point.AddPoint(float(object[0].main_geodata.x), float(object[0].main_geodata.y)) + except: + try: + point = ogr.CreateGeometryFromWkt(str(object[0].main_geodata.point_2d).split(';')[-1]) + except: + point = '' + if point != '': + feature.SetGeometry(point) + # Addition of the new feature + layer.CreateFeature(feature) + feature = None + ContextRecord = apps.get_model('archaeological_context_records', 'ContextRecord') + # Completion of the list of Context_Records linked to the extracted Sites + list_cr = [] + for elem in list_ope: + if elem != '': + search = ContextRecord.objects.all() + for cr in search: + if elem in str(cr) and cr.label not in list_cr: + list_cr.append(cr.label) + return list_ope, list_cr def modification_style(qgs_path, table_cols, col_names, list_ope, list_crea): + """ + :param qgs_path: Path to the QGIS project, containing the layers style + :param table_cols: List of the columns used in the query to spot specific ones + :param col_names: Name of the columns in the new layer to add their name to the style of the layer + :param list_ope: List of the Operations linked to the entities from the query, to add them as a list + :param list_crea: List of created attributes for the Finds or Context_Records layers + :function: Modification of the QGIS project style to assure the autocompletion/automations for some attributes + :return text: Modified QGIS project + """ # Lists of default names in the style, attribut names of the datas and new default names - list_ref = ['champ_date', 'champ_datetime', 'champ_x', 'champ_y', 'champ_z', 'champ_ue', - 'champ_ope', 'champ_insee', 'champ_section', 'champ_parc', 'champ_geom'] + list_ref = ['finds_date', 'finds_time', 'finds_x', 'finds_y', 'finds_z', 'finds_cr', 'finds_parcel', + 'cr_operation', 'cr_insee', 'cr_section', 'cr_parcel', 'cr_full_parcel', 'cr_wkt'] list_search = ['_date', '_datetime', 'base_finds__x', 'base_finds__y', 'base_finds__z', 'context_record__label', - 'operation__code_patriarche', 'town__numero_insee', 'parcel__section', 'parcel__parcel_number', - 'geodata__multi_polygon'] - list_auto = ['Date', 'Date/Temps', 'X', 'Y', 'Z', 'UE', 'Opération', 'INSEE_Commune', 'Section', 'Parcelle', 'WKT'] + 'parcel__external_id', 'operation__code_patriarche', 'town__numero_insee', 'parcel__section', + 'parcel__parcel_number', 'parcel__external_id', 'geodata__multi_polygon'] # Opening of the style text = open(qgs_path, encoding='utf-8').read() # Adding the different Operations linked of the Contexts Records and/or Finds exported to a list of possible values if len(list_ope) > 0: new_text = "" for ope in list_ope: - choice = ' \n'.format(ope, ope) + choice = '\n'.format(ope, ope) new_text += choice - old_text = ' \n' + old_text = '\n' text = text.replace(old_text, new_text) else: text = text.replace("Test_choice", "Null") @@ -3589,21 +3899,19 @@ def modification_style(qgs_path, table_cols, col_names, list_ope, list_crea): if col != '' and list_search[id_ref] in col[0]: id_new = table_cols.index(col) new = col_names[id_new] - if new == '': - new = list_auto[id_ref] text = text.replace(ref, new) # List of corresponding default names in the style linked to the default names used for the Finds - list_corr = ['champ_id', 'champ_ue', 'champ_date', 'champ_x', 'champ_y', 'champ_z', 'champ_matériaux', - 'champ_desc', 'champ_media_finds', 'champ_wkt_modif'] + list_corr = ['finds_id', 'finds_cr', 'finds_date', 'finds_x', 'finds_y', 'finds_z', 'find_matériaux', + 'cr_description', 'finds_media', 'finds_wkt_modif', 'finds_parcel'] # Gestion of the link between the Finds and Context Records layers id_label = table_cols.index(['label']) new = col_names[id_label] - text = text.replace("champ_nom", new) + text = text.replace("cr_name", new) if ['documents__image'] in table_cols: id_media = table_cols.index(['documents__image']) # Gestion of the link between the Finds and Context Records layers new = col_names[id_media] - text = text.replace("champ_media_cr", new) + text = text.replace("cr_media", new) # Replacement of the values from the default names used for the Finds n = 0 for elem in list_crea[1]: @@ -3619,12 +3927,10 @@ def modification_style(qgs_path, table_cols, col_names, list_ope, list_crea): if col != '' and list_search[id_ref] in col: id_new = table_cols.index(col) new = col_names[id_new] - if new == '': - new = list_auto[id_ref] text = text.replace(ref, new) # List of corresponding default names in the style linked to the default names used for the Finds - list_corr = ['champ_nom', 'champ_ope', 'champ_insee', 'champ_section', 'champ_parc', 'champ_type', 'champ_occup', 'champ_desc', - 'champ_loca', 'champ_media_cr', 'champ_periode', 'champ_acti', 'champ_geom'] + list_corr = ['cr_name', 'cr_operation', 'cr_insee', 'cr_type', 'cr_occupation', 'cr_description', + 'cr_localisation', 'cr_media', 'cr_periode', 'cr_activity', 'cr_wkt', 'cr_full_parcel'] # Test in case the all names of attributes are in lists try: id_label = table_cols.index(['label']) @@ -3632,7 +3938,7 @@ def modification_style(qgs_path, table_cols, col_names, list_ope, list_crea): id_label = table_cols.index('label') # Gestion of the link between the Finds and Context Records layers new = col_names[id_label] - text = text.replace('champ_id', new) + text = text.replace('finds_id', new) if 'documents__image' in table_cols: try: id_media = table_cols.index(['documents__image']) @@ -3640,15 +3946,15 @@ def modification_style(qgs_path, table_cols, col_names, list_ope, list_crea): id_media = table_cols.index('documents__image') # Gestion of the link between the Finds and Context Records layers new = col_names[id_media] - text = text.replace("champ_media_finds", new) + text = text.replace("finds_media", new) # Specific case to assure the good registration of the z coordinate if 'geodata__point_3d' in table_cols: id_new = table_cols.index('geodata__point_3d') if any('__z' in elem for elem in table_cols): - ref = "champ_wkt_modif" + ref = "finds_wkt_modif" new = col_names[id_new] else: - ref = "champ_wkt_simple" + ref = "finds_wkt_simple" new = col_names[id_new] text = text.replace(ref, new) # Replacement of the values from the default names used for the Context Records @@ -3662,6 +3968,48 @@ def modification_style(qgs_path, table_cols, col_names, list_ope, list_crea): return text +def modification_style_sites(qgs_path, table_cols, col_names, list_ope, list_crea): + """ + :param qgs_path: Path to the QGIS project, containing the layers style + :param table_cols: List of the columns used in the query to spot specific ones + :param col_names: Name of the columns in the new layer to add their name to the style of the layer + :param list_ope: List of the Operations linked to the entities from the query, to add them as a list + :param list_crea: List of created attributes for the Finds and Context_Records layers + :function: Modification of the QGIS project style to assure the autocompletion/automations for some attributes + :return text: Modified QGIS project + """ + list_ref = ['sites_operation', 'sites_parcel', 'sites_insee', 'sites_x', 'sites_y', 'sites_wkt'] + list_search = ['operations__code_patriarche', 'parcel__external_id', 'towns__numero_insee', 'geodata__x', + 'geodata__y', 'geodata__point_2d'] + # Opening of the style + text = open(qgs_path, encoding='utf-8').read() + # Adding the different Operations linked of the Contexts Records and/or Finds exported to a list of possible values + if len(list_ope) > 0: + new_text = "" + for ope in list_ope: + choice = '\n'.format(ope, ope) + new_text += choice + old_text = '\n' + text = text.replace(old_text, new_text) + else: + text = text.replace("Test_choice", 'None') + for ref in list_ref: + id_ref = list_ref.index(ref) + new = '' + for col in table_cols: + if col != '' and list_search[id_ref] in col: + id_new = table_cols.index(col) + new = col_names[id_new] + text = text.replace(ref, new) + list_ref = ['cr_name', 'cr_operation', 'cr_insee', 'cr_type', 'cr_occupation', 'cr_description', 'cr_localisation', + 'cr_media', 'cr_periode', 'cr_activity', 'cr_wkt', 'cr_full_parcel', 'finds_id', 'finds_cr', + 'finds_date', 'finds_x', 'finds_y', 'finds_z', 'find_matériaux', 'cr_description', 'finds_media', + 'finds_wkt_modif', 'finds_parcel'] + for id in range(0, len(list_crea)): + text = text.replace(list_ref[id], list_crea[id]) + return text + + def adapt_distant_search(params, src, model): if "search_vector" in params and params["search_vector"]: search_vector = params["search_vector"][0] -- cgit v1.2.3