forked from MapComplete/MapComplete
Add direction:centerpoint as calculated tag; improve typing of geoOperations.ts
This commit is contained in:
parent
4b6b709b4b
commit
4521889909
2 changed files with 37 additions and 3 deletions
|
@ -13,7 +13,7 @@ import {
|
|||
Polygon,
|
||||
Properties,
|
||||
} from "@turf/turf"
|
||||
import {GeoJSON, LineString} from "geojson";
|
||||
import {GeoJSON, LineString, Point} from "geojson";
|
||||
|
||||
export class GeoOperations {
|
||||
private static readonly _earthRadius = 6378137
|
||||
|
@ -27,8 +27,8 @@ export class GeoOperations {
|
|||
* Converts a GeoJson feature to a point GeoJson feature
|
||||
* @param feature
|
||||
*/
|
||||
static centerpoint(feature: any) {
|
||||
const newFeature = turf.center(feature)
|
||||
static centerpoint(feature: any): Feature<Point> {
|
||||
const newFeature : Feature<Point> = turf.center(feature)
|
||||
newFeature.properties = feature.properties
|
||||
newFeature.id = feature.id
|
||||
return newFeature
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue