forked from MapComplete/MapComplete
docs: improve typing
This commit is contained in:
parent
750a0620e9
commit
e9797fbd39
1 changed files with 4 additions and 3 deletions
|
@ -234,10 +234,11 @@ export class GeoOperations {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
static bbox(feature: any) {
|
static bbox(feature: any): Feature<LineString, {}> {
|
||||||
const [lon, lat, lon0, lat0] = turf.bbox(feature)
|
const [lon, lat, lon0, lat0] = turf.bbox(feature)
|
||||||
return {
|
return {
|
||||||
type: "Feature",
|
type: "Feature",
|
||||||
|
properties: {},
|
||||||
geometry: {
|
geometry: {
|
||||||
type: "LineString",
|
type: "LineString",
|
||||||
coordinates: [
|
coordinates: [
|
||||||
|
@ -652,7 +653,7 @@ export class GeoOperations {
|
||||||
public static clipWith(toSplit: Feature, boundary: Feature<Polygon>): Feature[] {
|
public static clipWith(toSplit: Feature, boundary: Feature<Polygon>): Feature[] {
|
||||||
if (toSplit.geometry.type === "Point") {
|
if (toSplit.geometry.type === "Point") {
|
||||||
const p = <Feature<Point>>toSplit
|
const p = <Feature<Point>>toSplit
|
||||||
if (GeoOperations.inside(p.geometry.coordinates, boundary)) {
|
if (GeoOperations.inside(<[number, number]>p.geometry.coordinates, boundary)) {
|
||||||
return [p]
|
return [p]
|
||||||
} else {
|
} else {
|
||||||
return []
|
return []
|
||||||
|
@ -687,7 +688,7 @@ export class GeoOperations {
|
||||||
x: number,
|
x: number,
|
||||||
y: number,
|
y: number,
|
||||||
coordinates: [number, number][][]
|
coordinates: [number, number][][]
|
||||||
) {
|
): boolean {
|
||||||
const inside = GeoOperations.pointWithinRing(
|
const inside = GeoOperations.pointWithinRing(
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
|
|
Loading…
Reference in a new issue