diff --git a/src/app/projects/[id]/page.js b/src/app/projects/[id]/page.js index ff56570..29db470 100644 --- a/src/app/projects/[id]/page.js +++ b/src/app/projects/[id]/page.js @@ -19,6 +19,7 @@ import ProjectAssigneeDropdown from "@/components/ProjectAssigneeDropdown"; import ClientProjectMap from "@/components/ui/ClientProjectMap"; import FileUploadBox from "@/components/FileUploadBox"; import FileItem from "@/components/FileItem"; +import proj4 from "proj4"; export default function ProjectViewPage() { const params = useParams(); @@ -467,6 +468,41 @@ export default function ProjectViewPage() { /> + { + // Define EPSG:2180 projection (Poland CS92) + proj4.defs("EPSG:2180", "+proj=tmerc +lat_0=0 +lon_0=19 +k=0.9993 +x_0=500000 +y_0=-5300000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"); + + const [lat, lng] = project.coordinates.split(',').map(c => parseFloat(c.trim())); + + // Convert WGS84 to EPSG:2180 + const [x, y] = proj4('EPSG:4326', 'EPSG:2180', [lng, lat]); + + // Create bbox with ~100m offset in each direction + const offset = 100; + const bbox = `${x - offset},${y - offset},${x + offset},${y + offset}`; + + return `https://mapy.geoportal.gov.pl/imap/Imgp_2.html?gpmap=gp0&bbox=${bbox}&variant=KATASTER`; + })()} + target="_blank" + rel="noopener noreferrer" + className="text-green-600 hover:text-green-800 transition-colors" + title="Otwórz w Geoportal" + > + + + + )} {project.notes && (