geojson
解説
対訳ver.
これも参考になる
JSON schema
Type Definition
main
code:mod.ts
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
import { Geometry } from "./geometry.ts";
import { GeometryCollection } from "./geometryCollection.ts";
import { Feature } from "./feature.ts";
import { FeatureCollection } from "./featureCollection.ts";
export type GeoJSON =
| Geometry
| GeometryCollection
| Feature
| FeatureCollection;
point
code:point.ts
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
import { BBox } from "./bbox.ts";
import { AtLeast } from "./utils.ts";
export interface Point {
type: "Point";
coordinates: AtLeast<2, number>;
bbox?: BBox;
}
bboxはobjectが収まる最小の矩形
line string
code:lineString.ts
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
import { BBox } from "./bbox.ts";
import { AtLeast } from "./utils.ts";
export interface LineString {
type: "LineString";
coordinates: AtLeast<2, AtLeast<2, number>>;
bbox?: BBox;
}
polygon
code:polygon.ts
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
import { BBox } from "./bbox.ts";
import { AtLeast } from "./utils.ts";
export interface Polygon {
type: "Polygon";
coordinates: AtLeast<4, AtLeast<2, number>>;
bbox?: BBox;
}
multi point
code:multiPoint.ts
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
import { BBox } from "./bbox.ts";
import { AtLeast } from "./utils.ts";
export interface MultiPoint {
type: "MultiPoint";
coordinates: AtLeast<2, number>[];
bbox?: BBox;
}
multi line string
code:multiLineString.ts
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
import { BBox } from "./bbox.ts";
import { AtLeast } from "./utils.ts";
export interface MultiLineString {
type: "MultiLineString";
coordinates: AtLeast<2, AtLeast<2, number>>[];
bbox?: BBox;
}
multi polygon
code:multiPolygon.ts
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
import { BBox } from "./bbox.ts";
import { AtLeast } from "./utils.ts";
export interface MultiPolygon {
type: "MultiPolygon";
coordinates: AtLeast<4, AtLeast<2, number>>[];
bbox?: BBox;
}
geometry
code:geometry.ts
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
import { Point } from "./point.ts";
import { LineString } from "./lineString.ts";
import { Polygon } from "./polygon.ts";
import { MultiPoint } from "./multiPoint.ts";
import { MultiLineString } from "./multiLineString.ts";
import { MultiPolygon } from "./multiPolygon.ts";
export type Geometry =
| Point
| LineString
| Polygon
| MultiPoint
| MultiLineString
| MultiPolygon;
geometry collection
code:geometryCollection.ts
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
import { BBox } from "./bbox.ts";
import { Geometry } from "./geometry.ts";
export interface GeometryCollection {
type: "GeometryCollection";
geometries: Geometry[];
bbox?: BBox;
}
feature
code:feature.ts
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
import { BBox } from "./bbox.ts";
import { Geometry } from "./geometry.ts";
import { GeometryCollection } from "./geometryCollection.ts";
export interface Feature {
type: "Feature";
id?: number | string;
properties: Record<string, unknown> | null;
geometry:
| null
| Geometry
| GeometryCollection;
bbox?: BBox;
}
feature collection
code:featureCollection.ts
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
import { BBox } from "./bbox.ts";
import { Feature } from "./feature.ts";
export interface FeatureCollection {
type: "FeatureCollection";
features: Feature[];
bbox?: BBox;
}
bbox
bboxはobjectが収まる最小の矩形
code:bbox.ts
import { AtLeast } from "./utils.ts";
export type BBox = AtLeast<4, number>;
utilities
code:utils.ts
type Append<Elm, T extends unknown[]> = ((
arg: Elm,
...rest: T
) => void) extends ((...args: infer T2) => void)
? T2
: never;
export type AtLeast<N extends number, T> = AtLeastRec<N, T, T[], []>;
type AtLeastRec<Num, Elm, T extends unknown[], C extends unknown[]> = {
0: T;
1: AtLeastRec<Num, Elm, Append<Elm, T>, Append<unknown, C>>;