forked from MapComplete/MapComplete
Merge branch 'master' into develop
This commit is contained in:
commit
93bbd5d0b8
44 changed files with 1522 additions and 378 deletions
|
@ -76,10 +76,18 @@ export class GeoOperations {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns [lon,lat] coordinates
|
||||
* Returns [lon,lat] coordinates.
|
||||
* @param feature
|
||||
*
|
||||
* GeoOperations.centerpointCoordinates(undefined) // => undefined
|
||||
*/
|
||||
static centerpointCoordinates(feature: undefined | null): undefined ;
|
||||
static centerpointCoordinates(feature: AllGeoJSON | GeoJSON | undefined): [number, number] | undefined;
|
||||
static centerpointCoordinates(feature: NonNullable< AllGeoJSON> | NonNullable<GeoJSON>): NonNullable<[number, number]>;
|
||||
static centerpointCoordinates(feature: AllGeoJSON | GeoJSON): [number, number] {
|
||||
if(feature === undefined || feature === null){
|
||||
return undefined
|
||||
}
|
||||
return <[number, number]>turf.center(<any>feature).geometry.coordinates
|
||||
}
|
||||
|
||||
|
|
|
@ -170,6 +170,9 @@ export class ImageUploadManager {
|
|||
}
|
||||
if (location === undefined || location?.some((l) => l === undefined)) {
|
||||
feature ??= this._indexedFeatures.featuresById.data.get(featureId)
|
||||
if(feature === undefined){
|
||||
throw "ImageUploadManager: no feature given and no feature found in the indexedFeature. Cannot upload this image"
|
||||
}
|
||||
location = GeoOperations.centerpointCoordinates(feature)
|
||||
}
|
||||
try {
|
||||
|
|
|
@ -2,7 +2,7 @@ import ChangeTagAction from "./ChangeTagAction"
|
|||
import { Tag } from "../../Tags/Tag"
|
||||
import OsmChangeAction from "./OsmChangeAction"
|
||||
import { ChangeDescription } from "./ChangeDescription"
|
||||
import { Store, UIEventSource } from "../../UIEventSource"
|
||||
import { UIEventSource } from "../../UIEventSource"
|
||||
|
||||
export default class LinkImageAction extends OsmChangeAction {
|
||||
private readonly _proposedKey: "image" | "mapillary" | "wiki_commons" | string
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue