Fotis Zapantis
09/23/2025, 1:49 PMFil
09/23/2025, 2:20 PMFotis Zapantis
09/23/2025, 2:21 PMaaronkyle
09/23/2025, 3:07 PMFotis Zapantis
09/23/2025, 3:09 PMaaronkyle
09/23/2025, 3:28 PMaaronkyle
09/23/2025, 3:33 PMogr2ogr -f "ESRI Shapefile" out_utf8.shp dhmosia_kthria.shp -lco ENCODING=UTF-8Fotis Zapantis
09/23/2025, 3:36 PMFotis Zapantis
09/23/2025, 3:38 PMaaronkyle
09/23/2025, 4:07 PMasync function shapefileZipToGeoJSON(zipBuffer, { encoding = "windows-1253" } = {}) {
const files = fflate.unzipSync(zipBuffer instanceof Uint8Array ? zipBuffer : new Uint8Array(zipBuffer));
const names = Object.keys(files);
if (!names.length) throw new Error("Empty ZIP.");
const shpName = names.find(n => n.toLowerCase().endsWith(".shp"));
const dbfName = names.find(n => n.toLowerCase().endsWith(".dbf"));
if (!shpName || !dbfName) throw new Error("ZIP must contain one .shp and one .dbf.");
const toStream = (u8) => new Response(u8).body;
const src = await shapefile.open(toStream(files[shpName]), toStream(files[dbfName]), { encoding });
const features = [];
for (;;) {
const { done, value } = await src.read();
if (done) break;
features.push(value);
}
return { type: "FeatureCollection", features };
}aaronkyle
09/23/2025, 4:07 PMaaronkyle
09/23/2025, 4:08 PMFotis Zapantis
09/23/2025, 4:09 PMaaronkyle
09/23/2025, 4:09 PMFotis Zapantis
09/23/2025, 4:09 PMaaronkyle
09/23/2025, 4:10 PMaaronkyle
09/23/2025, 4:10 PMaaronkyle
09/23/2025, 4:11 PMFotis Zapantis
09/23/2025, 4:46 PMFil
09/23/2025, 4:58 PMaaronkyle
09/23/2025, 5:02 PMFotis Zapantis
09/23/2025, 5:04 PMFil
09/23/2025, 5:07 PMFotis Zapantis
09/24/2025, 6:45 AMFotis Zapantis
09/24/2025, 6:46 AMFil
09/24/2025, 7:29 AMPlot.plot({
// Initialize the plot
projection: { type: "reflect-y", domain: hydrocountiesEPSG4326GR }, // Set the projection
width,
marks: [
Plot.geo(hydrocountiesEPSG4326GR, { fill: "lightblue", stroke: "darkblue" }), // Add the county boundaries
Plot.geo(
hydrocountiesEPSG4326GR,
Plot.pointer(Plot.centroid({ stroke: "yellow" }))
),
Plot.dot(hydrocountiesEPSG4326GR.features, Plot.centroid({fill: "red", stroke: "white"})),
Plot.tip(
hydrocountiesEPSG4326GR.features,
Plot.pointer(Plot.centroid({ title: (d) => d.properties.rbdnamenl }))
)
]
})Fotis Zapantis
09/24/2025, 7:33 AMFil
09/24/2025, 7:39 AM"identity" or "reflect-y" , depending on whether y points down or up.Fil
09/24/2025, 7:40 AMFotis Zapantis
09/24/2025, 9:20 AMFil
09/24/2025, 9:23 AMFil
09/24/2025, 9:24 AMFotis Zapantis
09/24/2025, 9:24 AMFotis Zapantis
09/24/2025, 11:25 AM