forked from MapComplete/MapComplete
Fix typing and build
This commit is contained in:
parent
336ebc4ea9
commit
5f1a7892c1
6 changed files with 20 additions and 19 deletions
|
@ -3,11 +3,11 @@
|
|||
*/
|
||||
import { UIEventSource } from "./UIEventSource"
|
||||
import { GeoJSONObject } from "@turf/turf"
|
||||
import {Feature, Point} from "geojson";
|
||||
import {Feature, Geometry, Point} from "geojson";
|
||||
import {OsmTags} from "../Models/OsmFeature";
|
||||
|
||||
export class ElementStorage {
|
||||
public ContainingFeatures = new Map<string, Feature<Point, OsmTags >>()
|
||||
public ContainingFeatures = new Map<string, Feature<Geometry, OsmTags >>()
|
||||
private _elements = new Map<string, UIEventSource<any>>()
|
||||
|
||||
constructor() {}
|
||||
|
|
|
@ -27,7 +27,7 @@ class MetatagUpdater {
|
|||
const self = this
|
||||
this.params = {
|
||||
getFeatureById(id) {
|
||||
return state.allElements.ContainingFeatures.get(id)
|
||||
return <any> state.allElements.ContainingFeatures.get(id)
|
||||
},
|
||||
getFeaturesWithin(layerId, bbox) {
|
||||
// We keep track of the BBOX that this source needs
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
MultiPolygon,
|
||||
Polygon,
|
||||
} from "@turf/turf"
|
||||
import { LineString, Point } from "geojson"
|
||||
import {GeoJSON, LineString, Point} from "geojson"
|
||||
import togpx from "togpx"
|
||||
import Constants from "../Models/Constants"
|
||||
|
||||
|
@ -37,8 +37,8 @@ export class GeoOperations {
|
|||
* Returns [lon,lat] coordinates
|
||||
* @param feature
|
||||
*/
|
||||
static centerpointCoordinates(feature: AllGeoJSON): [number, number] {
|
||||
return <[number, number]>turf.center(feature).geometry.coordinates
|
||||
static centerpointCoordinates(feature: AllGeoJSON | GeoJSON): [number, number] {
|
||||
return <[number, number]>turf.center(<any> feature).geometry.coordinates
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,7 +6,6 @@ import { ChangeDescription, ChangeDescriptionTools } from "./Actions/ChangeDescr
|
|||
import {Utils} from "../../Utils"
|
||||
import {LocalStorageSource} from "../Web/LocalStorageSource"
|
||||
import SimpleMetaTagger from "../SimpleMetaTagger"
|
||||
import CreateNewNodeAction from "./Actions/CreateNewNodeAction"
|
||||
import FeatureSource from "../FeatureSource/FeatureSource"
|
||||
import {ElementStorage} from "../ElementStorage"
|
||||
import {GeoLocationPointProperties} from "../Actors/GeoLocationHandler"
|
||||
|
|
|
@ -22,6 +22,8 @@ import { TiledStaticFeatureSource } from "../FeatureSource/Sources/StaticFeature
|
|||
import { Translation, TypedTranslation } from "../../UI/i18n/Translation"
|
||||
import { Tag } from "../Tags/Tag"
|
||||
import { OsmConnection } from "../Osm/OsmConnection"
|
||||
import {Feature, GeoJSON, LineString} from "geojson";
|
||||
import {OsmTags} from "../../Models/OsmFeature";
|
||||
|
||||
export interface GlobalFilter {
|
||||
filter: FilterState
|
||||
|
@ -320,7 +322,7 @@ export default class MapState extends UserRelatedState {
|
|||
return []
|
||||
}
|
||||
|
||||
const feature = {
|
||||
const feature : Feature<LineString, OsmTags> = {
|
||||
type: "Feature",
|
||||
properties: {
|
||||
id: "location_track",
|
||||
|
|
|
@ -121,7 +121,7 @@ export default class SplitRoadWizard extends Toggle {
|
|||
}
|
||||
|
||||
// Get nearest point on the road
|
||||
const pointOnRoad = GeoOperations.nearestPoint(roadElement, coordinates) // pointOnRoad is a geojson
|
||||
const pointOnRoad = GeoOperations.nearestPoint(<any> roadElement, coordinates) // pointOnRoad is a geojson
|
||||
|
||||
// Update point properties to let it match the layer
|
||||
pointOnRoad.properties["_split_point"] = "yes"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue