forked from MapComplete/MapComplete
		
	Merge branch 'master' into develop
This commit is contained in:
		
						commit
						f0c9b1da5d
					
				
					 2 changed files with 10 additions and 6 deletions
				
			
		| 
						 | 
					@ -68,16 +68,17 @@ export class BBox {
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    static get(feature: Feature): BBox {
 | 
					    static get(feature: Feature): BBox {
 | 
				
			||||||
        const f = <any>feature
 | 
					        if (feature.bbox?.["overlapsWith"] === undefined) {
 | 
				
			||||||
        if (f.bbox?.overlapsWith === undefined) {
 | 
					 | 
				
			||||||
            const [minX, minY, maxX, maxY]: number[] = turf.bbox(feature)
 | 
					            const [minX, minY, maxX, maxY]: number[] = turf.bbox(feature)
 | 
				
			||||||
            // Note: x is longitude
 | 
					            // Note: x is longitude
 | 
				
			||||||
            f["bbox"] = new BBox([
 | 
					            // @ts-ignore
 | 
				
			||||||
 | 
					            feature["bbox"] = new BBox([
 | 
				
			||||||
                [minX, minY],
 | 
					                [minX, minY],
 | 
				
			||||||
                [maxX, maxY],
 | 
					                [maxX, maxY],
 | 
				
			||||||
            ])
 | 
					            ])
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return f["bbox"]
 | 
					        // @ts-ignore
 | 
				
			||||||
 | 
					        return feature["bbox"]
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    static bboxAroundAll(bboxes: BBox[]): BBox {
 | 
					    static bboxAroundAll(bboxes: BBox[]): BBox {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,12 +10,13 @@ import {
 | 
				
			||||||
    MultiPolygon,
 | 
					    MultiPolygon,
 | 
				
			||||||
    Point,
 | 
					    Point,
 | 
				
			||||||
    Polygon,
 | 
					    Polygon,
 | 
				
			||||||
    Position,
 | 
					    Position
 | 
				
			||||||
} from "geojson"
 | 
					} from "geojson"
 | 
				
			||||||
import { Tiles } from "../Models/TileRange"
 | 
					import { Tiles } from "../Models/TileRange"
 | 
				
			||||||
import { Utils } from "../Utils"
 | 
					import { Utils } from "../Utils"
 | 
				
			||||||
import { NearestPointOnLine } from "@turf/nearest-point-on-line"
 | 
					import { NearestPointOnLine } from "@turf/nearest-point-on-line"
 | 
				
			||||||
;("use strict")
 | 
					
 | 
				
			||||||
 | 
					("use strict")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export class GeoOperations {
 | 
					export class GeoOperations {
 | 
				
			||||||
    private static readonly _earthRadius = 6378137
 | 
					    private static readonly _earthRadius = 6378137
 | 
				
			||||||
| 
						 | 
					@ -365,6 +366,7 @@ export class GeoOperations {
 | 
				
			||||||
    ): Feature<LineString | MultiLineString> {
 | 
					    ): Feature<LineString | MultiLineString> {
 | 
				
			||||||
        if (way.geometry.type === "Polygon") {
 | 
					        if (way.geometry.type === "Polygon") {
 | 
				
			||||||
            return <Feature<LineString>>{
 | 
					            return <Feature<LineString>>{
 | 
				
			||||||
 | 
					                type: "Feature",
 | 
				
			||||||
                geometry: {
 | 
					                geometry: {
 | 
				
			||||||
                    type: "LineString",
 | 
					                    type: "LineString",
 | 
				
			||||||
                    coordinates: way.geometry.coordinates[0],
 | 
					                    coordinates: way.geometry.coordinates[0],
 | 
				
			||||||
| 
						 | 
					@ -374,6 +376,7 @@ export class GeoOperations {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (way.geometry.type === "MultiPolygon") {
 | 
					        if (way.geometry.type === "MultiPolygon") {
 | 
				
			||||||
            return <Feature<MultiLineString>>{
 | 
					            return <Feature<MultiLineString>>{
 | 
				
			||||||
 | 
					                type: "Feature",
 | 
				
			||||||
                geometry: {
 | 
					                geometry: {
 | 
				
			||||||
                    type: "MultiLineString",
 | 
					                    type: "MultiLineString",
 | 
				
			||||||
                    coordinates: way.geometry.coordinates[0],
 | 
					                    coordinates: way.geometry.coordinates[0],
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue