-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from OpenTUT/dev/hori
Dev/hori
- Loading branch information
Showing
20 changed files
with
747 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"type": "Feature", | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [137.4107966501511, 34.70147952212507] | ||
}, | ||
"properties": { | ||
"id": "A", | ||
"name": "A棟", | ||
"group": "A棟群", | ||
"children": [] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"type": "Feature", | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [137.4099895714767, 34.701472416386935] | ||
}, | ||
"properties": { | ||
"id": "B", | ||
"name": "B棟", | ||
"group": "B棟群", | ||
"children": [] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"type": "Feature", | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [137.40919805357822, 34.70132965904622] | ||
}, | ||
"properties": { | ||
"id": "C", | ||
"name": "C棟", | ||
"group": "C棟群", | ||
"children": [] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"type": "Feature", | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [137.40852824912162, 34.701199113103456] | ||
}, | ||
"properties": { | ||
"id": "D", | ||
"name": "D棟", | ||
"group": "D棟群", | ||
"children": [] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"type": "Feature", | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [137.4086942651799, 34.70254826387874] | ||
}, | ||
"properties": { | ||
"id": "E", | ||
"name": "E棟", | ||
"group": "E棟群", | ||
"children": [] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"type": "Feature", | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [137.40783131817489, 34.70114294470298] | ||
}, | ||
"properties": { | ||
"id": "F", | ||
"name": "F棟", | ||
"group": "F棟群", | ||
"children": [] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"type": "Feature", | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [137.40731180558197, 34.70113561354714] | ||
}, | ||
"properties": { | ||
"id": "G", | ||
"name": "G研究棟", | ||
"group": "G棟群", | ||
"children": [] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,47 @@ | ||
import { glob } from 'glob'; | ||
import { readFile, writeFile } from 'node:fs/promises'; | ||
import { join } from 'node:path'; | ||
import { z } from 'zod'; | ||
import { glob } from "glob"; | ||
import { readFile, writeFile } from "node:fs/promises"; | ||
import { join } from "node:path"; | ||
import { z } from "zod"; | ||
|
||
const Children = z.object({ | ||
name: z.string(), | ||
description: z.string(), | ||
url: z.string(), | ||
src: z.string(), | ||
room: z.string(), | ||
/* date: z.string(), | ||
room: z.string(), */ | ||
}); | ||
|
||
const GeoJSON = z.object({ | ||
type: z.literal('Feature'), | ||
type: z.literal("Feature"), | ||
geometry: z.object({ | ||
type: z.literal('Point'), | ||
type: z.literal("Point"), | ||
coordinates: z.array(z.number()).length(2), | ||
}), | ||
properties: z.object({ | ||
id: z.number(), | ||
id: z.union([z.string(), z.number()]), | ||
name: z.string(), | ||
group: z.string(), | ||
children: z.array(Children), | ||
}), | ||
}); | ||
|
||
const features = await Promise.all( | ||
(await glob(join(import.meta.dirname, 'buildings/*.geojson'))).map( | ||
async (path) => { | ||
const geojson = await readFile(path) | ||
.then((res) => res.toString()) | ||
.then((res) => JSON.parse(res)); | ||
return GeoJSON.parse(geojson); | ||
}, | ||
), | ||
( | ||
await glob(join(import.meta.dirname, "buildings/*.geojson")) | ||
).map(async (path) => { | ||
const geojson = await readFile(path) | ||
.then((res) => res.toString()) | ||
.then((res) => JSON.parse(res)); | ||
return GeoJSON.parse(geojson); | ||
}) | ||
); /* .filter((feature) => feature.properties.children.length > 0); */ | ||
|
||
await writeFile( | ||
join(import.meta.dirname, 'public/buildings.geojson'), | ||
join(import.meta.dirname, "public/buildings.geojson"), | ||
JSON.stringify({ | ||
type: 'FeatureCollection', | ||
type: "FeatureCollection", | ||
features, | ||
}), | ||
}) | ||
); |
Oops, something went wrong.