forked from MapComplete/MapComplete
chore: automated housekeeping...
This commit is contained in:
parent
70934b3b8e
commit
e1be5ec34d
110 changed files with 507 additions and 288 deletions
|
@ -14,7 +14,11 @@ import Link from "../../UI/Base/Link"
|
|||
export default class PanoramaxImageProvider extends ImageProvider {
|
||||
public static readonly singleton = new PanoramaxImageProvider()
|
||||
private static readonly xyz = new PanoramaxXYZ()
|
||||
private static defaultPanoramax = new AuthorizedPanoramax(Constants.panoramax.url, Constants.panoramax.token, 3000)
|
||||
private static defaultPanoramax = new AuthorizedPanoramax(
|
||||
Constants.panoramax.url,
|
||||
Constants.panoramax.token,
|
||||
3000
|
||||
)
|
||||
|
||||
public defaultKeyPrefixes: string[] = ["panoramax"]
|
||||
public readonly name: string = "panoramax"
|
||||
|
@ -48,7 +52,7 @@ export default class PanoramaxImageProvider extends ImageProvider {
|
|||
* @param id
|
||||
* @private
|
||||
*/
|
||||
private async getInfoFromMapComplete(id: string): Promise<{ data: ImageData, url: string }> {
|
||||
private async getInfoFromMapComplete(id: string): Promise<{ data: ImageData; url: string }> {
|
||||
const url = `https://panoramax.mapcomplete.org/`
|
||||
const data = await PanoramaxImageProvider.defaultPanoramax.imageInfo(id)
|
||||
return { url, data }
|
||||
|
@ -138,16 +142,14 @@ export default class PanoramaxImageProvider extends ImageProvider {
|
|||
)
|
||||
}
|
||||
|
||||
Stores.Chronic(1500, () =>
|
||||
hasLoading(source.data),
|
||||
).addCallback(_ => {
|
||||
super.getRelevantUrlsFor(tags, prefixes).then(data => {
|
||||
Stores.Chronic(1500, () => hasLoading(source.data)).addCallback((_) => {
|
||||
super.getRelevantUrlsFor(tags, prefixes).then((data) => {
|
||||
source.set(data)
|
||||
return !hasLoading(data)
|
||||
})
|
||||
})
|
||||
|
||||
return Stores.ListStabilized( source)
|
||||
return Stores.ListStabilized(source)
|
||||
}
|
||||
|
||||
public async DownloadAttribution(providedImage: {
|
||||
|
@ -195,24 +197,28 @@ export class PanoramaxUploader implements ImageUploader {
|
|||
let datetime = new Date().toISOString()
|
||||
try {
|
||||
const tags = await ExifReader.load(blob)
|
||||
const [[latD], [latM], [latS, latSDenom]] =<[[number,number],[number,number],[number,number]]> tags?.GPSLatitude.value
|
||||
const [[lonD], [lonM], [lonS, lonSDenom]] =<[[number,number],[number,number],[number,number]]> tags?.GPSLongitude.value
|
||||
const [[latD], [latM], [latS, latSDenom]] = <
|
||||
[[number, number], [number, number], [number, number]]
|
||||
>tags?.GPSLatitude.value
|
||||
const [[lonD], [lonM], [lonS, lonSDenom]] = <
|
||||
[[number, number], [number, number], [number, number]]
|
||||
>tags?.GPSLongitude.value
|
||||
lat = latD + latM / 60 + latS / (3600 * latSDenom)
|
||||
lon = lonD + lonM / 60 + lonS / ( 3600 * lonSDenom)
|
||||
lon = lonD + lonM / 60 + lonS / (3600 * lonSDenom)
|
||||
|
||||
const [date, time] = tags.DateTime.value[0].split(" ")
|
||||
datetime = new Date(date.replaceAll(":", "-")+"T"+time).toISOString()
|
||||
datetime = new Date(date.replaceAll(":", "-") + "T" + time).toISOString()
|
||||
|
||||
console.log("Tags are", tags)
|
||||
} catch (e) {
|
||||
console.error("Could not read EXIF-tags")
|
||||
}
|
||||
|
||||
|
||||
const p = this.panoramax
|
||||
sequenceId ??= this._targetSequence?.data ?? Constants.panoramax.sequence
|
||||
const sequence: {id: string, "stats:items":{count:number}} =
|
||||
(await p.mySequences()).find(s => s.id === sequenceId)
|
||||
const sequence: { id: string; "stats:items": { count: number } } = (
|
||||
await p.mySequences()
|
||||
).find((s) => s.id === sequenceId)
|
||||
const img = <ImageData>await p.addImage(blob, sequence, {
|
||||
lon,
|
||||
lat,
|
||||
|
|
|
@ -300,14 +300,19 @@ export class Changes {
|
|||
newObjects: OsmObject[]
|
||||
modifiedObjects: OsmObject[]
|
||||
deletedObjects: OsmObject[]
|
||||
}{
|
||||
return Changes.createChangesetObjectsStatic(changes, downloadedOsmObjects, ignoreNoCreate, this.previouslyCreated)
|
||||
} {
|
||||
return Changes.createChangesetObjectsStatic(
|
||||
changes,
|
||||
downloadedOsmObjects,
|
||||
ignoreNoCreate,
|
||||
this.previouslyCreated
|
||||
)
|
||||
}
|
||||
public static createChangesetObjectsStatic(
|
||||
changes: ChangeDescription[],
|
||||
downloadedOsmObjects: OsmObject[],
|
||||
ignoreNoCreate: boolean = false,
|
||||
previouslyCreated : OsmObject[]
|
||||
previouslyCreated: OsmObject[]
|
||||
): {
|
||||
newObjects: OsmObject[]
|
||||
modifiedObjects: OsmObject[]
|
||||
|
|
|
@ -73,20 +73,26 @@ export default class CoordinateSearch implements GeocodingProvider {
|
|||
(m) => CoordinateSearch.asResult(m[2], m[1], "latlon")
|
||||
)
|
||||
|
||||
const matchesLonLat = Utils.NoNull(CoordinateSearch.lonLatRegexes.map(r => query.match(r)))
|
||||
.map(m => CoordinateSearch.asResult(m[1], m[2], "lonlat"))
|
||||
const matchesLonLat = Utils.NoNull(
|
||||
CoordinateSearch.lonLatRegexes.map((r) => query.match(r))
|
||||
).map((m) => CoordinateSearch.asResult(m[1], m[2], "lonlat"))
|
||||
const init = matches.concat(matchesLonLat)
|
||||
if (init.length > 0) {
|
||||
return init
|
||||
}
|
||||
|
||||
try {
|
||||
const c = new CoordinateParser(query);
|
||||
return [CoordinateSearch.asResult(""+c.getLongitude(), ""+c.getLatitude(), "coordinateParser")]
|
||||
const c = new CoordinateParser(query)
|
||||
return [
|
||||
CoordinateSearch.asResult(
|
||||
"" + c.getLongitude(),
|
||||
"" + c.getLatitude(),
|
||||
"coordinateParser"
|
||||
),
|
||||
]
|
||||
} catch {
|
||||
return []
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static round6(n: number): string {
|
||||
|
|
|
@ -8,11 +8,11 @@ import GeocodingProvider, {
|
|||
import { decode as pluscode_decode } from "pluscodes"
|
||||
|
||||
export default class OpenLocationCodeSearch implements GeocodingProvider {
|
||||
|
||||
/**
|
||||
* A regex describing all plus-codes
|
||||
*/
|
||||
public static readonly _isPlusCode = /^([2-9CFGHJMPQRVWX]{2}|00){2,4}\+([2-9CFGHJMPQRVWX]{2,3})?$/
|
||||
public static readonly _isPlusCode =
|
||||
/^([2-9CFGHJMPQRVWX]{2}|00){2,4}\+([2-9CFGHJMPQRVWX]{2,3})?$/
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -35,17 +35,18 @@ export default class OpenLocationCodeSearch implements GeocodingProvider {
|
|||
}
|
||||
const { latitude, longitude } = pluscode_decode(query)
|
||||
|
||||
return [{
|
||||
lon: longitude,
|
||||
lat: latitude,
|
||||
description: "Open Location Code",
|
||||
osm_id: query,
|
||||
display_name: query.toUpperCase(),
|
||||
}]
|
||||
return [
|
||||
{
|
||||
lon: longitude,
|
||||
lat: latitude,
|
||||
description: "Open Location Code",
|
||||
osm_id: query,
|
||||
display_name: query.toUpperCase(),
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
suggest?(query: string, options?: GeocodingOptions): Store<GeocodeResult[]> {
|
||||
return Stores.FromPromise(this.search(query, options))
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,7 +25,12 @@ export default class PhotonSearch implements GeocodingProvider, ReverseGeocoding
|
|||
private readonly suggestionLimit: number = 5
|
||||
private readonly searchLimit: number = 1
|
||||
|
||||
constructor(ignoreBounds: boolean = false, suggestionLimit:number = 5, searchLimit:number = 1, endpoint?: string) {
|
||||
constructor(
|
||||
ignoreBounds: boolean = false,
|
||||
suggestionLimit: number = 5,
|
||||
searchLimit: number = 1,
|
||||
endpoint?: string
|
||||
) {
|
||||
this.ignoreBounds = ignoreBounds
|
||||
this.suggestionLimit = suggestionLimit
|
||||
this.searchLimit = searchLimit
|
||||
|
|
|
@ -15,27 +15,22 @@ export default class SearchUtils {
|
|||
if (searchTerm === "personal") {
|
||||
window.location.href = ThemeSearch.createUrlFor({ id: "personal" }, undefined)
|
||||
return true
|
||||
|
||||
}
|
||||
if (searchTerm === "bugs" || searchTerm === "issues") {
|
||||
window.location.href = "https://github.com/pietervdvn/MapComplete/issues"
|
||||
return true
|
||||
|
||||
}
|
||||
if (searchTerm === "source") {
|
||||
window.location.href = "https://github.com/pietervdvn/MapComplete"
|
||||
return true
|
||||
|
||||
}
|
||||
if (searchTerm === "docs") {
|
||||
window.location.href = "https://github.com/pietervdvn/MapComplete/tree/develop/Docs"
|
||||
return true
|
||||
|
||||
}
|
||||
if (searchTerm === "osmcha" || searchTerm === "stats") {
|
||||
window.location.href = Utils.OsmChaLinkFor(7)
|
||||
return true
|
||||
|
||||
}
|
||||
if (searchTerm === "studio") {
|
||||
window.location.href = "./studio.html"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue