37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
import pandas as pd
|
|
import geopandas as gpd
|
|
import numpy as np
|
|
import os
|
|
import pyproj
|
|
import matplotlib.pyplot as plt
|
|
from shapely import unary_union
|
|
from shapely.geometry import Point
|
|
from shapely.ops import linemerge
|
|
|
|
# === PARAMÈTRES ===
|
|
in_path = "in"
|
|
out_path = "out"
|
|
csv_file = "output.csv"
|
|
shapefile_name = "célé.shp"
|
|
|
|
# Step 1: Load CSV
|
|
df = pd.read_csv(os.path.join(out_path, csv_file), sep=";")
|
|
gdf_cele = gpd.read_file(os.path.join(in_path, shapefile_name))
|
|
|
|
geometry = [Point(xy) for xy in zip(df["Longitude_WGS"], df["Latitude_WGS"])]
|
|
gdf_points = gpd.GeoDataFrame(df, geometry=geometry)
|
|
gdf_points.set_crs(epsg=4326, inplace=True)
|
|
|
|
# geometry_proj = [Point(xy) for xy in zip(df["Lon_corr_v2"], df["Lat_corr_v2"])]
|
|
# gdf_points_proj = gpd.GeoDataFrame(df, geometry=geometry_proj)
|
|
# gdf_points_proj.set_crs(epsg=4326, inplace=True)
|
|
|
|
# Step 5: Plot
|
|
fig, ax = plt.subplots(figsize=(10, 10))
|
|
gdf_points.plot(ax=ax, color='red', markersize=20)
|
|
# gdf_points_proj.plot(ax=ax, color='blue', markersize=10)
|
|
gdf_cele.plot(ax=ax, edgecolor='black', linewidth=1)
|
|
|
|
plt.title("CSV Points on Map")
|
|
plt.grid(True)
|
|
plt.show() |