diff --git a/AtelierD_Champs.py b/AtelierD_Champs.py index 89ebbe1d3b1274045531bac15b37e405ae3c71b1..b32ab8ee2f05f706a7aca61729d0791c5bb37f97 100644 --- a/AtelierD_Champs.py +++ b/AtelierD_Champs.py @@ -63,21 +63,22 @@ def lecture_shape(chemin, trace=False): # exemple de format GeoJSON{'type': 'LineString', 'coordinates': ((0.0, 0.0), (25.0, 10.0), (50.0, 50.0))} # https://gist.github.com/drmalex07/5a54fc4f1db06a66679e + alukach commented on 1 Aug 2017 + objet_shapely = shape(first) + # tracé vite fait si demandé if trace: - fig, ax = plt.subplots(111) + fig, ax = plt.subplots() fig.suptitle(f"fichier shape de {os.path.splitext(os.path.basename(chemin))[0]} (\n on a cherché 1 élément)") fig.tight_layout(rect=[0, 0.03, 1, 0.90]) - ax = fig.add_subplot(111) - x, y = shape(first).exterior.xy + x, y = objet_shapely.exterior.xy ax.plot(x, y, color='darkblue', alpha=0.7, linewidth=1, solid_capstyle='round', zorder=3) - ax.set_xticks(rotation=45) + ax.tick_params(axis='x', rotation=45) ax.axis('equal') # repère orthonormé fig.show() # Convert to shapely Polygon - return shape(first) + return objet_shapely else: print("Problème de lecture") @@ -133,11 +134,10 @@ def lecture_shape_plusieurs_elements(chemin_fichier_shape, trace=False): print("Problème, aucun objet génométrique n'a été détecté dans le fichier shape" ) else: if trace: - fig, ax = plt.subplots(111) + fig, ax = plt.subplots() fig.suptitle(f"fichier shape de {os.path.splitext(os.path.basename(chemin_fichier_shape))[0]}" ) fig.tight_layout(rect=[0, 0.03, 1, 0.90]) - ax = fig.add_subplot(111) for x, y in liste_xy: ax.plot(x, y, color='darkblue', alpha=0.7, linewidth=1, solid_capstyle='round', zorder=3) @@ -573,6 +573,7 @@ class Champ: f"La matrice de valeurs est vide, problème de lecture ; pour info, {nb_informations} mots-clés sur 8 ont été trouvés") def test_trace_matrice_valeurs(self): + # tracer champ de valeur seul #cax = plt.imshow(self.matrice_valeurs) fig, (ax, ax_extent) = plt.subplots(ncols=2, nrows=1) fig.suptitle("D'une matrice à une carte de champ") @@ -670,6 +671,7 @@ class Champ: def ecrire_grid(self, nom_fichier=None): """ + todo : METHODE A READAPTER AU CODE POUR L'ATELIER http://gsp.humboldt.edu/OLM/Courses/GSP_318/02_X_5_WritingGridASCII.html Go into "Properties" for the layer, select the "Symbology" tab and select "Custom" for the "Stretch Type". When you click "OK" you should see the raster :param nom_fichier: